about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-08-13 20:43:38 -0700
committerKartik Agaram <vc@akkartik.com>2018-08-13 20:43:38 -0700
commitfd7198b290e9d8c619a2e69a9bb0404855d1dc13 (patch)
treea72fe1c0ee1181e7b155738a688cfb347f520b7c /subx
parent5e8ef005d8387b3b7977cf55e6032bd7b9052470 (diff)
downloadmu-fd7198b290e9d8c619a2e69a9bb0404855d1dc13.tar.gz
4519
Diffstat (limited to 'subx')
-rw-r--r--subx/012elf.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/subx/012elf.cc b/subx/012elf.cc
index efaa9e2e..58d2cde8 100644
--- a/subx/012elf.cc
+++ b/subx/012elf.cc
@@ -13,7 +13,7 @@ if (is_equal(argv[1], "run")) {
   load_elf(argv[2]);
   while (EIP < End_of_program)  // weak final-gasp termination check
     run_one_instruction();
-  dbg << "executed past end of the world: " << EIP << " vs " << End_of_program << end();
+  trace(90, "load") << "executed past end of the world: " << EIP << " vs " << End_of_program << end();
   return 0;
 }
 
@@ -53,7 +53,7 @@ void load_elf_contents(uint8_t* elf_contents, size_t size) {
   if (e_ehsize < 52) raise << "Invalid binary; ELF header too small\n" << die();
   uint32_t e_phentsize = u16_in(&elf_contents[42]);
   uint32_t e_phnum = u16_in(&elf_contents[44]);
-  dbg << e_phnum << " entries in the program header, each " << e_phentsize << " bytes long" << end();
+  trace(90, "load") << e_phnum << " entries in the program header, each " << e_phentsize << " bytes long" << end();
   // unused: e_shentsize
   // unused: e_shnum
   // unused: e_shstrndx
@@ -69,9 +69,9 @@ void load_elf_contents(uint8_t* elf_contents, size_t size) {
 
 void load_segment_from_program_header(uint8_t* elf_contents, size_t size, uint32_t offset, uint32_t e_ehsize) {
   uint32_t p_type = u32_in(&elf_contents[offset]);
-  dbg << "program header at offset " << offset << ": type " << p_type << end();
+  trace(90, "load") << "program header at offset " << offset << ": type " << p_type << end();
   if (p_type != 1) {
-    dbg << "ignoring segment at offset " << offset << " of non PT_LOAD type " << p_type << " (see http://refspecs.linuxbase.org/elf/elf.pdf)" << end();
+    trace(90, "load") << "ignoring segment at offset " << offset << " of non PT_LOAD type " << p_type << " (see http://refspecs.linuxbase.org/elf/elf.pdf)" << end();
     return;
   }
   uint32_t p_offset = u32_in(&elf_contents[offset + 4]);
@@ -88,7 +88,7 @@ void load_segment_from_program_header(uint8_t* elf_contents, size_t size, uint32
   if (Mem.size() < p_vaddr + p_memsz)
     Mem.resize(p_vaddr + p_memsz);
   if (size > p_memsz) size = p_memsz;
-  dbg << "blitting file offsets (" << p_offset << ", " << (p_offset+p_filesz) << ") to addresses (" << p_vaddr << ", " << (p_vaddr+p_memsz) << ')' << end();
+  trace(90, "load") << "blitting file offsets (" << p_offset << ", " << (p_offset+p_filesz) << ") to addresses (" << p_vaddr << ", " << (p_vaddr+p_memsz) << ')' << end();
   for (size_t i = 0;  i < p_filesz;  ++i)
     write_mem_u8(p_vaddr+i, elf_contents[p_offset+i]);
   if (End_of_program < p_vaddr+p_memsz)