mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-04-01 23:07:03 +00:00
softmmu: Add probe_write()
Probe for whether the specified guest write access is permitted. If it is not permitted then an exception will be taken in the same way as if this were a real write access (and we will not return). Otherwise the function will return, and there will be a valid entry in the TLB for this access. Backports commit 3b4afc9e75ab1a95f33e41f462921093f8a109c4 from qemu
This commit is contained in:
parent
1c9c8d3f10
commit
79e4c001a9
|
@ -2296,6 +2296,7 @@
|
|||
#define print_type_number print_type_number_aarch64
|
||||
#define print_type_size print_type_size_aarch64
|
||||
#define print_type_str print_type_str_aarch64
|
||||
#define probe_write probe_write_aarch64
|
||||
#define propagateFloat128NaN propagateFloat128NaN_aarch64
|
||||
#define propagateFloat32MulAddNaN propagateFloat32MulAddNaN_aarch64
|
||||
#define propagateFloat32NaN propagateFloat32NaN_aarch64
|
||||
|
|
|
@ -2296,6 +2296,7 @@
|
|||
#define print_type_number print_type_number_aarch64eb
|
||||
#define print_type_size print_type_size_aarch64eb
|
||||
#define print_type_str print_type_str_aarch64eb
|
||||
#define probe_write probe_write_aarch64eb
|
||||
#define propagateFloat128NaN propagateFloat128NaN_aarch64eb
|
||||
#define propagateFloat32MulAddNaN propagateFloat32MulAddNaN_aarch64eb
|
||||
#define propagateFloat32NaN propagateFloat32NaN_aarch64eb
|
||||
|
|
|
@ -2296,6 +2296,7 @@
|
|||
#define print_type_number print_type_number_arm
|
||||
#define print_type_size print_type_size_arm
|
||||
#define print_type_str print_type_str_arm
|
||||
#define probe_write probe_write_arm
|
||||
#define propagateFloat128NaN propagateFloat128NaN_arm
|
||||
#define propagateFloat32MulAddNaN propagateFloat32MulAddNaN_arm
|
||||
#define propagateFloat32NaN propagateFloat32NaN_arm
|
||||
|
|
|
@ -2296,6 +2296,7 @@
|
|||
#define print_type_number print_type_number_armeb
|
||||
#define print_type_size print_type_size_armeb
|
||||
#define print_type_str print_type_str_armeb
|
||||
#define probe_write probe_write_armeb
|
||||
#define propagateFloat128NaN propagateFloat128NaN_armeb
|
||||
#define propagateFloat32MulAddNaN propagateFloat32MulAddNaN_armeb
|
||||
#define propagateFloat32NaN propagateFloat32NaN_armeb
|
||||
|
|
|
@ -2302,6 +2302,7 @@ symbols = (
|
|||
'print_type_number',
|
||||
'print_type_size',
|
||||
'print_type_str',
|
||||
'probe_write',
|
||||
'propagateFloat128NaN',
|
||||
'propagateFloat32MulAddNaN',
|
||||
'propagateFloat32NaN',
|
||||
|
|
|
@ -172,6 +172,8 @@ void tlb_set_page(CPUState *cpu, target_ulong vaddr,
|
|||
int mmu_idx, target_ulong size);
|
||||
|
||||
void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr);
|
||||
void probe_write(CPUArchState *env, target_ulong addr, int mmu_idx,
|
||||
uintptr_t retaddr);
|
||||
|
||||
#else
|
||||
static inline void tlb_flush_page(CPUState *cpu, target_ulong addr)
|
||||
|
|
|
@ -2296,6 +2296,7 @@
|
|||
#define print_type_number print_type_number_m68k
|
||||
#define print_type_size print_type_size_m68k
|
||||
#define print_type_str print_type_str_m68k
|
||||
#define probe_write probe_write_m68k
|
||||
#define propagateFloat128NaN propagateFloat128NaN_m68k
|
||||
#define propagateFloat32MulAddNaN propagateFloat32MulAddNaN_m68k
|
||||
#define propagateFloat32NaN propagateFloat32NaN_m68k
|
||||
|
|
|
@ -2296,6 +2296,7 @@
|
|||
#define print_type_number print_type_number_mips
|
||||
#define print_type_size print_type_size_mips
|
||||
#define print_type_str print_type_str_mips
|
||||
#define probe_write probe_write_mips
|
||||
#define propagateFloat128NaN propagateFloat128NaN_mips
|
||||
#define propagateFloat32MulAddNaN propagateFloat32MulAddNaN_mips
|
||||
#define propagateFloat32NaN propagateFloat32NaN_mips
|
||||
|
|
|
@ -2296,6 +2296,7 @@
|
|||
#define print_type_number print_type_number_mips64
|
||||
#define print_type_size print_type_size_mips64
|
||||
#define print_type_str print_type_str_mips64
|
||||
#define probe_write probe_write_mips64
|
||||
#define propagateFloat128NaN propagateFloat128NaN_mips64
|
||||
#define propagateFloat32MulAddNaN propagateFloat32MulAddNaN_mips64
|
||||
#define propagateFloat32NaN propagateFloat32NaN_mips64
|
||||
|
|
|
@ -2296,6 +2296,7 @@
|
|||
#define print_type_number print_type_number_mips64el
|
||||
#define print_type_size print_type_size_mips64el
|
||||
#define print_type_str print_type_str_mips64el
|
||||
#define probe_write probe_write_mips64el
|
||||
#define propagateFloat128NaN propagateFloat128NaN_mips64el
|
||||
#define propagateFloat32MulAddNaN propagateFloat32MulAddNaN_mips64el
|
||||
#define propagateFloat32NaN propagateFloat32NaN_mips64el
|
||||
|
|
|
@ -2296,6 +2296,7 @@
|
|||
#define print_type_number print_type_number_mipsel
|
||||
#define print_type_size print_type_size_mipsel
|
||||
#define print_type_str print_type_str_mipsel
|
||||
#define probe_write probe_write_mipsel
|
||||
#define propagateFloat128NaN propagateFloat128NaN_mipsel
|
||||
#define propagateFloat32MulAddNaN propagateFloat32MulAddNaN_mipsel
|
||||
#define propagateFloat32NaN propagateFloat32NaN_mipsel
|
||||
|
|
|
@ -2296,6 +2296,7 @@
|
|||
#define print_type_number print_type_number_powerpc
|
||||
#define print_type_size print_type_size_powerpc
|
||||
#define print_type_str print_type_str_powerpc
|
||||
#define probe_write probe_write_powerpc
|
||||
#define propagateFloat128NaN propagateFloat128NaN_powerpc
|
||||
#define propagateFloat32MulAddNaN propagateFloat32MulAddNaN_powerpc
|
||||
#define propagateFloat32NaN propagateFloat32NaN_powerpc
|
||||
|
|
|
@ -833,6 +833,28 @@ void helper_be_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
|
|||
}
|
||||
#endif /* DATA_SIZE > 1 */
|
||||
|
||||
#if DATA_SIZE == 1
|
||||
/* Probe for whether the specified guest write access is permitted.
|
||||
* If it is not permitted then an exception will be taken in the same
|
||||
* way as if this were a real write access (and we will not return).
|
||||
* Otherwise the function will return, and there will be a valid
|
||||
* entry in the TLB for this access.
|
||||
*/
|
||||
void probe_write(CPUArchState *env, target_ulong addr, int mmu_idx,
|
||||
uintptr_t retaddr)
|
||||
{
|
||||
int index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
|
||||
target_ulong tlb_addr = env->tlb_table[mmu_idx][index].addr_write;
|
||||
|
||||
if ((addr & TARGET_PAGE_MASK)
|
||||
!= (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
|
||||
/* TLB entry is for a different page */
|
||||
if (!VICTIM_TLB_HIT(addr_write, addr)) {
|
||||
tlb_fill(ENV_GET_CPU(env), addr, MMU_DATA_STORE, mmu_idx, retaddr);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* !defined(SOFTMMU_CODE_ACCESS) */
|
||||
|
||||
#undef READ_ACCESS_TYPE
|
||||
|
|
|
@ -2296,6 +2296,7 @@
|
|||
#define print_type_number print_type_number_sparc
|
||||
#define print_type_size print_type_size_sparc
|
||||
#define print_type_str print_type_str_sparc
|
||||
#define probe_write probe_write_sparc
|
||||
#define propagateFloat128NaN propagateFloat128NaN_sparc
|
||||
#define propagateFloat32MulAddNaN propagateFloat32MulAddNaN_sparc
|
||||
#define propagateFloat32NaN propagateFloat32NaN_sparc
|
||||
|
|
|
@ -2296,6 +2296,7 @@
|
|||
#define print_type_number print_type_number_sparc64
|
||||
#define print_type_size print_type_size_sparc64
|
||||
#define print_type_str print_type_str_sparc64
|
||||
#define probe_write probe_write_sparc64
|
||||
#define propagateFloat128NaN propagateFloat128NaN_sparc64
|
||||
#define propagateFloat32MulAddNaN propagateFloat32MulAddNaN_sparc64
|
||||
#define propagateFloat32NaN propagateFloat32NaN_sparc64
|
||||
|
|
|
@ -4118,11 +4118,10 @@ static inline void ensure_writable_pages(CPUMIPSState *env,
|
|||
target_ulong page_addr;
|
||||
if (unlikely(MSA_PAGESPAN(addr))) {
|
||||
/* first page */
|
||||
// UNICORN: Commented out
|
||||
//probe_write(env, addr, mmu_idx, retaddr);
|
||||
probe_write(env, addr, mmu_idx, retaddr);
|
||||
/* second page */
|
||||
page_addr = (addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;
|
||||
//probe_write(env, page_addr, mmu_idx, retaddr);
|
||||
probe_write(env, page_addr, mmu_idx, retaddr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -2296,6 +2296,7 @@
|
|||
#define print_type_number print_type_number_x86_64
|
||||
#define print_type_size print_type_size_x86_64
|
||||
#define print_type_str print_type_str_x86_64
|
||||
#define probe_write probe_write_x86_64
|
||||
#define propagateFloat128NaN propagateFloat128NaN_x86_64
|
||||
#define propagateFloat32MulAddNaN propagateFloat32MulAddNaN_x86_64
|
||||
#define propagateFloat32NaN propagateFloat32NaN_x86_64
|
||||
|
|
Loading…
Reference in a new issue