summary refs log tree commit diff stats
path: root/test/tc_ext.py
Commit message (Expand)AuthorAgeFilesLines
* added copyright info to config files and test caseshut2010-03-081-0/+15
* shell_escape: added testcasehut2010-02-241-0/+7
* tc_ext: small updatehut2010-01-261-7/+10
* added testcase for openstructhut2010-01-261-0/+26
* added testcase for mount_pathhut2010-01-261-0/+25
* added unittest for flatten and uniquehut2010-01-261-0/+69
us revision' href='/akkartik/mu/blame/subx/ex3.subx?h=hlt&id=d57d39cb3f867d6e33ffa8e4cdc7d0ca749cb75c'>^
97a9bd17 ^
ecfbbfb5 ^
ee9a9237 ^


e5cbbea4 ^
294a1520 ^
33352536 ^



97a9bd17 ^
f3901d90 ^
1639687b ^
33352536 ^
6070c23e ^
6030d7e2 ^
33352536 ^
6030d7e2 ^
33352536 ^
6030d7e2 ^

97a9bd17 ^
f3901d90 ^
ecfbbfb5 ^

294a1520 ^
ee9a9237 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
                                                                   
 
         

                                                                


                  
 
       


                                                                                                                                                 
 
      



                           
 
      
                             
                                                                                                                                                                   
                             
                       
                                                                                                                                                                      
               
                    

                        
 
      

                                
 
                            
# Add the first 10 numbers, and return the result in the exit code.
#
# To run:
#   $ ./bootstrap translate init.linux apps/ex3.subx -o apps/ex3
#   $ ./bootstrap run apps/ex3
# Expected result:
#   $ echo $?
#   55

== code
#   instruction                     effective address                                                   register    displacement    immediate
# . op          subop               mod             rm32          base        index         scale       r32
# . 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

Entry:
    # result: ebx = 0
    bb/copy-to-ebx  0/imm32
    # counter: ecx = 1
    b9/copy-to-ecx  1/imm32

$loop:
    # if (counter > 10) break
    81          7/subop/compare     3/mod/direct    1/rm32/ecx    .           .             .           .           .               0xa/imm32         # compare ecx
    7f/jump-if->  $exit/disp8
    # result += counter
    01/add                          3/mod/direct    3/rm32/ebx    .           .             .           1/r32/ecx   .               .                 # add ecx to ebx
    # ++counter
    41/increment-ecx
    # loop
    eb/jump  $loop/disp8

$exit:
    # exit(ebx)
    e8/call  syscall_exit/disp32

# . . vim:nowrap:textwidth=0