arm: Use the "reg" ABI for gem5 ops.
authorGabe Black <gabe.black@gmail.com>
Mon, 18 Jan 2021 01:48:07 +0000 (17:48 -0800)
committerGabe Black <gabe.black@gmail.com>
Wed, 20 Jan 2021 21:28:41 +0000 (21:28 +0000)
The generic PseudoInstABI just calls back into the ISA specific
getArgument function, and that adds a lot of handling for cases that
aren't used and, besides those, basically just boils down to the "reg"
ABI anyway.

Change-Id: I57e738631dbccbf89cba3a6ca62b1f954b39e959
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39316
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/arch/arm/isa/includes.isa
src/arch/arm/isa/insts/m5ops.isa
src/arch/arm/tlb.cc

index 13b47c8e0ffd7f15a147fd1dfe1cf0f01a3d6e01..6af382af2ba699e172ace891df5edd54b56fa16c 100644 (file)
@@ -105,6 +105,7 @@ output exec {{
 #include "arch/arm/htm.hh"
 #include "arch/arm/isa_traits.hh"
 #include "arch/arm/pauth_helpers.hh"
+#include "arch/arm/reg_abi.hh"
 #include "arch/arm/semihosting.hh"
 #include "arch/arm/utility.hh"
 #include "arch/generic/memhelpers.hh"
index 9b320652764ca96c2e943d6ccb24b6252bd7bd3f..fafb44b6e459b0d4c47a62800c29b34f05a778bb 100644 (file)
 let {{
     gem5OpCode = '''
     uint64_t ret;
-    bool recognized = PseudoInst::pseudoInst<PseudoInstABI>(
-            xc->tcBase(), bits(machInst, 23, 16), ret);
-    if (!recognized)
+    int func = bits(machInst, 23, 16);
+    auto *tc = xc->tcBase();
+    if (!PseudoInst::pseudoInst<%s>(tc, func, ret))
         fault = std::make_shared<UndefinedInstruction>(machInst, true);
     '''
     gem5OpIop = ArmInstObjParams("gem5op", "Gem5Op64", "PredOp",
-                                 { "code": gem5OpCode + 'X0 = ret;',
+                                 { "code": gem5OpCode % "RegABI64" +
+                                   'X0 = ret;',
                                    "predicate_test": predicateTest },
                                  [ "IsNonSpeculative", "IsUnverifiable" ]);
     header_output += BasicDeclare.subst(gem5OpIop)
@@ -52,7 +53,7 @@ let {{
     exec_output += PredOpExecute.subst(gem5OpIop)
 
     gem5OpIop = ArmInstObjParams("gem5op", "Gem5Op", "PredOp",
-                                 { "code": gem5OpCode + \
+                                 { "code": gem5OpCode % "RegABI32" + \
                                    'R0 = bits(ret, 31, 0);\n' + \
                                    'R1 = bits(ret, 63, 32);',
                                    "predicate_test": predicateTest },
index 5d2ed902d2eb1e63cb3b983a8e63e74175e03bf7..91c70884e34baab602bcf1cbb319a3829e9ccce8 100644 (file)
@@ -47,6 +47,7 @@
 #include "arch/arm/faults.hh"
 #include "arch/arm/isa.hh"
 #include "arch/arm/pagetable.hh"
+#include "arch/arm/reg_abi.hh"
 #include "arch/arm/self_debug.hh"
 #include "arch/arm/stage2_lookup.hh"
 #include "arch/arm/stage2_mmu.hh"
@@ -146,9 +147,14 @@ TLB::finalizePhysical(const RequestPtr &req,
             [func, mode](ThreadContext *tc, PacketPtr pkt) -> Cycles
             {
                 uint64_t ret;
-                PseudoInst::pseudoInst<PseudoInstABI>(tc, func, ret);
+                if (inAArch64(tc))
+                    PseudoInst::pseudoInst<RegABI64>(tc, func, ret);
+                else
+                    PseudoInst::pseudoInst<RegABI32>(tc, func, ret);
+
                 if (mode == Read)
                     pkt->setLE(ret);
+
                 return Cycles(1);
             }
         );