Update encoding.h from riscv-opcodes (#514)
Rename dscratch to dscratch0, since that is what it's called in the spec. Change-Id: Id6271ae272e979cef69e8ef0577b23452fb84f51
This commit is contained in:
parent
ca6b1eff1d
commit
ad5f40af8d
File diff suppressed because it is too large
Load Diff
|
@ -88,7 +88,7 @@ enum gdb_regno {
|
|||
GDB_REGNO_MISA = CSR_MISA + GDB_REGNO_CSR0,
|
||||
GDB_REGNO_DPC = CSR_DPC + GDB_REGNO_CSR0,
|
||||
GDB_REGNO_DCSR = CSR_DCSR + GDB_REGNO_CSR0,
|
||||
GDB_REGNO_DSCRATCH = CSR_DSCRATCH + GDB_REGNO_CSR0,
|
||||
GDB_REGNO_DSCRATCH0 = CSR_DSCRATCH0 + GDB_REGNO_CSR0,
|
||||
GDB_REGNO_MSTATUS = CSR_MSTATUS + GDB_REGNO_CSR0,
|
||||
GDB_REGNO_MEPC = CSR_MEPC + GDB_REGNO_CSR0,
|
||||
GDB_REGNO_MCAUSE = CSR_MCAUSE + GDB_REGNO_CSR0,
|
||||
|
|
|
@ -1257,7 +1257,7 @@ static int register_write(struct target *target, unsigned int number,
|
|||
|
||||
if (number == S0) {
|
||||
cache_set_load(target, 0, S0, SLOT0);
|
||||
cache_set32(target, 1, csrw(S0, CSR_DSCRATCH));
|
||||
cache_set32(target, 1, csrw(S0, CSR_DSCRATCH0));
|
||||
cache_set_jump(target, 2);
|
||||
} else if (number == S1) {
|
||||
cache_set_load(target, 0, S0, SLOT0);
|
||||
|
@ -1610,7 +1610,7 @@ static riscv_error_t handle_halt_routine(struct target *target)
|
|||
scans_add_read(scans, SLOT0, false);
|
||||
|
||||
/* Read S0 from dscratch */
|
||||
unsigned int csr[] = {CSR_DSCRATCH, CSR_DPC, CSR_DCSR};
|
||||
unsigned int csr[] = {CSR_DSCRATCH0, CSR_DPC, CSR_DCSR};
|
||||
for (unsigned int i = 0; i < DIM(csr); i++) {
|
||||
scans_add_write32(scans, 0, csrr(S0, csr[i]), true);
|
||||
scans_add_read(scans, SLOT0, false);
|
||||
|
|
|
@ -4585,30 +4585,30 @@ int riscv013_test_compliance(struct target *target)
|
|||
uint32_t nscratch = get_field(hartinfo, DM_HARTINFO_NSCRATCH);
|
||||
for (unsigned int d = 0; d < nscratch; d++) {
|
||||
riscv_reg_t testval, testval_read;
|
||||
/* Because DSCRATCH is not guaranteed to last across PB executions, need to put
|
||||
/* Because DSCRATCH0 is not guaranteed to last across PB executions, need to put
|
||||
this all into one PB execution. Which may not be possible on all implementations.*/
|
||||
if (info->progbufsize >= 5) {
|
||||
for (testval = 0x0011223300112233;
|
||||
testval != 0xDEAD;
|
||||
testval = testval == 0x0011223300112233 ? ~testval : 0xDEAD) {
|
||||
COMPLIANCE_TEST(register_write_direct(target, GDB_REGNO_S0, testval) == ERROR_OK,
|
||||
"Need to be able to write S0 in order to test DSCRATCH.");
|
||||
"Need to be able to write S0 in order to test DSCRATCH0.");
|
||||
struct riscv_program program32;
|
||||
riscv_program_init(&program32, target);
|
||||
riscv_program_csrw(&program32, GDB_REGNO_S0, GDB_REGNO_DSCRATCH + d);
|
||||
riscv_program_csrr(&program32, GDB_REGNO_S1, GDB_REGNO_DSCRATCH + d);
|
||||
riscv_program_csrw(&program32, GDB_REGNO_S0, GDB_REGNO_DSCRATCH0 + d);
|
||||
riscv_program_csrr(&program32, GDB_REGNO_S1, GDB_REGNO_DSCRATCH0 + d);
|
||||
riscv_program_fence(&program32);
|
||||
riscv_program_ebreak(&program32);
|
||||
COMPLIANCE_TEST(riscv_program_exec(&program32, target) == ERROR_OK,
|
||||
"Accessing DSCRATCH with program buffer should succeed.");
|
||||
"Accessing DSCRATCH0 with program buffer should succeed.");
|
||||
COMPLIANCE_TEST(register_read_direct(target, &testval_read, GDB_REGNO_S1) == ERROR_OK,
|
||||
"Need to be able to read S1 in order to test DSCRATCH.");
|
||||
"Need to be able to read S1 in order to test DSCRATCH0.");
|
||||
if (riscv_xlen(target) > 32) {
|
||||
COMPLIANCE_TEST(testval == testval_read,
|
||||
"All DSCRATCH registers in HARTINFO must be R/W.");
|
||||
"All DSCRATCH0 registers in HARTINFO must be R/W.");
|
||||
} else {
|
||||
COMPLIANCE_TEST(testval_read == (testval & 0xFFFFFFFF),
|
||||
"All DSCRATCH registers in HARTINFO must be R/W.");
|
||||
"All DSCRATCH0 registers in HARTINFO must be R/W.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3184,7 +3184,7 @@ static bool gdb_regno_cacheable(enum gdb_regno regno, bool write)
|
|||
case GDB_REGNO_VTYPE:
|
||||
case GDB_REGNO_MISA:
|
||||
case GDB_REGNO_DCSR:
|
||||
case GDB_REGNO_DSCRATCH:
|
||||
case GDB_REGNO_DSCRATCH0:
|
||||
case GDB_REGNO_MSTATUS:
|
||||
case GDB_REGNO_MEPC:
|
||||
case GDB_REGNO_MCAUSE:
|
||||
|
@ -3517,8 +3517,8 @@ const char *gdb_regno_name(enum gdb_regno regno)
|
|||
return "dpc";
|
||||
case GDB_REGNO_DCSR:
|
||||
return "dcsr";
|
||||
case GDB_REGNO_DSCRATCH:
|
||||
return "dscratch";
|
||||
case GDB_REGNO_DSCRATCH0:
|
||||
return "dscratch0";
|
||||
case GDB_REGNO_MSTATUS:
|
||||
return "mstatus";
|
||||
case GDB_REGNO_MEPC:
|
||||
|
|
Loading…
Reference in New Issue