diff options
| author | Richard Henderson <richard.henderson@linaro.org> | 2025-07-27 21:44:02 -1000 |
|---|---|---|
| committer | Richard Henderson <richard.henderson@linaro.org> | 2025-08-28 06:39:25 +1000 |
| commit | 50e59ad0b7b1c71e858939504a749bf1a1313e2e (patch) | |
| tree | a63c44663f9e9d16bda5c62e8816cf2e9b413557 /linux-user/riscv/elfload.c | |
| parent | 1d4774b60e3dfdc9295e36c5fa298b457d10db10 (diff) | |
| download | focaccia-qemu-50e59ad0b7b1c71e858939504a749bf1a1313e2e.tar.gz focaccia-qemu-50e59ad0b7b1c71e858939504a749bf1a1313e2e.zip | |
linux-user: Move get_elf_hwcap to riscv/elfload.c
Change the return type to abi_ulong, and pass in the cpu. As this is the last instance of get_elf_hwcap to be converted, remove the ifdef around the declaration in loader.h. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'linux-user/riscv/elfload.c')
| -rw-r--r-- | linux-user/riscv/elfload.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/linux-user/riscv/elfload.c b/linux-user/riscv/elfload.c index f92adb7308..2e7d622232 100644 --- a/linux-user/riscv/elfload.c +++ b/linux-user/riscv/elfload.c @@ -9,3 +9,15 @@ const char *get_elf_cpu_model(uint32_t eflags) { return "max"; } + +abi_ulong get_elf_hwcap(CPUState *cs) +{ +#define MISA_BIT(EXT) (1 << (EXT - 'A')) + RISCVCPU *cpu = RISCV_CPU(cs); + uint32_t mask = MISA_BIT('I') | MISA_BIT('M') | MISA_BIT('A') + | MISA_BIT('F') | MISA_BIT('D') | MISA_BIT('C') + | MISA_BIT('V'); + + return cpu->env.misa_ext & mask; +#undef MISA_BIT +} |