From 57714dd4fc385b51e879569f8df2eb61ff1f3154 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 9 Jul 2019 23:47:20 -0700 Subject: . --- subx/apps/subx-common.subx | 106 +++++++++++++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 37 deletions(-) diff --git a/subx/apps/subx-common.subx b/subx/apps/subx-common.subx index aa6498c1..5ddc8cb2 100644 --- a/subx/apps/subx-common.subx +++ b/subx/apps/subx-common.subx @@ -2382,94 +2382,122 @@ test-compute-width: 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP $test-compute-width:imm8: # EAX = compute-width("0x2/imm8") - 68/push "0x2/imm8"/imm32 + # . . push args + 68/push "0x2/imm8"/imm32 + # . . call e8/call compute-width/disp32 - # . discard args + # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # check-ints-equal(EAX, 1, msg) - 68/push "F - test-compute-width: 0x2/imm8"/imm32 + # . . push args + 68/push "F - test-compute-width: 0x2/imm8"/imm32 50/push-EAX - 68/push 1/imm32 + 68/push 1/imm32 + # . . call e8/call check-ints-equal/disp32 - # . discard args + # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP $test-compute-width:imm16: # EAX = compute-width("4/imm16") - 68/push "4/imm16"/imm32 + # . . push args + 68/push "4/imm16"/imm32 + # . . call e8/call compute-width/disp32 - # . discard args + # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # check-ints-equal(EAX, 2, msg) - 68/push "F - test-compute-width: 4/imm16"/imm32 + # . . push args + 68/push "F - test-compute-width: 4/imm16"/imm32 50/push-EAX - 68/push 2/imm32 + 68/push 2/imm32 + # . . call e8/call check-ints-equal/disp32 - # . discard args + # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP $test-compute-width:imm32: # EAX = compute-width("4/imm32") - 68/push "4/imm32"/imm32 + # . . push args + 68/push "4/imm32"/imm32 + # . . call e8/call compute-width/disp32 - # . discard args + # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # check-ints-equal(EAX, 4, msg) - 68/push "F - test-compute-width: 4/imm32"/imm32 + # . . push args + 68/push "F - test-compute-width: 4/imm32"/imm32 50/push-EAX - 68/push 4/imm32 + 68/push 4/imm32 + # . . call e8/call check-ints-equal/disp32 - # . discard args + # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP $test-compute-width:disp8: # EAX = compute-width("foo/disp8") - 68/push "foo/disp8"/imm32 + # . . push args + 68/push "foo/disp8"/imm32 + # . . call e8/call compute-width/disp32 - # . discard args + # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # check-ints-equal(EAX, 1, msg) - 68/push "F - test-compute-width: foo/disp8"/imm32 + # . . push args + 68/push "F - test-compute-width: foo/disp8"/imm32 50/push-EAX - 68/push 1/imm32 + 68/push 1/imm32 + # . . call e8/call check-ints-equal/disp32 - # . discard args + # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP $test-compute-width:disp16: # EAX = compute-width("foo/disp16") - 68/push "foo/disp16"/imm32 + # . . push args + 68/push "foo/disp16"/imm32 + # . . call e8/call compute-width/disp32 - # . discard args + # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # check-ints-equal(EAX, 2, msg) - 68/push "F - test-compute-width: foo/disp16"/imm32 + # . . push args + 68/push "F - test-compute-width: foo/disp16"/imm32 50/push-EAX - 68/push 2/imm32 + 68/push 2/imm32 + # . . call e8/call check-ints-equal/disp32 - # . discard args + # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP $test-compute-width:disp32: # EAX = compute-width("foo/disp32") - 68/push "foo/disp32"/imm32 + # . . push args + 68/push "foo/disp32"/imm32 + # . . call e8/call compute-width/disp32 - # . discard args + # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # check-ints-equal(EAX, 4, msg) - 68/push "F - test-compute-width: foo/disp32"/imm32 + # . . push args + 68/push "F - test-compute-width: foo/disp32"/imm32 50/push-EAX - 68/push 4/imm32 + 68/push 4/imm32 + # . . call e8/call check-ints-equal/disp32 - # . discard args + # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP $test-compute-width:no-metadata: # EAX = compute-width("45") - 68/push "45"/imm32 + # . . push args + 68/push "45"/imm32 + # . . call e8/call compute-width/disp32 - # . discard args + # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # check-ints-equal(EAX, 1, msg) - 68/push "F - test-compute-width: 45 (no metadata)"/imm32 + # . . push args + 68/push "F - test-compute-width: 45 (no metadata)"/imm32 50/push-EAX - 68/push 1/imm32 + 68/push 1/imm32 + # . . call e8/call check-ints-equal/disp32 - # . discard args + # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP # . epilog 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP @@ -2519,9 +2547,11 @@ $test-is-label?:true: 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # is-label?(slice/ECX) + # . . push args 51/push-ECX + # . . call e8/call is-label?/disp32 - # . discard args + # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # check-ints-equal(EAX, 1, msg) # . . push args @@ -2543,9 +2573,11 @@ $test-is-label?:false: 50/push-EAX 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX # is-label?(slice/ECX) + # . . push args 51/push-ECX + # . . call e8/call is-label?/disp32 - # . discard args + # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # check-ints-equal(EAX, 0, msg) # . . push args -- cgit 1.4.1-2-gfad0