about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-10-24 23:17:43 -0700
committerKartik Agaram <vc@akkartik.com>2018-10-24 23:17:43 -0700
commite0a0484c9faf561ab53f915ad9573c0803966faf (patch)
treeca8e96c69de592e9b88171c2e921ad3c9a70b362
parent6f37250dd9d81c812fb5eddd747d237d94fff9b2 (diff)
downloadmu-e0a0484c9faf561ab53f915ad9573c0803966faf.tar.gz
4723
Fix CI.
-rw-r--r--subx/010---vm.cc11
-rw-r--r--subx/012elf.cc9
2 files changed, 10 insertions, 10 deletions
diff --git a/subx/010---vm.cc b/subx/010---vm.cc
index ef23804f..8a19d818 100644
--- a/subx/010---vm.cc
+++ b/subx/010---vm.cc
@@ -293,7 +293,7 @@ void run_one_instruction() {
     cerr << "opcode: " << HEXBYTE << NUM(op) << '\n';
     cerr << "registers at start: ";
     dump_registers();
-//?     dump_stack();
+//?     dump_stack();  // for debugging; not defined until later layer
   }
   switch (op) {
   case 0xf4:  // hlt
@@ -364,15 +364,6 @@ void dump_registers() {
   cerr << " -- SF: " << SF << "; ZF: " << ZF << "; OF: " << OF << '\n';
 }
 
-void dump_stack() {
-  cerr << "stack:\n";
-  for (uint32_t a = AFTER_STACK-4;  a > Reg[ESP].u;  a -= 4)
-    cerr << "  0x" << HEXWORD << a << " => 0x" << HEXWORD << read_mem_u32(a) << '\n';
-  cerr << "  0x" << HEXWORD << Reg[ESP].u << " => 0x" << HEXWORD << read_mem_u32(Reg[ESP].u) << "  <=== ESP\n";
-  for (uint32_t a = Reg[ESP].u-4;  a > Reg[ESP].u-40;  a -= 4)
-    cerr << "  0x" << HEXWORD << a << " => 0x" << HEXWORD << read_mem_u32(a) << '\n';
-}
-
 //: start tracking supported opcodes
 :(before "End Globals")
 map</*op*/string, string> Name;
diff --git a/subx/012elf.cc b/subx/012elf.cc
index 28064a1e..3f8187ba 100644
--- a/subx/012elf.cc
+++ b/subx/012elf.cc
@@ -138,6 +138,15 @@ const int STACK_SEGMENT = 0x0b000000;
 const int AFTER_STACK = 0x0b000ffc;  // forget final word because of the off-by-one with INITIAL_SEGMENT_SIZE;
 const int ARGV_DATA_SEGMENT = 0x0c000000;
 :(code)
+void dump_stack() {
+  cerr << "stack:\n";
+  for (uint32_t a = AFTER_STACK-4;  a > Reg[ESP].u;  a -= 4)
+    cerr << "  0x" << HEXWORD << a << " => 0x" << HEXWORD << read_mem_u32(a) << '\n';
+  cerr << "  0x" << HEXWORD << Reg[ESP].u << " => 0x" << HEXWORD << read_mem_u32(Reg[ESP].u) << "  <=== ESP\n";
+  for (uint32_t a = Reg[ESP].u-4;  a > Reg[ESP].u-40;  a -= 4)
+    cerr << "  0x" << HEXWORD << a << " => 0x" << HEXWORD << read_mem_u32(a) << '\n';
+}
+
 inline uint32_t u32_in(uint8_t* p) {
   return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
 }