From 01488f71711c5553a39e848a13a096034bf9bdb5 Mon Sep 17 00:00:00 2001 From: Jan Matyas Date: Thu, 16 Jan 2025 16:05:44 +0100 Subject: [PATCH] Remove target/riscv/asm.h The file asm.h is only used by riscv-011.c. Remove the whole asm.h file and inline the two functions into riscv-011.c which is the only place of use. Change-Id: Ifa4b2b87ab9f3f50c78a75361003ce478bfd9d5f Signed-off-by: Jan Matyas --- src/target/riscv/asm.h | 40 ------------------------------------ src/target/riscv/program.c | 1 - src/target/riscv/riscv-011.c | 26 +++++++++++++++++++++++ src/target/riscv/riscv-013.c | 1 - 4 files changed, 26 insertions(+), 42 deletions(-) delete mode 100644 src/target/riscv/asm.h diff --git a/src/target/riscv/asm.h b/src/target/riscv/asm.h deleted file mode 100644 index 828cd864c..000000000 --- a/src/target/riscv/asm.h +++ /dev/null @@ -1,40 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ - -#ifndef OPENOCD_TARGET_RISCV_ASM_H -#define OPENOCD_TARGET_RISCV_ASM_H - -#include "riscv.h" - -/*** Version-independent functions that we don't want in the main address space. ***/ - -static uint32_t load(const struct target *target, unsigned int rd, - unsigned int base, uint16_t offset) __attribute__ ((unused)); -static uint32_t load(const struct target *target, unsigned int rd, - unsigned int base, uint16_t offset) -{ - switch (riscv_xlen(target)) { - case 32: - return lw(rd, base, offset); - case 64: - return ld(rd, base, offset); - } - assert(0); - return 0; /* Silence -Werror=return-type */ -} - -static uint32_t store(const struct target *target, unsigned int src, - unsigned int base, uint16_t offset) __attribute__ ((unused)); -static uint32_t store(const struct target *target, unsigned int src, - unsigned int base, uint16_t offset) -{ - switch (riscv_xlen(target)) { - case 32: - return sw(src, base, offset); - case 64: - return sd(src, base, offset); - } - assert(0); - return 0; /* Silence -Werror=return-type */ -} - -#endif /* OPENOCD_TARGET_RISCV_ASM_H */ diff --git a/src/target/riscv/program.c b/src/target/riscv/program.c index 6246d0038..47041a72c 100644 --- a/src/target/riscv/program.c +++ b/src/target/riscv/program.c @@ -10,7 +10,6 @@ #include "program.h" #include "helper/log.h" -#include "asm.h" #include "debug_defines.h" #include "encoding.h" diff --git a/src/target/riscv/riscv-011.c b/src/target/riscv/riscv-011.c index 1a3f4b12e..0ffd3f299 100644 --- a/src/target/riscv/riscv-011.c +++ b/src/target/riscv/riscv-011.c @@ -251,6 +251,32 @@ static unsigned int slot_offset(const struct target *target, slot_t slot) return 0; /* Silence -Werror=return-type */ } +static uint32_t load(const struct target *target, unsigned int rd, + unsigned int base, uint16_t offset) +{ + switch (riscv_xlen(target)) { + case 32: + return lw(rd, base, offset); + case 64: + return ld(rd, base, offset); + } + assert(0); + return 0; /* Silence -Werror=return-type */ +} + +static uint32_t store(const struct target *target, unsigned int src, + unsigned int base, uint16_t offset) +{ + switch (riscv_xlen(target)) { + case 32: + return sw(src, base, offset); + case 64: + return sd(src, base, offset); + } + assert(0); + return 0; /* Silence -Werror=return-type */ +} + static uint32_t load_slot(const struct target *target, unsigned int dest, slot_t slot) { diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index c399de7e4..5341f63c8 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -31,7 +31,6 @@ #include "debug_defines.h" #include "rtos/rtos.h" #include "program.h" -#include "asm.h" #include "batch.h" #include "debug_reg_printer.h" #include "field_helpers.h"