mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-24 15:48:16 +00:00
clean up mem_protect related constants
This commit is contained in:
parent
b27e987932
commit
658e399776
3 changed files with 17 additions and 14 deletions
|
@ -116,8 +116,9 @@ typedef enum uc_err {
|
|||
UC_ERR_HOOK, // Invalid hook type: uc_hook_add()
|
||||
UC_ERR_INSN_INVALID, // Quit emulation due to invalid instruction: uc_emu_start()
|
||||
UC_ERR_MAP, // Invalid memory mapping: uc_mem_map()
|
||||
UC_ERR_MEM_WRITE_NW, // Quit emulation due to write to non-writable: uc_emu_start()
|
||||
UC_ERR_MEM_READ_NR, // Quit emulation due to read from non-readable: uc_emu_start()
|
||||
UC_ERR_PROT_WRITE, // Quit emulation due to UC_PROT_WRITE violation: uc_emu_start()
|
||||
UC_ERR_PROT_READ, // Quit emulation due to UC_PROT_READ violation: uc_emu_start()
|
||||
UC_ERR_PROT_EXEC, // Quit emulation due to UC_PROT_EXEC violation: uc_emu_start()
|
||||
} uc_err;
|
||||
|
||||
|
||||
|
|
|
@ -191,8 +191,8 @@ WORD_TYPE helper_le_ld_name(CPUArchState *env, target_ulong addr, int mmu_idx,
|
|||
}
|
||||
else {
|
||||
env->invalid_addr = addr;
|
||||
env->invalid_error = UC_ERR_MEM_READ;
|
||||
// printf("***** Invalid memory read (non-readable) at " TARGET_FMT_lx "\n", addr);
|
||||
env->invalid_error = UC_ERR_PROT_EXEC;
|
||||
// printf("***** Invalid fetch (non-executable) at " TARGET_FMT_lx "\n", addr);
|
||||
cpu_exit(uc->current_cpu);
|
||||
return 0;
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ WORD_TYPE helper_le_ld_name(CPUArchState *env, target_ulong addr, int mmu_idx,
|
|||
}
|
||||
else {
|
||||
env->invalid_addr = addr;
|
||||
env->invalid_error = UC_ERR_MEM_READ_NR;
|
||||
env->invalid_error = UC_ERR_PROT_READ;
|
||||
// printf("***** Invalid memory read (non-readable) at " TARGET_FMT_lx "\n", addr);
|
||||
cpu_exit(uc->current_cpu);
|
||||
return 0;
|
||||
|
@ -350,8 +350,8 @@ WORD_TYPE helper_be_ld_name(CPUArchState *env, target_ulong addr, int mmu_idx,
|
|||
}
|
||||
else {
|
||||
env->invalid_addr = addr;
|
||||
env->invalid_error = UC_ERR_MEM_READ;
|
||||
// printf("***** Invalid memory read (non-readable) at " TARGET_FMT_lx "\n", addr);
|
||||
env->invalid_error = UC_ERR_PROT_EXEC;
|
||||
// printf("***** Invalid fetch (non-executable) at " TARGET_FMT_lx "\n", addr);
|
||||
cpu_exit(uc->current_cpu);
|
||||
return 0;
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ WORD_TYPE helper_be_ld_name(CPUArchState *env, target_ulong addr, int mmu_idx,
|
|||
}
|
||||
else {
|
||||
env->invalid_addr = addr;
|
||||
env->invalid_error = UC_ERR_MEM_READ_NR;
|
||||
env->invalid_error = UC_ERR_PROT_READ;
|
||||
// printf("***** Invalid memory read (non-readable) at " TARGET_FMT_lx "\n", addr);
|
||||
cpu_exit(uc->current_cpu);
|
||||
return 0;
|
||||
|
@ -571,7 +571,7 @@ void helper_le_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
|
|||
}
|
||||
else {
|
||||
env->invalid_addr = addr;
|
||||
env->invalid_error = UC_ERR_MEM_WRITE_NW;
|
||||
env->invalid_error = UC_ERR_PROT_WRITE;
|
||||
// printf("***** Invalid memory write (ro) at " TARGET_FMT_lx "\n", addr);
|
||||
cpu_exit(uc->current_cpu);
|
||||
return;
|
||||
|
@ -705,7 +705,7 @@ void helper_be_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
|
|||
}
|
||||
else {
|
||||
env->invalid_addr = addr;
|
||||
env->invalid_error = UC_ERR_MEM_WRITE_NW;
|
||||
env->invalid_error = UC_ERR_PROT_WRITE;
|
||||
// printf("***** Invalid memory write (ro) at " TARGET_FMT_lx "\n", addr);
|
||||
cpu_exit(uc->current_cpu);
|
||||
return;
|
||||
|
|
10
uc.c
10
uc.c
|
@ -92,10 +92,12 @@ const char *uc_strerror(uc_err code)
|
|||
return "Invalid hook type (UC_ERR_HOOK)";
|
||||
case UC_ERR_MAP:
|
||||
return "Invalid memory mapping (UC_ERR_MAP)";
|
||||
case UC_ERR_MEM_WRITE_NW:
|
||||
return "Write to non-writable (UC_ERR_MEM_WRITE_NW)";
|
||||
case UC_ERR_MEM_READ_NR:
|
||||
return "Read from non-readable (UC_ERR_MEM_READ_NR)";
|
||||
case UC_ERR_PROT_WRITE:
|
||||
return "Write to non-writable memory (UC_ERR_PROT_WRITE)";
|
||||
case UC_ERR_PROT_READ:
|
||||
return "Read from non-readable memory (UC_ERR_PROT_READ)";
|
||||
case UC_ERR_PROT_EXEC:
|
||||
return "Fetch from non-executable memory (UC_ERR_PROT_EXEC)";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue