arch-x86: Add some DPRINTFs to the TLB.

These DPRINTFs are related to segmentation handling when in 32 bit
protected mode.

Change-Id: I47eb2bc834fc748b5d01d85e02ea8b3f6e03091b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55246
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2022-01-09 01:47:57 -08:00
parent c71058cfa5
commit 15df63624b

View File

@@ -334,16 +334,23 @@ TLB::translate(const RequestPtr &req,
// If we're not in 64-bit mode, do protection/limit checks
if (m5Reg.mode != LongMode) {
DPRINTF(TLB, "Not in long mode. Checking segment protection.\n");
SegAttr attr = tc->readMiscRegNoEffect(MISCREG_SEG_ATTR(seg));
// Check for an unusable segment.
if (attr.unusable)
if (attr.unusable) {
DPRINTF(TLB, "Unusable segment.\n");
return std::make_shared<GeneralProtection>(0);
}
bool expandDown = false;
if (seg >= SEGMENT_REG_ES && seg <= SEGMENT_REG_HS) {
if (!attr.writable && (mode == BaseMMU::Write || storeCheck))
if (!attr.writable && (mode == BaseMMU::Write || storeCheck)) {
DPRINTF(TLB, "Tried to write to unwritable segment.\n");
return std::make_shared<GeneralProtection>(0);
if (!attr.readable && mode == BaseMMU::Read)
}
if (!attr.readable && mode == BaseMMU::Read) {
DPRINTF(TLB, "Tried to read from unreadble segment.\n");
return std::make_shared<GeneralProtection>(0);
}
expandDown = attr.expandDown;
}
@@ -361,8 +368,11 @@ TLB::translate(const RequestPtr &req,
if (offset <= limit || endOffset <= limit)
return std::make_shared<GeneralProtection>(0);
} else {
if (offset > limit || endOffset > limit)
if (offset > limit || endOffset > limit) {
DPRINTF(TLB, "Segment limit check failed, "
"offset = %#x limit = %#x.\n", offset, limit);
return std::make_shared<GeneralProtection>(0);
}
}
}
if (m5Reg.submode != SixtyFourBitMode ||