From 157efaa8a95daedbab47aefd7c5c841280bca531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Fri, 2 Mar 2018 10:14:27 -0500 Subject: [PATCH] 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 --- qemu/cputlb.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/qemu/cputlb.c b/qemu/cputlb.c index 6269c631..f259615c 100644 --- a/qemu/cputlb.c +++ b/qemu/cputlb.c @@ -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)) {