Giacomo Travaglini has submitted this change and it was merged. (
https://gem5-review.googlesource.com/c/public/gem5/+/14000 )
Change subject: arch-arm: ArmSystem::resetAddr64 renamed to be used in
AArch32
......................................................................
arch-arm: ArmSystem::resetAddr64 renamed to be used in AArch32
ARMv8 differs from ARMv7 with the presence of RVBAR register, which
contains the implementation defined reset address when EL3 is not
implemented.
The entry 0x0 in the AArch32 vector table, once used for the Reset
Vector, is now marked as "Not used", stating that it is now IMPLEMENTATION
DEFINED. An implementation might still use this vector table entry to
hold the Reset vector, but having a Reset address != than the general
vector table (for any other exception) is allowed.
At the moment any Reset exception is still using 0 as a vector table
base address. This patch is extending the ArmSystem::resetAddr64 to
ArmSystem::resetAddr so that it can be used for initializing
MVBAR/RVBAR. In order to do so, we are providing a specialized behavior
for the Reset exception when evaluating the vector base address.
Change-Id: I051a730dc089e194db3b107bbed19251c661f87e
Signed-off-by: Giacomo Travaglini <[email protected]>
Reviewed-by: Andreas Sandberg <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/14000
Maintainer: Andreas Sandberg <[email protected]>
---
M src/arch/arm/ArmSystem.py
M src/arch/arm/faults.cc
M src/arch/arm/faults.hh
M src/arch/arm/isa.cc
M src/arch/arm/system.cc
M src/arch/arm/system.hh
6 files changed, 48 insertions(+), 26 deletions(-)
Approvals:
Andreas Sandberg: Looks good to me, approved; Looks good to me, approved
diff --git a/src/arch/arm/ArmSystem.py b/src/arch/arm/ArmSystem.py
index cd08d74..bee38a4 100644
--- a/src/arch/arm/ArmSystem.py
+++ b/src/arch/arm/ArmSystem.py
@@ -68,14 +68,13 @@
have_crypto = Param.Bool(False,
"True if Crypto Extensions is implemented")
have_lpae = Param.Bool(True, "True if LPAE is implemented")
+ reset_addr = Param.Addr(0x0,
+ "Reset address (ARMv8)")
+ auto_reset_addr = Param.Bool(False,
+ "Determine reset address from kernel entry point if no boot
loader")
highest_el_is_64 = Param.Bool(False,
"True if the register width of the highest implemented exception
level "
"is 64 bits (ARMv8)")
- reset_addr_64 = Param.Addr(0x0,
- "Reset address if the highest implemented exception level is 64
bits "
- "(ARMv8)")
- auto_reset_addr_64 = Param.Bool(False,
- "Determine reset address from kernel entry point if no boot
loader")
phys_addr_range_64 = Param.UInt8(40,
"Supported physical address range in bits when using AArch64
(ARMv8)")
have_large_asid_64 = Param.Bool(False,
diff --git a/src/arch/arm/faults.cc b/src/arch/arm/faults.cc
index bd06ea2..665b298 100644
--- a/src/arch/arm/faults.cc
+++ b/src/arch/arm/faults.cc
@@ -297,12 +297,9 @@
{
Addr base;
- // ARM ARM issue C B1.8.1
- bool haveSecurity = ArmSystem::haveSecurity(tc);
-
// Check for invalid modes
CPSR cpsr = tc->readMiscRegNoEffect(MISCREG_CPSR);
- assert(haveSecurity || cpsr.mode != MODE_MON);
+ assert(ArmSystem::haveSecurity(tc) || cpsr.mode != MODE_MON);
assert(ArmSystem::haveVirtualization(tc) || cpsr.mode != MODE_HYP);
switch (cpsr.mode)
@@ -318,10 +315,12 @@
if (sctlr.v) {
base = HighVecs;
} else {
- base = haveSecurity ? tc->readMiscReg(MISCREG_VBAR) : 0;
+ base = ArmSystem::haveSecurity(tc) ?
+ tc->readMiscReg(MISCREG_VBAR) : 0;
}
break;
}
+
return base + offset(tc);
}
@@ -694,6 +693,24 @@
setSyndrome(tc, getSyndromeReg64());
}
+Addr
+Reset::getVector(ThreadContext *tc)
+{
+ Addr base;
+
+ // Check for invalid modes
+ CPSR M5_VAR_USED cpsr = tc->readMiscRegNoEffect(MISCREG_CPSR);
+ assert(ArmSystem::haveSecurity(tc) || cpsr.mode != MODE_MON);
+ assert(ArmSystem::haveVirtualization(tc) || cpsr.mode != MODE_HYP);
+
+ // RVBAR is aliased (implemented as) MVBAR in gem5, since the two
+ // are mutually exclusive; there is no need to check here for
+ // which register to use since they hold the same value
+ base = tc->readMiscReg(MISCREG_MVBAR);
+
+ return base + offset(tc);
+}
+
void
Reset::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
@@ -715,7 +732,7 @@
}
} else {
// Advance the PC to the IMPLEMENTATION DEFINED reset value
- PCState pc = ArmSystem::resetAddr64(tc);
+ PCState pc = ArmSystem::resetAddr(tc);
pc.aarch64(true);
pc.nextAArch64(true);
tc->pcState(pc);
diff --git a/src/arch/arm/faults.hh b/src/arch/arm/faults.hh
index 90b5501..dcda03b 100644
--- a/src/arch/arm/faults.hh
+++ b/src/arch/arm/faults.hh
@@ -81,7 +81,7 @@
bool hypRouted; // True if the fault has been routed to Hypervisor
- Addr getVector(ThreadContext *tc);
+ virtual Addr getVector(ThreadContext *tc);
Addr getVector64(ThreadContext *tc);
public:
@@ -269,6 +269,9 @@
class Reset : public ArmFaultVals<Reset>
{
+ protected:
+ Addr getVector(ThreadContext *tc) override;
+
public:
void invoke(ThreadContext *tc, const StaticInstPtr &inst =
StaticInst::nullStaticInstPtr) override;
diff --git a/src/arch/arm/isa.cc b/src/arch/arm/isa.cc
index a849d04..5c1139d 100644
--- a/src/arch/arm/isa.cc
+++ b/src/arch/arm/isa.cc
@@ -201,6 +201,10 @@
CPSR cpsr = 0;
cpsr.mode = MODE_USER;
+ if (FullSystem) {
+ miscRegs[MISCREG_MVBAR] = system->resetAddr();
+ }
+
miscRegs[MISCREG_CPSR] = cpsr;
updateRegMap(cpsr);
@@ -247,7 +251,7 @@
ISA::clear64(const ArmISAParams *p)
{
CPSR cpsr = 0;
- Addr rvbar = system->resetAddr64();
+ Addr rvbar = system->resetAddr();
switch (system->highestEL()) {
// Set initial EL to highest implemented EL using associated stack
// pointer (SP_ELx); set RVBAR_ELx to implementation defined reset
diff --git a/src/arch/arm/system.cc b/src/arch/arm/system.cc
index 21b02e9..0630661 100644
--- a/src/arch/arm/system.cc
+++ b/src/arch/arm/system.cc
@@ -63,10 +63,10 @@
_haveVirtualization(p->have_virtualization),
_haveCrypto(p->have_crypto),
_genericTimer(nullptr),
+ _resetAddr(p->auto_reset_addr ?
+ (kernelEntry & loadAddrMask) + loadAddrOffset :
+ p->reset_addr),
_highestELIs64(p->highest_el_is_64),
- _resetAddr64(p->auto_reset_addr_64 ?
- (kernelEntry & loadAddrMask) + loadAddrOffset :
- p->reset_addr_64),
_physAddrRange64(p->phys_addr_range_64),
_haveLargeAsid64(p->have_large_asid_64),
_m5opRange(p->m5ops_base ?
@@ -248,9 +248,9 @@
}
Addr
-ArmSystem::resetAddr64(ThreadContext *tc)
+ArmSystem::resetAddr(ThreadContext *tc)
{
- return getArmSystem(tc)->resetAddr64();
+ return getArmSystem(tc)->resetAddr();
}
uint8_t
diff --git a/src/arch/arm/system.hh b/src/arch/arm/system.hh
index 2e236f7..c697460 100644
--- a/src/arch/arm/system.hh
+++ b/src/arch/arm/system.hh
@@ -99,18 +99,17 @@
GenericTimer *_genericTimer;
/**
+ * Reset address (ARMv8)
+ */
+ const Addr _resetAddr;
+
+ /**
* True if the register width of the highest implemented exception
level is
* 64 bits (ARMv8)
*/
bool _highestELIs64;
/**
- * Reset address if the highest implemented exception level is 64 bits
- * (ARMv8)
- */
- const Addr _resetAddr64;
-
- /**
* Supported physical address range in bits if the highest implemented
* exception level is 64 bits (ARMv8)
*/
@@ -212,7 +211,7 @@
/** Returns the reset address if the highest implemented exception
level is
* 64 bits (ARMv8) */
- Addr resetAddr64() const { return _resetAddr64; }
+ Addr resetAddr() const { return _resetAddr; }
/** Returns true if ASID is 16 bits in AArch64 (ARMv8) */
bool haveLargeAsid64() const { return _haveLargeAsid64; }
@@ -283,7 +282,7 @@
/** Returns the reset address if the highest implemented exception
level
* for the system of a specific thread context is 64 bits (ARMv8)
*/
- static Addr resetAddr64(ThreadContext *tc);
+ static Addr resetAddr(ThreadContext *tc);
/** Returns the supported physical address range in bits for the
system of a
* specific thread context
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/14000
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I051a730dc089e194db3b107bbed19251c661f87e
Gerrit-Change-Number: 14000
Gerrit-PatchSet: 2
Gerrit-Owner: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev