mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-23 03:45:14 +00:00
target/riscv: Add Hypervisor machine CSRs accesses
Backports commit 34cfb5f61842d495c6f6fc3eeb4197b5b44fd570 from qemu
This commit is contained in:
parent
dd356201a6
commit
042e3df075
|
@ -987,6 +987,30 @@ static int write_vsatp(CPURISCVState *env, int csrno, target_ulong val)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int read_mtval2(CPURISCVState *env, int csrno, target_ulong *val)
|
||||
{
|
||||
*val = env->mtval2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int write_mtval2(CPURISCVState *env, int csrno, target_ulong val)
|
||||
{
|
||||
env->mtval2 = val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int read_mtinst(CPURISCVState *env, int csrno, target_ulong *val)
|
||||
{
|
||||
*val = env->mtinst;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int write_mtinst(CPURISCVState *env, int csrno, target_ulong val)
|
||||
{
|
||||
env->mtinst = val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Physical Memory Protection */
|
||||
static int read_pmpcfg(CPURISCVState *env, int csrno, target_ulong *val)
|
||||
{
|
||||
|
@ -1208,6 +1232,9 @@ static riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = {
|
|||
[CSR_VSTVAL] = { hmode, read_vstval, write_vstval },
|
||||
[CSR_VSATP] = { hmode, read_vsatp, write_vsatp },
|
||||
|
||||
[CSR_MTVAL2] = { hmode, read_mtval2, write_mtval2 },
|
||||
[CSR_MTINST] = { hmode, read_mtinst, write_mtinst },
|
||||
|
||||
/* Physical Memory Protection */
|
||||
[CSR_PMPCFG0 ... CSR_PMPADDR9] = { pmp, read_pmpcfg, write_pmpcfg },
|
||||
[CSR_PMPADDR0 ... CSR_PMPADDR15] = { pmp, read_pmpaddr, write_pmpaddr },
|
||||
|
|
Loading…
Reference in a new issue