summaryrefslogtreecommitdiff
path: root/src/arch/arm/process.hh
diff options
context:
space:
mode:
authorGiacomo Travaglini <giacomo.travaglini@arm.com>2018-09-20 12:39:36 +0100
committerGiacomo Travaglini <giacomo.travaglini@arm.com>2018-10-02 21:12:01 +0000
commit6efe7e1abf9d289859eb23b52b3a319f15f2736a (patch)
treeea1e35d7cffd54255c905d9c0e83520ef14eaf1a /src/arch/arm/process.hh
parent352d666fa1e9b5ae960127c95d19cf63c8ff0df7 (diff)
downloadgem5-6efe7e1abf9d289859eb23b52b3a319f15f2736a.tar.xz
sim-se: Different HWCAP for ArmProcess32/64
AArch32 and AArch64 have different HWCAP flags in Linux, but we are currently using AArch32 HWCAP flags to initialize the aux vector of both AArch32 and AArch64 binaries. This patch also fixes a bug that was introduced by running in SE mode a target binary compiled with glibc > 2.18. Using AArch32 flags resulted on CPUID flag being set for AArch64. This incorrectly tells libc that emulation of the midr_el1 is supported. In FullSystem this might work, but since we are in Syscall Emulation there is no OS behind emulating the mrs midr_el1 instruction. By separating AArch32 flags from AArch64 flags we are turning off the CPUID hwcap flag in SE mode. Change-Id: I9f651957ba9d19dc2bc06606de070c6586f0f9fa Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/12884 Reviewed-by: Brandon Potter <Brandon.Potter@amd.com> Maintainer: Brandon Potter <Brandon.Potter@amd.com>
Diffstat (limited to 'src/arch/arm/process.hh')
-rw-r--r--src/arch/arm/process.hh19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/arch/arm/process.hh b/src/arch/arm/process.hh
index f4f0874c0..a6f46c1a0 100644
--- a/src/arch/arm/process.hh
+++ b/src/arch/arm/process.hh
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2012 ARM Limited
+* Copyright (c) 2012, 2018 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -61,6 +61,17 @@ class ArmProcess : public Process
ObjectFile::Arch _arch);
template<class IntType>
void argsInit(int pageSize, ArmISA::IntRegIndex spIndex);
+
+ template<class IntType>
+ IntType armHwcap() const
+ {
+ return static_cast<IntType>(armHwcapImpl());
+ }
+
+ /**
+ * AT_HWCAP is 32-bit wide on AArch64 as well so we can
+ * safely return an uint32_t */
+ virtual uint32_t armHwcapImpl() const = 0;
};
class ArmProcess32 : public ArmProcess
@@ -71,6 +82,9 @@ class ArmProcess32 : public ArmProcess
void initState();
+ /** AArch32 AT_HWCAP */
+ uint32_t armHwcapImpl() const override;
+
public:
ArmISA::IntReg getSyscallArg(ThreadContext *tc, int &i, int width);
@@ -87,6 +101,9 @@ class ArmProcess64 : public ArmProcess
void initState();
+ /** AArch64 AT_HWCAP */
+ uint32_t armHwcapImpl() const override;
+
public:
ArmISA::IntReg getSyscallArg(ThreadContext *tc, int &i, int width);