tlb.cc (5431:914851b44a74) tlb.cc (5433:1b0b8e9ba6a9)
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);
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 SegAttr attr = tc->readMiscRegNoEffect(MISCREG_SEG_ATTR(seg));
578 if (!attr.writable && write)
579 return new GeneralProtection(0);
580 if (!attr.readable && !write && !execute)
581 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 }
582 Addr base = tc->readMiscRegNoEffect(MISCREG_SEG_BASE(seg));
583 Addr limit = tc->readMiscRegNoEffect(MISCREG_SEG_LIMIT(seg));
586 Addr base = tc->readMiscRegNoEffect(MISCREG_SEG_BASE(seg));
587 Addr limit = tc->readMiscRegNoEffect(MISCREG_SEG_LIMIT(seg));
584 if (!attr.expandDown) {
588 if (expandDown) {
585 DPRINTF(TLB, "Checking an expand down segment.\n");
586 // We don't have to worry about the access going around the
587 // end of memory because accesses will be broken up into
588 // pieces at boundaries aligned on sizes smaller than an
589 // entire address space. We do have to worry about the limit
590 // being less than the base.
591 if (limit < base) {
592 if (limit < vaddr + req->getSize() && vaddr < base)

--- 262 unchanged lines hidden ---
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 ---