Skip to content

Commit

Permalink
Remove target/riscv/asm.h
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
JanMatCodasip committed Jan 20, 2025
1 parent 2210897 commit c1dfb0d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 44 deletions.
1 change: 0 additions & 1 deletion src/target/riscv/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

noinst_LTLIBRARIES += %D%/libriscv.la
%C%_libriscv_la_SOURCES = \
%D%/asm.h \
%D%/batch.h \
%D%/debug_defines.h \
%D%/debug_reg_printer.h \
Expand Down
40 changes: 0 additions & 40 deletions src/target/riscv/asm.h

This file was deleted.

1 change: 0 additions & 1 deletion src/target/riscv/program.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "program.h"
#include "helper/log.h"

#include "asm.h"
#include "debug_defines.h"
#include "encoding.h"

Expand Down
27 changes: 26 additions & 1 deletion src/target/riscv/riscv-011.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "riscv.h"
#include "riscv_reg.h"
#include "riscv-011_reg.h"
#include "asm.h"
#include "gdb_regs.h"
#include "field_helpers.h"

Expand Down Expand Up @@ -251,6 +250,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)
{
Expand Down
1 change: 0 additions & 1 deletion src/target/riscv/riscv-013.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit c1dfb0d

Please sign in to comment.