support memory redirection, so the issue #217 is fixed
This commit is contained in:
@ -17,6 +17,21 @@
|
||||
#define READ_BYTE_L(x) (x & 0xff)
|
||||
|
||||
|
||||
static uint64_t mips_mem_redirect(uint64_t address)
|
||||
{
|
||||
// kseg0 range masks off high address bit
|
||||
if (address >= 0x80000000 && address <= 0x9fffffff)
|
||||
return address & 0x7fffffff;
|
||||
|
||||
// kseg1 range masks off top 3 address bits
|
||||
if (address >= 0xa0000000 && address <= 0xbfffffff) {
|
||||
return address & 0x1fffffff;
|
||||
}
|
||||
|
||||
// no redirect
|
||||
return address;
|
||||
}
|
||||
|
||||
static void mips_set_pc(struct uc_struct *uc, uint64_t address)
|
||||
{
|
||||
((CPUMIPSState *)uc->current_cpu->env_ptr)->active_tc.PC = address;
|
||||
@ -96,5 +111,6 @@ __attribute__ ((visibility ("default")))
|
||||
uc->reg_write = mips_reg_write;
|
||||
uc->reg_reset = mips_reg_reset;
|
||||
uc->set_pc = mips_set_pc;
|
||||
uc->mem_redirect = mips_mem_redirect;
|
||||
uc_common_init(uc);
|
||||
}
|
||||
|
Reference in New Issue
Block a user