Deleted Added
sdiff udiff text old ( 5917:7d7df4ad7486 ) new ( 5965:71f8d7c12619 )
full compact
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 *

--- 561 unchanged lines hidden (view full) ---

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 SegAttr attr = tc->readMiscRegNoEffect(MISCREG_SEG_ATTR(seg));
579 if (seg >= SEGMENT_REG_ES && seg <= SEGMENT_REG_HS) {
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 }
587 Addr base = tc->readMiscRegNoEffect(MISCREG_SEG_BASE(seg));
588 Addr limit = tc->readMiscRegNoEffect(MISCREG_SEG_LIMIT(seg));
589 // This assumes we're not in 64 bit mode. If we were, the default
590 // address size is 64 bits, overridable to 32.
591 int size = 32;
592 bool sizeOverride = (flags & (AddrSizeFlagBit << FlagShift));
593 if (csAttr.defaultSize && sizeOverride ||
594 !csAttr.defaultSize && !sizeOverride)
595 size = 16;
596 Addr offset = bits(vaddr - base, size-1, 0);
597 Addr endOffset = offset + req->getSize() - 1;
598 if (expandDown) {
599 DPRINTF(TLB, "Checking an expand down segment.\n");
600 warn_once("Expand down segments are untested.\n");
601 if (offset <= limit || endOffset <= limit)
602 return new GeneralProtection(0);
603 } else {
604 if (offset > limit || endOffset > limit)
605 return new GeneralProtection(0);
606 }
607 }
608 // If paging is enabled, do the translation.
609 if (cr0.pg) {
610 DPRINTF(TLB, "Paging enabled.\n");
611 // The vaddr already has the segment base applied.
612 TlbEntry *entry = lookup(vaddr);
613 if (!entry) {

--- 179 unchanged lines hidden ---