From f7da70bd10f76090961051e85c7ed37ad26ac2ce Mon Sep 17 00:00:00 2001 From: Robert Hauser Date: Sat, 16 Mar 2024 09:05:30 +0000 Subject: [PATCH] arch-riscv,sim: simplify templates for GuestAddr Simplify templates in argument handling for ABI=RicsvISA::RegABI32 and Arg=GuestAddr. Change-Id: I6af2e6fe1b77b1367136a8e8621053069bf3c3f0 --- src/arch/riscv/reg_abi.hh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/arch/riscv/reg_abi.hh b/src/arch/riscv/reg_abi.hh index 6f1c8cbc6c..0869e0f4a6 100644 --- a/src/arch/riscv/reg_abi.hh +++ b/src/arch/riscv/reg_abi.hh @@ -77,22 +77,20 @@ struct Argument -struct Argument && - std::is_same::value && - ABI::template IsWideV>> +// This method will be used for RV32 pointers. +template <> +struct Argument { - static Arg + using ABI = RiscvISA::RegABI32; + + static GuestAddr get(ThreadContext *tc, typename ABI::State &state) { panic_if(state >= ABI::ArgumentRegs.size(), "Ran out of syscall argument registers."); auto arg = bits(tc->getReg(ABI::ArgumentRegs[state++]), 31, 0); - return *reinterpret_cast(&arg); + return *reinterpret_cast(&arg); } };