From 43f1c41dbed3517a277253383448817f9a3d5556 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Wed, 5 Jun 2019 19:30:31 -0700 Subject: start fleshing out trace support some more I think the path to readable tests for survey.subx passes through white-box tests. --- subx/056trace.subx | 28 +++++++++++++++++++++++----- subx/apps/assort | Bin 24081 -> 24092 bytes subx/apps/crenshaw2-1 | Bin 21308 -> 21319 bytes subx/apps/crenshaw2-1b | Bin 21867 -> 21878 bytes subx/apps/factorial | Bin 20224 -> 20235 bytes subx/apps/handle | Bin 21030 -> 21041 bytes subx/apps/hex | Bin 24317 -> 24328 bytes subx/apps/pack | Bin 39732 -> 39743 bytes 8 files changed, 23 insertions(+), 5 deletions(-) (limited to 'subx') diff --git a/subx/056trace.subx b/subx/056trace.subx index cedc512a..2e483bad 100644 --- a/subx/056trace.subx +++ b/subx/056trace.subx @@ -43,18 +43,36 @@ _test-trace-stream: # Allocate a new segment for the trace stream, initialize its length, and save its address to Trace-stream. # The Trace-stream segment will consist of variable-length lines separated by newlines (0x0a) -initialize-trace-stream: - # EAX = new-segment(0x1000) +initialize-trace-stream: # n : int -> + # . prolog + 55/push-EBP + 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP + # . save registers + 50/push-EAX + 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) # . . push args - 68/push 0x1000/imm32/N + 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 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Trace-stream/disp32 # copy EAX to *Trace-stream - # Trace-stream->length = 0x1000/N - 12 - c7 0/subop/copy 1/mod/*+disp8 0/rm32/EAX . . . . 8/disp8 0xff4/imm32 # copy 0xff4 to *(EAX+8) + # Trace-stream->length = n - 12 + # . ECX -= 12 + 81 5/subop/subtract 3/mod/direct 1/rm32/ECX . . . . . 0xc/imm32 # subtract from ECX + # . Trace-stream->length = ECX + 89/copy 1/mod/*+disp8 0/rm32/EAX . . . 1/r32/ECX 8/disp8 . # copy ECX to *(EAX+8) +$initialize-trace-stream:end: + # . restore registers + 59/pop-to-ECX + 58/pop-to-EAX + # . epilog + 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP + 5d/pop-to-EBP c3/return # Append a string to the given trace stream. diff --git a/subx/apps/assort b/subx/apps/assort index 32023675..b9ba016b 100755 Binary files a/subx/apps/assort and b/subx/apps/assort differ diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1 index def09e48..43fae481 100755 Binary files a/subx/apps/crenshaw2-1 and b/subx/apps/crenshaw2-1 differ diff --git a/subx/apps/crenshaw2-1b b/subx/apps/crenshaw2-1b index 705ac0ad..0a3c2c44 100755 Binary files a/subx/apps/crenshaw2-1b and b/subx/apps/crenshaw2-1b differ diff --git a/subx/apps/factorial b/subx/apps/factorial index 2330d6ad..3439987b 100755 Binary files a/subx/apps/factorial and b/subx/apps/factorial differ diff --git a/subx/apps/handle b/subx/apps/handle index 974e57a2..b6b806d5 100755 Binary files a/subx/apps/handle and b/subx/apps/handle differ diff --git a/subx/apps/hex b/subx/apps/hex index 4bce98eb..3eb6a5b7 100755 Binary files a/subx/apps/hex and b/subx/apps/hex differ diff --git a/subx/apps/pack b/subx/apps/pack index d1e98aa6..b8bd13aa 100755 Binary files a/subx/apps/pack and b/subx/apps/pack differ -- cgit 1.4.1-2-gfad0