tcg/wasm32: trace compiled-store TLB corruption under ramrace
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "sysemu/tcg.h"
|
||||
#include "qemu/accel.h"
|
||||
#include "hw/boards.h"
|
||||
#include "hw/core/cpu.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "exec/address-spaces.h"
|
||||
|
||||
@@ -1404,6 +1405,10 @@ static const MemoryRegionOps ram_device_mem_ops = {
|
||||
},
|
||||
};
|
||||
|
||||
#if defined(EMSCRIPTEN) && !defined(CONFIG_TCG_INTERPRETER)
|
||||
extern int wasm_ramrace_trace;
|
||||
#endif
|
||||
|
||||
bool memory_region_access_valid(MemoryRegion *mr,
|
||||
hwaddr addr,
|
||||
unsigned size,
|
||||
@@ -1416,6 +1421,16 @@ bool memory_region_access_valid(MemoryRegion *mr,
|
||||
", size %u, region '%s', reason: rejected\n",
|
||||
is_write ? "write" : "read",
|
||||
addr, size, memory_region_name(mr));
|
||||
#if defined(EMSCRIPTEN) && !defined(CONFIG_TCG_INTERPRETER)
|
||||
if (wasm_ramrace_trace) {
|
||||
printf("FAULTTRACE rejected %s addr=0x%llx size=%u mr=%p name=%s ops=%p opaque=%p ram=%d rom=%d readonly=%d current_cpu=%p\n",
|
||||
is_write ? "write" : "read", (unsigned long long)addr,
|
||||
size, mr, memory_region_name(mr) ?: "(null)", mr->ops,
|
||||
mr->opaque, memory_region_is_ram(mr), memory_region_is_rom(mr),
|
||||
mr->readonly, current_cpu);
|
||||
fflush(stdout);
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2979,6 +2979,15 @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
|
||||
|
||||
l = len;
|
||||
mr = flatview_translate(fv, addr, &mr_addr, &l, false, attrs);
|
||||
#if defined(EMSCRIPTEN) && !defined(CONFIG_TCG_INTERPRETER)
|
||||
if (wasm_ramrace_trace && current_cpu && mr->ops == &unassigned_mem_ops) {
|
||||
printf("FAULTTRACE flatview_read addr=0x%llx len=0x%llx mr_addr=0x%llx translated_len=0x%llx fv=%p root=%p root_name=%s nr=%u\n",
|
||||
(unsigned long long)addr, (unsigned long long)len,
|
||||
(unsigned long long)mr_addr, (unsigned long long)l,
|
||||
fv, fv->root, memory_region_name(fv->root) ?: "(null)", fv->nr);
|
||||
fflush(stdout);
|
||||
}
|
||||
#endif
|
||||
if (!flatview_access_allowed(mr, attrs, addr, len)) {
|
||||
return MEMTX_ACCESS_ERROR;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user