> compile NEMU
221220000 张三 Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux 14:14:35 up 4 days, 9:20, 1 user, load average: 0.59, 0.47, 0.46
This commit is contained in:
@ -90,6 +90,17 @@ menuconfig DTRACE
|
||||
|
||||
if DTRACE
|
||||
|
||||
config DTRACE_COND
|
||||
string "Only trace device when the condition is true (you can use 'offset' variable)"
|
||||
default "offset >= 0"
|
||||
|
||||
config DTRACE_WRITE
|
||||
bool "Enable device trace on write"
|
||||
default y
|
||||
|
||||
config DTRACE_READ
|
||||
bool "Enable device trace on read"
|
||||
default y
|
||||
|
||||
endif # DTRACE
|
||||
|
||||
|
@ -58,6 +58,10 @@ word_t map_read(paddr_t addr, int len, IOMap *map) {
|
||||
paddr_t offset = addr - map->low;
|
||||
invoke_callback(map->callback, offset, len, false); // prepare data to read
|
||||
word_t ret = host_read(map->space + offset, len);
|
||||
#ifdef CONFIG_DTRACE_READ
|
||||
if (CONFIG_DTRACE_COND) log_write("device_read " FMT_WORD " from offset " FMT_PADDR " (%s)\n",
|
||||
ret, offset, map->name);
|
||||
#endif
|
||||
//word_t ret = *(word_t*)(map->space + offset);
|
||||
//printf("map_read: %p, %d\n", map->space + offset, ret);
|
||||
return ret;
|
||||
@ -68,5 +72,9 @@ void map_write(paddr_t addr, int len, word_t data, IOMap *map) {
|
||||
check_bound(map, addr);
|
||||
paddr_t offset = addr - map->low;
|
||||
host_write(map->space + offset, len, data);
|
||||
#ifdef CONFIG_DTRACE_WRITE
|
||||
if (CONFIG_DTRACE_COND) log_write("device_write " FMT_WORD " from offset " FMT_PADDR " (%s)\n",
|
||||
data, offset, map->name);
|
||||
#endif
|
||||
invoke_callback(map->callback, offset, len, true);
|
||||
}
|
||||
|
Reference in New Issue
Block a user