1/* 2 * Copyright (c) 2007-2008 The Hewlett-Packard Development Company 3 * All rights reserved. 4 * 5 * Redistribution and use of this software in source and binary forms, 6 * with or without modification, are permitted provided that the 7 * following conditions are met: 8 * --- 560 unchanged lines hidden (view full) --- 569 Efer efer = tc->readMiscRegNoEffect(MISCREG_EFER); 570 SegAttr csAttr = tc->readMiscRegNoEffect(MISCREG_CS_ATTR); 571 // If we're not in 64-bit mode, do protection/limit checks 572 if (!efer.lma || !csAttr.longMode) { 573 DPRINTF(TLB, "Not in long mode. Checking segment protection.\n"); 574 // Check for a NULL segment selector. 575 if (!tc->readMiscRegNoEffect(MISCREG_SEG_SEL(seg))) 576 return new GeneralProtection(0); |
577 bool expandDown = false; 578 if (seg >= SEGMENT_REG_ES && seg <= SEGMENT_REG_HS) { 579 SegAttr attr = tc->readMiscRegNoEffect(MISCREG_SEG_ATTR(seg)); 580 if (!attr.writable && write) 581 return new GeneralProtection(0); 582 if (!attr.readable && !write && !execute) 583 return new GeneralProtection(0); 584 expandDown = attr.expandDown; 585 } |
586 Addr base = tc->readMiscRegNoEffect(MISCREG_SEG_BASE(seg)); 587 Addr limit = tc->readMiscRegNoEffect(MISCREG_SEG_LIMIT(seg)); |
588 if (expandDown) { |
589 DPRINTF(TLB, "Checking an expand down segment.\n"); 590 // We don't have to worry about the access going around the 591 // end of memory because accesses will be broken up into 592 // pieces at boundaries aligned on sizes smaller than an 593 // entire address space. We do have to worry about the limit 594 // being less than the base. 595 if (limit < base) { 596 if (limit < vaddr + req->getSize() && vaddr < base) --- 262 unchanged lines hidden --- |