mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-09 00:07:57 -06:00
linux-user: log page table changes under -d page
The CPU_LOG_PAGE flag is woefully underused and could stand to do extra duty tracking page changes. If the user doesn't want to see the details as things change they still have the tracepoints available. We push the locking into log_page_dump and pass a reason for the banner text. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20191205122518.10010-5-alex.bennee@linaro.org>
This commit is contained in:
parent
d0e165ae2b
commit
10d0d505de
4 changed files with 11 additions and 12 deletions
|
@ -963,7 +963,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
if (qemu_loglevel_mask(CPU_LOG_PAGE)) {
|
if (qemu_loglevel_mask(CPU_LOG_PAGE)) {
|
||||||
qemu_log("guest_base 0x%lx\n", guest_base);
|
qemu_log("guest_base 0x%lx\n", guest_base);
|
||||||
log_page_dump();
|
log_page_dump("binary load");
|
||||||
|
|
||||||
qemu_log("start_brk 0x" TARGET_ABI_FMT_lx "\n", info->start_brk);
|
qemu_log("start_brk 0x" TARGET_ABI_FMT_lx "\n", info->start_brk);
|
||||||
qemu_log("end_code 0x" TARGET_ABI_FMT_lx "\n", info->end_code);
|
qemu_log("end_code 0x" TARGET_ABI_FMT_lx "\n", info->end_code);
|
||||||
|
|
|
@ -69,15 +69,14 @@ static inline void log_disas(void *code, unsigned long size)
|
||||||
|
|
||||||
#if defined(CONFIG_USER_ONLY)
|
#if defined(CONFIG_USER_ONLY)
|
||||||
/* page_dump() output to the log file: */
|
/* page_dump() output to the log file: */
|
||||||
static inline void log_page_dump(void)
|
static inline void log_page_dump(const char *operation)
|
||||||
{
|
{
|
||||||
QemuLogFile *logfile;
|
FILE *logfile = qemu_log_lock();
|
||||||
rcu_read_lock();
|
|
||||||
logfile = atomic_rcu_read(&qemu_logfile);
|
|
||||||
if (logfile) {
|
if (logfile) {
|
||||||
page_dump(logfile->fd);
|
qemu_log("page layout changed following %s\n", operation);
|
||||||
|
page_dump(logfile);
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
qemu_log_unlock(logfile);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -826,7 +826,7 @@ int main(int argc, char **argv, char **envp)
|
||||||
|
|
||||||
if (qemu_loglevel_mask(CPU_LOG_PAGE)) {
|
if (qemu_loglevel_mask(CPU_LOG_PAGE)) {
|
||||||
qemu_log("guest_base 0x%lx\n", guest_base);
|
qemu_log("guest_base 0x%lx\n", guest_base);
|
||||||
log_page_dump();
|
log_page_dump("binary load");
|
||||||
|
|
||||||
qemu_log("start_brk 0x" TARGET_ABI_FMT_lx "\n", info->start_brk);
|
qemu_log("start_brk 0x" TARGET_ABI_FMT_lx "\n", info->start_brk);
|
||||||
qemu_log("end_code 0x" TARGET_ABI_FMT_lx "\n", info->end_code);
|
qemu_log("end_code 0x" TARGET_ABI_FMT_lx "\n", info->end_code);
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
#include "exec/log.h"
|
||||||
#include "qemu.h"
|
#include "qemu.h"
|
||||||
|
|
||||||
//#define DEBUG_MMAP
|
//#define DEBUG_MMAP
|
||||||
|
@ -539,10 +540,9 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
|
||||||
page_set_flags(start, start + len, prot | PAGE_VALID);
|
page_set_flags(start, start + len, prot | PAGE_VALID);
|
||||||
the_end:
|
the_end:
|
||||||
trace_target_mmap_complete(start);
|
trace_target_mmap_complete(start);
|
||||||
#ifdef DEBUG_MMAP
|
if (qemu_loglevel_mask(CPU_LOG_PAGE)) {
|
||||||
page_dump(stdout);
|
log_page_dump(__func__);
|
||||||
printf("\n");
|
}
|
||||||
#endif
|
|
||||||
tb_invalidate_phys_range(start, start + len);
|
tb_invalidate_phys_range(start, start + len);
|
||||||
mmap_unlock();
|
mmap_unlock();
|
||||||
return start;
|
return start;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue