Skip to content

Commit

Permalink
[SIGNAL][RV64] Supported more opcodes for special cases (#2253)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksco authored Jan 11, 2025
1 parent 9b7e5d6 commit e533cd0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libtools/signals.c
Original file line number Diff line number Diff line change
Expand Up @@ -1000,13 +1000,13 @@ int sigbus_specialcases(siginfo_t* info, void * ucntx, void* pc, void* _fpsimd,

uint32_t funct3 = GET_FIELD(inst, 14, 12);
uint32_t opcode = GET_FIELD(inst, 6, 0);
if (opcode == 0b0100011 && (funct3 == 0b010 /* SW */ || funct3 == 0b011 /* SD */)) {
if ((opcode == 0b0100011 || opcode == 0b0100111 /* F */) && (funct3 == 0b010 /* (F)SW */ || funct3 == 0b011 /* (F)SD */)) {
int val = (inst >> 20) & 0x1f;
int dest = (inst >> 15) & 0x1f;
int64_t imm = (GET_FIELD(inst, 31, 25) << 5) | (GET_FIELD(inst, 11, 7));
imm = SIGN_EXT(imm, 12);
volatile uint8_t *addr = (void *)(p->uc_mcontext.__gregs[dest] + imm);
uint64_t value = p->uc_mcontext.__gregs[val];
uint64_t value = opcode == 0b0100011 ? p->uc_mcontext.__gregs[val] : p->uc_mcontext.__fpregs.__d.__f[val<<1];
for(int i = 0; i < (funct3 == 0b010 ? 4 : 8); ++i) {
addr[i] = (value >> (i * 8)) & 0xff;
}
Expand Down

0 comments on commit e533cd0

Please sign in to comment.