From 15df63624bc915b265c89666d09cb908a19c8d74 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 9 Jan 2022 01:47:57 -0800 Subject: [PATCH] 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 Reviewed-by: Matt Sinclair Maintainer: Matt Sinclair Tested-by: kokoro --- src/arch/x86/tlb.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/arch/x86/tlb.cc b/src/arch/x86/tlb.cc index b2856edc80..7d20e004da 100644 --- a/src/arch/x86/tlb.cc +++ b/src/arch/x86/tlb.cc @@ -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(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(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(0); + } expandDown = attr.expandDown; } @@ -361,8 +368,11 @@ TLB::translate(const RequestPtr &req, if (offset <= limit || endOffset <= limit) return std::make_shared(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(0); + } } } if (m5Reg.submode != SixtyFourBitMode ||