mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-23 06:25:12 +00:00
cputlb: tweak qemu_ram_addr_from_host_nofail reporting
This moves the helper function closer to where it is called and updates the error message to report via error_report instead of the deprecated fprintf. Backports commit 857baec1d9e80947f0c1007c3a3d2331d62b4b53 from qemu
This commit is contained in:
parent
454932263c
commit
157efaa8a9
|
@ -272,6 +272,19 @@ void tlb_set_page(CPUState *cpu, target_ulong vaddr,
|
|||
prot, mmu_idx, size);
|
||||
}
|
||||
|
||||
static ram_addr_t qemu_ram_addr_from_host_nofail(struct uc_struct *uc, void *ptr)
|
||||
{
|
||||
ram_addr_t ram_addr;
|
||||
|
||||
ram_addr = qemu_ram_addr_from_host(uc, ptr);
|
||||
if (ram_addr == RAM_ADDR_INVALID) {
|
||||
//error_report("Bad ram pointer %p", ptr);
|
||||
return RAM_ADDR_INVALID;
|
||||
}
|
||||
|
||||
return ram_addr;
|
||||
}
|
||||
|
||||
/* NOTE: this function can trigger an exception */
|
||||
/* NOTE2: the returned address is not exactly the physical address: it
|
||||
* is actually a ram_addr_t (in system mode; the user mode emulation
|
||||
|
@ -323,19 +336,6 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr)
|
|||
}
|
||||
}
|
||||
|
||||
static ram_addr_t qemu_ram_addr_from_host_nofail(struct uc_struct *uc, void *ptr)
|
||||
{
|
||||
ram_addr_t ram_addr;
|
||||
|
||||
ram_addr = qemu_ram_addr_from_host(uc, ptr);
|
||||
if (ram_addr == RAM_ADDR_INVALID) {
|
||||
// fprintf(stderr, "Bad ram pointer %p\n", ptr);
|
||||
return RAM_ADDR_INVALID;
|
||||
}
|
||||
|
||||
return ram_addr;
|
||||
}
|
||||
|
||||
static void tlb_set_dirty1(CPUTLBEntry *tlb_entry, target_ulong vaddr)
|
||||
{
|
||||
if (tlb_entry->addr_write == (vaddr | TLB_NOTDIRTY)) {
|
||||
|
|
Loading…
Reference in a new issue