diff options
author | Lisa Hsu <Lisa.Hsu@amd.com> | 2011-09-02 17:04:00 -0700 |
---|---|---|
committer | Lisa Hsu <Lisa.Hsu@amd.com> | 2011-09-02 17:04:00 -0700 |
commit | 365966304e37d05f5e9e1f987a5956d55ea5f2c7 (patch) | |
tree | 92666f0d610ba1b1e4987750bc6a312a3971e977 /src/arch/x86/tlb.cc | |
parent | f6a2ef22ffc70d2467a2b9c0bc1532f73be067b5 (diff) | |
download | gem5-365966304e37d05f5e9e1f987a5956d55ea5f2c7.tar.xz |
TLB: comments and a helpful warning.
Nothing big here, but when you have an address that is not in the page table request to be allocated, if it falls outside of the maximum stack range all you get is a page fault and you don't know why. Add a little warn() to explain it a bit. Also add some comments and alter logic a little so that you don't totally ignore the return value of checkAndAllocNextPage().
Diffstat (limited to 'src/arch/x86/tlb.cc')
-rw-r--r-- | src/arch/x86/tlb.cc | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/arch/x86/tlb.cc b/src/arch/x86/tlb.cc index 199f070d3..d2cd5eaee 100644 --- a/src/arch/x86/tlb.cc +++ b/src/arch/x86/tlb.cc @@ -618,8 +618,22 @@ TLB::translate(RequestPtr req, ThreadContext *tc, Translation *translation, TlbEntry newEntry; bool success = p->pTable->lookup(vaddr, newEntry); if (!success && mode != Execute) { - p->checkAndAllocNextPage(vaddr); - success = p->pTable->lookup(vaddr, newEntry); + // This may fail because for some reason the requested + // address is not allocatable on the stack. If it's a stack + // address, then it's because the address fell outside of + // max stack range and user should increase max size of + // stack. Otherwise, it could be a random address that was + // not in the page table and not on the stack. Either way, + // you'll end up with a page fault. + if (p->checkAndAllocNextPage(vaddr)) + // Might as well not check this if you failed to + // allocate. Partially nested this just so code + // maintainers can understand this is a separate and + // necessary step not sufficient just by reading return + // value of checkAndAlloc call because there is a side + // effect. This call will populate (it's called by + // reference). + success = p->pTable->lookup(vaddr, newEntry); } if (!success) { return new PageFault(vaddr, true, mode, true, false); |