vm: Log all guest memory bases at startup

This commit is contained in:
Eladash 2020-03-14 16:29:31 +02:00
parent 83a2204f87
commit cb4192bce9
2 changed files with 12 additions and 6 deletions

View File

@ -1571,9 +1571,6 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp) noexcept
fmt::append(msg, "Thread id = %s.\n", std::this_thread::get_id());
sys_log.notice("Memory bases:\nvm::g_base_addr = %p\nvm::g_sudo_addr = %p\nvm::g_exec_addr = %p\nvm::g_stat_addr = %p\nvm::g_reservations = %p\n",
vm::g_base_addr, vm::g_sudo_addr, vm::g_exec_addr, vm::g_stat_addr, vm::g_reservations);
std::vector<HMODULE> modules;
for (DWORD size = 256; modules.size() != size; size /= sizeof(HMODULE))
{
@ -1698,9 +1695,6 @@ static void signal_handler(int sig, siginfo_t* info, void* uct) noexcept
sys_log.notice("\n%s", cpu->dump());
}
sys_log.notice("Memory bases:\nvm::g_base_addr = %p\nvm::g_sudo_addr = %p\nvm::g_exec_addr = %p\nvm::g_stat_addr = %p\nvm::g_reservations = %p\n",
vm::g_base_addr, vm::g_sudo_addr, vm::g_exec_addr, vm::g_stat_addr, vm::g_reservations);
std::string msg = fmt::format("Segfault %s location %p at %p.\n", cause, info->si_addr, RIP(context));
if (thread_ctrl::get_current())

View File

@ -1125,6 +1125,18 @@ namespace vm
{
void init()
{
vm_log.notice("Guest memory bases address ranges:\n"
"vm::g_base_addr = %p - %p\n"
"vm::g_sudo_addr = %p - %p\n"
"vm::g_exec_addr = %p - %p\n"
"vm::g_stat_addr = %p - %p\n"
"vm::g_reservations = %p - %p\n",
g_base_addr, g_base_addr + UINT32_MAX,
g_sudo_addr, g_sudo_addr + UINT32_MAX,
g_exec_addr, g_exec_addr + 0x200000000 - 1,
g_stat_addr, g_stat_addr + UINT32_MAX,
g_reservations, g_reservations + UINT32_MAX);
g_locations =
{
std::make_shared<block_t>(0x00010000, 0x1FFF0000, 0x200), // main