577a578
> SegAttr attr = tc->readMiscRegNoEffect(MISCREG_SEG_ATTR(seg));
579d579
< SegAttr attr = tc->readMiscRegNoEffect(MISCREG_SEG_ATTR(seg));
584a585
>
587a589,597
> // This assumes we're not in 64 bit mode. If we were, the default
> // address size is 64 bits, overridable to 32.
> int size = 32;
> bool sizeOverride = (flags & (AddrSizeFlagBit << FlagShift));
> if (csAttr.defaultSize && sizeOverride ||
> !csAttr.defaultSize && !sizeOverride)
> size = 16;
> Addr offset = bits(vaddr - base, size-1, 0);
> Addr endOffset = offset + req->getSize() - 1;
590,601c600,602
< // We don't have to worry about the access going around the
< // end of memory because accesses will be broken up into
< // pieces at boundaries aligned on sizes smaller than an
< // entire address space. We do have to worry about the limit
< // being less than the base.
< if (limit < base) {
< if (limit < vaddr + req->getSize() && vaddr < base)
< return new GeneralProtection(0);
< } else {
< if (limit < vaddr + req->getSize())
< return new GeneralProtection(0);
< }
---
> warn_once("Expand down segments are untested.\n");
> if (offset <= limit || endOffset <= limit)
> return new GeneralProtection(0);
603,609c604,605
< if (limit < base) {
< if (vaddr <= limit || vaddr + req->getSize() >= base)
< return new GeneralProtection(0);
< } else {
< if (vaddr <= limit && vaddr + req->getSize() >= base)
< return new GeneralProtection(0);
< }
---
> if (offset > limit || endOffset > limit)
> return new GeneralProtection(0);