From 3350c34a74844e21ea69077e01efff3bae64bdcd Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 23 Mar 2021 17:31:08 -0700 Subject: . --- html/linux/ex14.subx.html | 88 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 html/linux/ex14.subx.html (limited to 'html/linux/ex14.subx.html') diff --git a/html/linux/ex14.subx.html b/html/linux/ex14.subx.html new file mode 100644 index 00000000..2cb2a12e --- /dev/null +++ b/html/linux/ex14.subx.html @@ -0,0 +1,88 @@ + + + + +Mu - linux/ex14.subx + + + + + + + + + + +https://github.com/akkartik/mu/blob/main/linux/ex14.subx +
+ 1 # Multiply 2 numbers.
+ 2 #
+ 3 # To run:
+ 4 #   $ bootstrap/bootstrap translate apps/ex14.subx -o apps/ex14
+ 5 #   $ bootstrap/bootstrap run ex14
+ 6 # Expected result:
+ 7 #   $ echo $?
+ 8 #   6
+ 9 
+10 == code
+11 #   instruction                     effective address                                                   register    displacement    immediate
+12 # . op          subop               mod             rm32          base        index         scale       r32
+13 # . 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
+14 
+15 Entry:
+16     b8/copy-to-eax  1/imm32
+17     b9/copy-to-ecx  2/imm32
+18     bb/copy-to-ebx  3/imm32
+19 
+20     69/multiply                     3/mod/direct    1/rm32/ecx    .           .             .           3/r32/ebx                   3/imm32           # ebx = ecx * 3
+21 
+22 $exit:
+23     # exit(ebx)
+24     e8/call  syscall_exit/disp32
+25 
+26 # . . vim:nowrap:textwidth=0
+
+ + + -- cgit 1.4.1-2-gfad0