1
2
3
4
5
6
7
8
9
10
11
12
13
24
25
26
27
28
39
40
#ifndef TARGET__RISCV__ASM_H
#define TARGET__RISCV__ASM_H
#include "riscv.h"
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 32:
case 64:
return ld(rd, base, offset);case 64:
}switch (riscv_xlen(target)) { ... }
assert(0);
return 0;
}{ ... }
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 32:
case 64:
return sd(src, base, offset);case 64:
}switch (riscv_xlen(target)) { ... }
assert(0);
return 0;
}{ ... }
/* ... */#endif