From b7ec03984ff76cbbbf30bc5854220b3b2048639a Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Wed, 29 Jan 2020 17:38:32 -0800 Subject: 5950 --- html/mu-init-test.subx.html | 98 +++++++++++++++++++++++++++++++++++++++++++++ html/run_one_test.subx.html | 91 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 189 insertions(+) create mode 100644 html/mu-init-test.subx.html create mode 100644 html/run_one_test.subx.html diff --git a/html/mu-init-test.subx.html b/html/mu-init-test.subx.html new file mode 100644 index 00000000..e0475d7b --- /dev/null +++ b/html/mu-init-test.subx.html @@ -0,0 +1,98 @@ + + + + +Mu - mu-init-test.subx + + + + + + + + + + +https://github.com/akkartik/mu/blob/master/mu-init-test.subx +
+ 1 # Just a test stub for mu-init.subx
+ 2 #
+ 3 # Try it out like this:
+ 4 #   $ ./translate_subx init.linux 0*.subx mu-init.subx mu-init-test.subx
+ 5 #   $ ./a.elf  # should run all tests
+ 6 
+ 7 main:  # args: (address array kernel-string) -> result/ebx: int
+ 8     # . prologue
+ 9     55/push-ebp
+10     89/<- %ebp 4/r32/esp
+11     # . save registers
+12     50/push-eax
+13     56/push-esi
+14     # esi = args
+15     8b/-> *(ebp+8) 6/r32/esi
+16     {
+17       # if (argc <= 1) break
+18       81 7/subop/compare *esi 1/imm32
+19       7e/jump-if-<= break/disp8
+20       # if (argv[1] != "test") break
+21       (kernel-string-equal? *(esi+8) "test")  # => eax
+22       3d/compare-eax-and 0/imm32
+23       74/jump-if-= break/disp8
+24       #
+25       (run-tests)
+26       # return *Num-test-failures
+27       8b/-> *Num-test-failures 3/r32/ebx
+28       eb/jump $main:end/disp8
+29     }
+30 $main:end:
+31     # . restore registers
+32     5e/pop-to-esi
+33     58/pop-to-eax
+34     # . epilogue
+35     89/<- %esp 5/r32/ebp
+36     5d/pop-to-ebp
+37     c3/return
+
+ + + diff --git a/html/run_one_test.subx.html b/html/run_one_test.subx.html new file mode 100644 index 00000000..37ea4771 --- /dev/null +++ b/html/run_one_test.subx.html @@ -0,0 +1,91 @@ + + + + +Mu - run_one_test.subx + + + + + + + + + + +https://github.com/akkartik/mu/blob/master/run_one_test.subx +
+ 1 # run a single test
+ 2 
+ 3 == code
+ 4 #   instruction                     effective address                                                   register    displacement    immediate
+ 5 # . op          subop               mod             rm32          base        index         scale       r32
+ 6 # . 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
+ 7 
+ 8 Entry:
+ 9     # Heap = new-segment(64KB)
+10     # . . push args
+11     68/push  Heap/imm32
+12     68/push  0x10000/imm32/64KB
+13     # . . call
+14     e8/call  new-segment/disp32
+15     # . . discard args
+16     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
+17     # initialize-trace-stream(256KB)
+18     # . . push args
+19     68/push  0x40000/imm32/256KB
+20     # . . call
+21     e8/call  initialize-trace-stream/disp32
+22     # . . discard args
+23     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
+24     # for debugging: run a single test
+25     e8/call $TEST_NAME/disp32
+26     8b/copy                         0/mod/indirect  5/rm32/.disp32            .             .           3/r32/ebx   Num-test-failures/disp32          # copy *Num-test-failures to ebx
+27     b8/copy-to-eax  1/imm32/exit
+28     cd/syscall  0x80/imm8
+29 
+30 # . . vim:nowrap:textwidth=0
+
+ + + -- cgit 1.4.1-2-gfad0