about summary refs log tree commit diff stats
path: root/subx/056trace.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-06-08 12:38:53 -0700
committerKartik Agaram <vc@akkartik.com>2019-06-08 12:38:53 -0700
commit35272969cfe6fc81d706746362a7af2a0743275e (patch)
tree72c14ea3efe4c42837d50e03e7b2e7575cb30f6d /subx/056trace.subx
parent627b35b830ceb8299689b86123f86296adf63db3 (diff)
downloadmu-35272969cfe6fc81d706746362a7af2a0743275e.tar.gz
Fix stale `initialize-trace-stream`
Diffstat (limited to 'subx/056trace.subx')
-rw-r--r--subx/056trace.subx12
1 files changed, 9 insertions, 3 deletions
diff --git a/subx/056trace.subx b/subx/056trace.subx
index 2e483bad..c8d7cc2c 100644
--- a/subx/056trace.subx
+++ b/subx/056trace.subx
@@ -24,6 +24,10 @@
 Trace-stream:
     0/imm32
 
+Trace-segment:
+    0/imm32/curr
+    0/imm32/end
+
 # Fake trace-stream for tests.
 # Also illustrates the layout of the real trace-stream (segment).
 _test-trace-stream:
@@ -52,14 +56,16 @@ initialize-trace-stream:  # n : int -> <void>
     51/push-ECX
     # ECX = n
     8b/copy                         1/mod/*+disp8   5/rm32/EBP    .           .             .           1/r32/ECX   8/disp8         .                 # copy *(EBP+8) to ECX
-    # EAX = new-segment(n)
+    # Trace-segment = new-segment(n)
     # . . push args
+    68/push  Trace-segment/imm32
     51/push-ECX
     # . . call
     e8/call  new-segment/disp32
     # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
-    # copy EAX to *Trace-stream
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # copy Trace-segment->curr to *Trace-stream
+    8b/copy                         0/mod/indirect  5/rm32/.disp32            .             .           0/r32/EAX   Trace-segment/disp32              # copy *Trace-segment to EAX
     89/copy                         0/mod/indirect  5/rm32/.disp32            .             .           0/r32/EAX   Trace-stream/disp32               # copy EAX to *Trace-stream
     # Trace-stream->length = n - 12
     # . ECX -= 12