Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/55244 )
Change subject: arch-x86: Filter out the NMI masking bit from the CMOS
offset.
......................................................................
arch-x86: Filter out the NMI masking bit from the CMOS offset.
A (another) weird/terrible quirk of the architecture of the PC is that
the the highest order bit of the value which selects a register to read
from the CMOS NVRAM/RTC is stolen and repurposed to enable/disable NMIs
since the 286, if the internet is to be believed.
Fortunately We don't currently attempt to generate an NMI anywhere, and so
this bit won't do anything in gem5 currently.
Unfortunately if we treat this value as the real offset without masking
off this bit, if software attempts to disable NMIs with it, it will
trigger an out of bounds assert in the CMOS device.
This change makes the CMOS device slightly smarter and has it maintain
but ignore the NMI disabling bit.
Change-Id: I8d7d0f1b0aadcca2060bf6a27931035859d66ca7
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55244
Reviewed-by: Gabe Black <gabe.bl...@gmail.com>
Maintainer: Gabe Black <gabe.bl...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/dev/x86/cmos.cc
M src/dev/x86/cmos.hh
2 files changed, 38 insertions(+), 3 deletions(-)
Approvals:
Gabe Black: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/dev/x86/cmos.cc b/src/dev/x86/cmos.cc
index 19fab68..d141922 100644
--- a/src/dev/x86/cmos.cc
+++ b/src/dev/x86/cmos.cc
@@ -56,7 +56,7 @@
pkt->setLE(address);
break;
case 0x1:
- pkt->setLE(readRegister(address));
+ pkt->setLE(readRegister(address.regNum));
break;
default:
panic("Read from undefined CMOS port.\n");
@@ -75,7 +75,8 @@
address = pkt->getLE<uint8_t>();
break;
case 0x1:
- writeRegister(address, pkt->getLE<uint8_t>());
+ // Ignore the NMI mask bit since we never try to generate one
anyway.
+ writeRegister(address.regNum, pkt->getLE<uint8_t>());
break;
default:
panic("Write to undefined CMOS port.\n");
diff --git a/src/dev/x86/cmos.hh b/src/dev/x86/cmos.hh
index 72937af..de64d5a 100644
--- a/src/dev/x86/cmos.hh
+++ b/src/dev/x86/cmos.hh
@@ -29,6 +29,7 @@
#ifndef __DEV_X86_CMOS_HH__
#define __DEV_X86_CMOS_HH__
+#include "base/bitunion.hh"
#include "dev/intpin.hh"
#include "dev/io_device.hh"
#include "dev/mc146818.hh"
@@ -45,7 +46,12 @@
protected:
Tick latency;
- uint8_t address;
+ BitUnion8(CmosAddress)
+ Bitfield<6, 0> regNum;
+ Bitfield<7> nmiMask;
+ EndBitUnion(CmosAddress)
+
+ CmosAddress address;
static const int numRegs = 128;
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/55244
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I8d7d0f1b0aadcca2060bf6a27931035859d66ca7
Gerrit-Change-Number: 55244
Gerrit-PatchSet: 11
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Bradford Beckmann <bradford.beckm...@gmail.com>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Matt Sinclair <mattdsincl...@gmail.com>
Gerrit-Reviewer: Matthew Poremba <matthew.pore...@amd.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s