From 20d6be52405130930fde9ca5bb5e95131ba4e659 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Thu, 14 Jan 2021 14:03:32 -0800 Subject: 7520 --- html/baremetal/120allocate.subx.html | 105 ++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 52 deletions(-) (limited to 'html/baremetal/120allocate.subx.html') diff --git a/html/baremetal/120allocate.subx.html b/html/baremetal/120allocate.subx.html index 11c874ee..d3bc3fc8 100644 --- a/html/baremetal/120allocate.subx.html +++ b/html/baremetal/120allocate.subx.html @@ -56,58 +56,59 @@ if ('onhashchange' in window) { https://github.com/akkartik/mu/blob/main/baremetal/120allocate.subx
- 1 #   instruction                     effective address                                                   register    displacement    immediate
- 2 # . op          subop               mod             rm32          base        index         scale       r32
- 3 # . 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
- 4 
- 5 # Fill a region of memory with zeroes.
- 6 zero-out:  # start: (addr byte), size: int
- 7     # pseudocode:
- 8     #   curr/esi = start
- 9     #   i/ecx = 0
-10     #   while true
-11     #     if (i >= size) break
-12     #     *curr = 0
-13     #     ++curr
-14     #     ++i
-15     #
-16     # . prologue
-17     55/push-ebp
-18     89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
-19     # . save registers
-20     50/push-eax
-21     51/push-ecx
-22     52/push-edx
-23     56/push-esi
-24     # curr/esi = start
-25     8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           6/r32/esi   8/disp8         .                 # copy *(ebp+8) to esi
-26     # var i/ecx: int = 0
-27     31/xor                          3/mod/direct    1/rm32/ecx    .           .             .           1/r32/ecx   .               .                 # clear ecx
-28     # edx = size
-29     8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           2/r32/edx   0xc/disp8       .                 # copy *(ebp+12) to edx
-30 $zero-out:loop:
-31     # if (i >= size) break
-32     39/compare                      3/mod/direct    1/rm32/ecx    .           .             .           2/r32/edx   .               .                 # compare ecx with edx
-33     7d/jump-if->=  $zero-out:end/disp8
-34     # *curr = 0
-35     c6          0/subop/copy-byte   0/mod/direct    6/rm32/esi    .           .             .           .           .               0/imm8            # copy byte to *esi
-36     # ++curr
-37     46/increment-esi
-38     # ++i
-39     41/increment-ecx
-40     eb/jump  $zero-out:loop/disp8
-41 $zero-out:end:
-42     # . restore registers
-43     5e/pop-to-esi
-44     5a/pop-to-edx
-45     59/pop-to-ecx
-46     58/pop-to-eax
-47     # . epilogue
-48     89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
-49     5d/pop-to-ebp
-50     c3/return
-51 
-52 # . . vim:nowrap:textwidth=0
+ 1 == code
+ 2 #   instruction                     effective address                                                   register    displacement    immediate
+ 3 # . op          subop               mod             rm32          base        index         scale       r32
+ 4 # . 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
+ 5 
+ 6 # Fill a region of memory with zeroes.
+ 7 zero-out:  # start: (addr byte), size: int
+ 8     # pseudocode:
+ 9     #   curr/esi = start
+10     #   i/ecx = 0
+11     #   while true
+12     #     if (i >= size) break
+13     #     *curr = 0
+14     #     ++curr
+15     #     ++i
+16     #
+17     # . prologue
+18     55/push-ebp
+19     89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
+20     # . save registers
+21     50/push-eax
+22     51/push-ecx
+23     52/push-edx
+24     56/push-esi
+25     # curr/esi = start
+26     8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           6/r32/esi   8/disp8         .                 # copy *(ebp+8) to esi
+27     # var i/ecx: int = 0
+28     31/xor                          3/mod/direct    1/rm32/ecx    .           .             .           1/r32/ecx   .               .                 # clear ecx
+29     # edx = size
+30     8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           2/r32/edx   0xc/disp8       .                 # copy *(ebp+12) to edx
+31 $zero-out:loop:
+32     # if (i >= size) break
+33     39/compare                      3/mod/direct    1/rm32/ecx    .           .             .           2/r32/edx   .               .                 # compare ecx with edx
+34     7d/jump-if->=  $zero-out:end/disp8
+35     # *curr = 0
+36     c6          0/subop/copy-byte   0/mod/direct    6/rm32/esi    .           .             .           .           .               0/imm8            # copy byte to *esi
+37     # ++curr
+38     46/increment-esi
+39     # ++i
+40     41/increment-ecx
+41     eb/jump  $zero-out:loop/disp8
+42 $zero-out:end:
+43     # . restore registers
+44     5e/pop-to-esi
+45     5a/pop-to-edx
+46     59/pop-to-ecx
+47     58/pop-to-eax
+48     # . epilogue
+49     89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
+50     5d/pop-to-ebp
+51     c3/return
+52 
+53 # . . vim:nowrap:textwidth=0
 
-- cgit 1.4.1-2-gfad0