Zero extram on startup.

On crash, dump extram to file
This commit is contained in:
Toby Jaffey 2025-12-11 17:48:00 +00:00
parent 0ded19d04a
commit 7fae8c129f

View file

@ -203,6 +203,7 @@ int main(int argc, char *argv[]) {
printf("Failed to allocate extram!\n"); printf("Failed to allocate extram!\n");
return 1; return 1;
} }
memset(extram_buf, 0x00, extram_len);
uvm32_extram(&vmst, extram_buf, extram_len); uvm32_extram(&vmst, extram_buf, extram_len);
} }
@ -227,6 +228,10 @@ int main(int argc, char *argv[]) {
isrunning = false; isrunning = false;
memdump("host-ram.dump", vmst.memory, UVM32_MEMORY_SIZE); memdump("host-ram.dump", vmst.memory, UVM32_MEMORY_SIZE);
printf("memory dumped to host-ram.dump, pc=0x%08x\n", vmst.core.pc); printf("memory dumped to host-ram.dump, pc=0x%08x\n", vmst.core.pc);
if (extram_buf != NULL) {
memdump("host-extram.dump", (uint8_t *)extram_buf, extram_len);
printf("extram dumped to host-extram.dump\n");
}
} }
break; break;
case UVM32_EVT_SYSCALL: case UVM32_EVT_SYSCALL: