retrait des id de SP et PC et echange de @ et size

This commit is contained in:
amaury 2023-03-01 17:22:20 +01:00
parent d34b5b0067
commit e61a92b490
3 changed files with 505 additions and 5 deletions

483
file.txt Normal file
View File

@ -0,0 +1,483 @@
./test_programs/riscv_instructions/simple_arithmetics/unsigned_addition.o: file format elf64-littleriscv
Disassembly of section .text:
00000000000100e8 <exit>:
100e8: ff010113 addi sp,sp,-16
100ec: 00000593 li a1,0
100f0: 00813023 sd s0,0(sp)
100f4: 00113423 sd ra,8(sp)
100f8: 00050413 mv s0,a0
100fc: 29c000ef jal ra,10398 <__call_exitprocs>
10100: f481b503 ld a0,-184(gp) # 11d78 <_global_impure_ptr>
10104: 05853783 ld a5,88(a0)
10108: 00078463 beqz a5,10110 <exit+0x28>
1010c: 000780e7 jalr a5
10110: 00040513 mv a0,s0
10114: 4c4000ef jal ra,105d8 <_exit>
0000000000010118 <register_fini>:
10118: 00000793 li a5,0
1011c: 00078863 beqz a5,1012c <register_fini+0x14>
10120: 00010537 lui a0,0x10
10124: 4c050513 addi a0,a0,1216 # 104c0 <__libc_fini_array>
10128: 3f40006f j 1051c <atexit>
1012c: 00008067 ret
0000000000010130 <_start>:
10130: 00002197 auipc gp,0x2
10134: d0018193 addi gp,gp,-768 # 11e30 <__global_pointer$>
10138: f6018513 addi a0,gp,-160 # 11d90 <completed.1>
1013c: f9818613 addi a2,gp,-104 # 11dc8 <__BSS_END__>
10140: 40a60633 sub a2,a2,a0
10144: 00000593 li a1,0
10148: 174000ef jal ra,102bc <memset>
1014c: 00000517 auipc a0,0x0
10150: 3d050513 addi a0,a0,976 # 1051c <atexit>
10154: 00050863 beqz a0,10164 <_start+0x34>
10158: 00000517 auipc a0,0x0
1015c: 36850513 addi a0,a0,872 # 104c0 <__libc_fini_array>
10160: 3bc000ef jal ra,1051c <atexit>
10164: 0bc000ef jal ra,10220 <__libc_init_array>
10168: 00012503 lw a0,0(sp)
1016c: 00810593 addi a1,sp,8
10170: 00000613 li a2,0
10174: 06c000ef jal ra,101e0 <main>
10178: f71ff06f j 100e8 <exit>
000000000001017c <__do_global_dtors_aux>:
1017c: ff010113 addi sp,sp,-16
10180: 00813023 sd s0,0(sp)
10184: f601c783 lbu a5,-160(gp) # 11d90 <completed.1>
10188: 00113423 sd ra,8(sp)
1018c: 02079263 bnez a5,101b0 <__do_global_dtors_aux+0x34>
10190: 00000793 li a5,0
10194: 00078a63 beqz a5,101a8 <__do_global_dtors_aux+0x2c>
10198: 00011537 lui a0,0x11
1019c: 61050513 addi a0,a0,1552 # 11610 <__FRAME_END__>
101a0: 00000097 auipc ra,0x0
101a4: 000000e7 jalr zero # 0 <exit-0x100e8>
101a8: 00100793 li a5,1
101ac: f6f18023 sb a5,-160(gp) # 11d90 <completed.1>
101b0: 00813083 ld ra,8(sp)
101b4: 00013403 ld s0,0(sp)
101b8: 01010113 addi sp,sp,16
101bc: 00008067 ret
00000000000101c0 <frame_dummy>:
101c0: 00000793 li a5,0
101c4: 00078c63 beqz a5,101dc <frame_dummy+0x1c>
101c8: 00011537 lui a0,0x11
101cc: f6818593 addi a1,gp,-152 # 11d98 <object.0>
101d0: 61050513 addi a0,a0,1552 # 11610 <__FRAME_END__>
101d4: 00000317 auipc t1,0x0
101d8: 00000067 jr zero # 0 <exit-0x100e8>
101dc: 00008067 ret
00000000000101e0 <main>:
101e0: fe010113 addi sp,sp,-32
101e4: 00813c23 sd s0,24(sp)
101e8: 02010413 addi s0,sp,32
101ec: fe042623 sw zero,-20(s0)
101f0: 00100793 li a5,1
101f4: fef42423 sw a5,-24(s0)
101f8: fec42783 lw a5,-20(s0)
101fc: 00078713 mv a4,a5
10200: fe842783 lw a5,-24(s0)
10204: 00f707bb addw a5,a4,a5
10208: fef42623 sw a5,-20(s0)
1020c: 00000793 li a5,0
10210: 00078513 mv a0,a5
10214: 01813403 ld s0,24(sp)
10218: 02010113 addi sp,sp,32
1021c: 00008067 ret
0000000000010220 <__libc_init_array>:
10220: fe010113 addi sp,sp,-32
10224: 00813823 sd s0,16(sp)
10228: 000117b7 lui a5,0x11
1022c: 00011437 lui s0,0x11
10230: 01213023 sd s2,0(sp)
10234: 61478793 addi a5,a5,1556 # 11614 <__preinit_array_end>
10238: 61440713 addi a4,s0,1556 # 11614 <__preinit_array_end>
1023c: 00113c23 sd ra,24(sp)
10240: 00913423 sd s1,8(sp)
10244: 40e78933 sub s2,a5,a4
10248: 02e78263 beq a5,a4,1026c <__libc_init_array+0x4c>
1024c: 40395913 srai s2,s2,0x3
10250: 61440413 addi s0,s0,1556
10254: 00000493 li s1,0
10258: 00043783 ld a5,0(s0)
1025c: 00148493 addi s1,s1,1
10260: 00840413 addi s0,s0,8
10264: 000780e7 jalr a5
10268: ff24e8e3 bltu s1,s2,10258 <__libc_init_array+0x38>
1026c: 00011437 lui s0,0x11
10270: 000117b7 lui a5,0x11
10274: 62878793 addi a5,a5,1576 # 11628 <__do_global_dtors_aux_fini_array_entry>
10278: 61840713 addi a4,s0,1560 # 11618 <__init_array_start>
1027c: 40e78933 sub s2,a5,a4
10280: 40395913 srai s2,s2,0x3
10284: 02e78063 beq a5,a4,102a4 <__libc_init_array+0x84>
10288: 61840413 addi s0,s0,1560
1028c: 00000493 li s1,0
10290: 00043783 ld a5,0(s0)
10294: 00148493 addi s1,s1,1
10298: 00840413 addi s0,s0,8
1029c: 000780e7 jalr a5
102a0: ff24e8e3 bltu s1,s2,10290 <__libc_init_array+0x70>
102a4: 01813083 ld ra,24(sp)
102a8: 01013403 ld s0,16(sp)
102ac: 00813483 ld s1,8(sp)
102b0: 00013903 ld s2,0(sp)
102b4: 02010113 addi sp,sp,32
102b8: 00008067 ret
00000000000102bc <memset>:
102bc: 00f00313 li t1,15
102c0: 00050713 mv a4,a0
102c4: 02c37a63 bgeu t1,a2,102f8 <memset+0x3c>
102c8: 00f77793 andi a5,a4,15
102cc: 0a079063 bnez a5,1036c <memset+0xb0>
102d0: 06059e63 bnez a1,1034c <memset+0x90>
102d4: ff067693 andi a3,a2,-16
102d8: 00f67613 andi a2,a2,15
102dc: 00e686b3 add a3,a3,a4
102e0: 00b73023 sd a1,0(a4)
102e4: 00b73423 sd a1,8(a4)
102e8: 01070713 addi a4,a4,16
102ec: fed76ae3 bltu a4,a3,102e0 <memset+0x24>
102f0: 00061463 bnez a2,102f8 <memset+0x3c>
102f4: 00008067 ret
102f8: 40c306b3 sub a3,t1,a2
102fc: 00269693 slli a3,a3,0x2
10300: 00000297 auipc t0,0x0
10304: 005686b3 add a3,a3,t0
10308: 00c68067 jr 12(a3)
1030c: 00b70723 sb a1,14(a4)
10310: 00b706a3 sb a1,13(a4)
10314: 00b70623 sb a1,12(a4)
10318: 00b705a3 sb a1,11(a4)
1031c: 00b70523 sb a1,10(a4)
10320: 00b704a3 sb a1,9(a4)
10324: 00b70423 sb a1,8(a4)
10328: 00b703a3 sb a1,7(a4)
1032c: 00b70323 sb a1,6(a4)
10330: 00b702a3 sb a1,5(a4)
10334: 00b70223 sb a1,4(a4)
10338: 00b701a3 sb a1,3(a4)
1033c: 00b70123 sb a1,2(a4)
10340: 00b700a3 sb a1,1(a4)
10344: 00b70023 sb a1,0(a4)
10348: 00008067 ret
1034c: 0ff5f593 zext.b a1,a1
10350: 00859693 slli a3,a1,0x8
10354: 00d5e5b3 or a1,a1,a3
10358: 01059693 slli a3,a1,0x10
1035c: 00d5e5b3 or a1,a1,a3
10360: 02059693 slli a3,a1,0x20
10364: 00d5e5b3 or a1,a1,a3
10368: f6dff06f j 102d4 <memset+0x18>
1036c: 00279693 slli a3,a5,0x2
10370: 00000297 auipc t0,0x0
10374: 005686b3 add a3,a3,t0
10378: 00008293 mv t0,ra
1037c: f98680e7 jalr -104(a3)
10380: 00028093 mv ra,t0
10384: ff078793 addi a5,a5,-16
10388: 40f70733 sub a4,a4,a5
1038c: 00f60633 add a2,a2,a5
10390: f6c374e3 bgeu t1,a2,102f8 <memset+0x3c>
10394: f3dff06f j 102d0 <memset+0x14>
0000000000010398 <__call_exitprocs>:
10398: fb010113 addi sp,sp,-80
1039c: 03413023 sd s4,32(sp)
103a0: f481ba03 ld s4,-184(gp) # 11d78 <_global_impure_ptr>
103a4: 03213823 sd s2,48(sp)
103a8: 04113423 sd ra,72(sp)
103ac: 1f8a3903 ld s2,504(s4)
103b0: 04813023 sd s0,64(sp)
103b4: 02913c23 sd s1,56(sp)
103b8: 03313423 sd s3,40(sp)
103bc: 01513c23 sd s5,24(sp)
103c0: 01613823 sd s6,16(sp)
103c4: 01713423 sd s7,8(sp)
103c8: 01813023 sd s8,0(sp)
103cc: 04090063 beqz s2,1040c <__call_exitprocs+0x74>
103d0: 00050b13 mv s6,a0
103d4: 00058b93 mv s7,a1
103d8: 00100a93 li s5,1
103dc: fff00993 li s3,-1
103e0: 00892483 lw s1,8(s2)
103e4: fff4841b addiw s0,s1,-1
103e8: 02044263 bltz s0,1040c <__call_exitprocs+0x74>
103ec: 00349493 slli s1,s1,0x3
103f0: 009904b3 add s1,s2,s1
103f4: 040b8463 beqz s7,1043c <__call_exitprocs+0xa4>
103f8: 2084b783 ld a5,520(s1)
103fc: 05778063 beq a5,s7,1043c <__call_exitprocs+0xa4>
10400: fff4041b addiw s0,s0,-1
10404: ff848493 addi s1,s1,-8
10408: ff3416e3 bne s0,s3,103f4 <__call_exitprocs+0x5c>
1040c: 04813083 ld ra,72(sp)
10410: 04013403 ld s0,64(sp)
10414: 03813483 ld s1,56(sp)
10418: 03013903 ld s2,48(sp)
1041c: 02813983 ld s3,40(sp)
10420: 02013a03 ld s4,32(sp)
10424: 01813a83 ld s5,24(sp)
10428: 01013b03 ld s6,16(sp)
1042c: 00813b83 ld s7,8(sp)
10430: 00013c03 ld s8,0(sp)
10434: 05010113 addi sp,sp,80
10438: 00008067 ret
1043c: 00892783 lw a5,8(s2)
10440: 0084b703 ld a4,8(s1)
10444: fff7879b addiw a5,a5,-1
10448: 06878263 beq a5,s0,104ac <__call_exitprocs+0x114>
1044c: 0004b423 sd zero,8(s1)
10450: fa0708e3 beqz a4,10400 <__call_exitprocs+0x68>
10454: 31092783 lw a5,784(s2)
10458: 008a96bb sllw a3,s5,s0
1045c: 00892c03 lw s8,8(s2)
10460: 00d7f7b3 and a5,a5,a3
10464: 0007879b sext.w a5,a5
10468: 02079263 bnez a5,1048c <__call_exitprocs+0xf4>
1046c: 000700e7 jalr a4
10470: 00892703 lw a4,8(s2)
10474: 1f8a3783 ld a5,504(s4)
10478: 01871463 bne a4,s8,10480 <__call_exitprocs+0xe8>
1047c: f92782e3 beq a5,s2,10400 <__call_exitprocs+0x68>
10480: f80786e3 beqz a5,1040c <__call_exitprocs+0x74>
10484: 00078913 mv s2,a5
10488: f59ff06f j 103e0 <__call_exitprocs+0x48>
1048c: 31492783 lw a5,788(s2)
10490: 1084b583 ld a1,264(s1)
10494: 00d7f7b3 and a5,a5,a3
10498: 0007879b sext.w a5,a5
1049c: 00079c63 bnez a5,104b4 <__call_exitprocs+0x11c>
104a0: 000b0513 mv a0,s6
104a4: 000700e7 jalr a4
104a8: fc9ff06f j 10470 <__call_exitprocs+0xd8>
104ac: 00892423 sw s0,8(s2)
104b0: fa1ff06f j 10450 <__call_exitprocs+0xb8>
104b4: 00058513 mv a0,a1
104b8: 000700e7 jalr a4
104bc: fb5ff06f j 10470 <__call_exitprocs+0xd8>
00000000000104c0 <__libc_fini_array>:
104c0: fe010113 addi sp,sp,-32
104c4: 00813823 sd s0,16(sp)
104c8: 000117b7 lui a5,0x11
104cc: 00011437 lui s0,0x11
104d0: 62878793 addi a5,a5,1576 # 11628 <__do_global_dtors_aux_fini_array_entry>
104d4: 63040413 addi s0,s0,1584 # 11630 <impure_data>
104d8: 40f40433 sub s0,s0,a5
104dc: 00913423 sd s1,8(sp)
104e0: 00113c23 sd ra,24(sp)
104e4: 40345493 srai s1,s0,0x3
104e8: 02048063 beqz s1,10508 <__libc_fini_array+0x48>
104ec: ff840413 addi s0,s0,-8
104f0: 00f40433 add s0,s0,a5
104f4: 00043783 ld a5,0(s0)
104f8: fff48493 addi s1,s1,-1
104fc: ff840413 addi s0,s0,-8
10500: 000780e7 jalr a5
10504: fe0498e3 bnez s1,104f4 <__libc_fini_array+0x34>
10508: 01813083 ld ra,24(sp)
1050c: 01013403 ld s0,16(sp)
10510: 00813483 ld s1,8(sp)
10514: 02010113 addi sp,sp,32
10518: 00008067 ret
000000000001051c <atexit>:
1051c: 00050593 mv a1,a0
10520: 00000693 li a3,0
10524: 00000613 li a2,0
10528: 00000513 li a0,0
1052c: 0040006f j 10530 <__register_exitproc>
0000000000010530 <__register_exitproc>:
10530: f481b703 ld a4,-184(gp) # 11d78 <_global_impure_ptr>
10534: 1f873783 ld a5,504(a4)
10538: 06078063 beqz a5,10598 <__register_exitproc+0x68>
1053c: 0087a703 lw a4,8(a5)
10540: 01f00813 li a6,31
10544: 08e84663 blt a6,a4,105d0 <__register_exitproc+0xa0>
10548: 02050863 beqz a0,10578 <__register_exitproc+0x48>
1054c: 00371813 slli a6,a4,0x3
10550: 01078833 add a6,a5,a6
10554: 10c83823 sd a2,272(a6)
10558: 3107a883 lw a7,784(a5)
1055c: 00100613 li a2,1
10560: 00e6163b sllw a2,a2,a4
10564: 00c8e8b3 or a7,a7,a2
10568: 3117a823 sw a7,784(a5)
1056c: 20d83823 sd a3,528(a6)
10570: 00200693 li a3,2
10574: 02d50863 beq a0,a3,105a4 <__register_exitproc+0x74>
10578: 00270693 addi a3,a4,2
1057c: 00369693 slli a3,a3,0x3
10580: 0017071b addiw a4,a4,1
10584: 00e7a423 sw a4,8(a5)
10588: 00d787b3 add a5,a5,a3
1058c: 00b7b023 sd a1,0(a5)
10590: 00000513 li a0,0
10594: 00008067 ret
10598: 20070793 addi a5,a4,512
1059c: 1ef73c23 sd a5,504(a4)
105a0: f9dff06f j 1053c <__register_exitproc+0xc>
105a4: 3147a683 lw a3,788(a5)
105a8: 00000513 li a0,0
105ac: 00c6e6b3 or a3,a3,a2
105b0: 30d7aa23 sw a3,788(a5)
105b4: 00270693 addi a3,a4,2
105b8: 00369693 slli a3,a3,0x3
105bc: 0017071b addiw a4,a4,1
105c0: 00e7a423 sw a4,8(a5)
105c4: 00d787b3 add a5,a5,a3
105c8: 00b7b023 sd a1,0(a5)
105cc: 00008067 ret
105d0: fff00513 li a0,-1
105d4: 00008067 ret
00000000000105d8 <_exit>:
105d8: 05d00893 li a7,93
105dc: 00000073 ecall
105e0: 00054463 bltz a0,105e8 <_exit+0x10>
105e4: 0000006f j 105e4 <_exit+0xc>
105e8: ff010113 addi sp,sp,-16
105ec: 00813023 sd s0,0(sp)
105f0: 00050413 mv s0,a0
105f4: 00113423 sd ra,8(sp)
105f8: 4080043b negw s0,s0
105fc: 00c000ef jal ra,10608 <__errno>
10600: 00852023 sw s0,0(a0)
10604: 0000006f j 10604 <_exit+0x2c>
0000000000010608 <__errno>:
10608: f581b503 ld a0,-168(gp) # 11d88 <_impure_ptr>
1060c: 00008067 ret
Disassembly of section .eh_frame:
0000000000011610 <__FRAME_END__>:
11610: 0000 .2byte 0x0
...
Disassembly of section .init_array:
0000000000011618 <__init_array_start>:
11618: 0118 .2byte 0x118
1161a: 0001 .2byte 0x1
1161c: 0000 .2byte 0x0
...
0000000000011620 <__frame_dummy_init_array_entry>:
11620: 01c0 .2byte 0x1c0
11622: 0001 .2byte 0x1
11624: 0000 .2byte 0x0
...
Disassembly of section .fini_array:
0000000000011628 <__do_global_dtors_aux_fini_array_entry>:
11628: 017c .2byte 0x17c
1162a: 0001 .2byte 0x1
1162c: 0000 .2byte 0x0
...
Disassembly of section .data:
0000000000011630 <impure_data>:
...
11638: 1b68 .2byte 0x1b68
1163a: 0001 .2byte 0x1
1163c: 0000 .2byte 0x0
1163e: 0000 .2byte 0x0
11640: 1c18 .2byte 0x1c18
11642: 0001 .2byte 0x1
11644: 0000 .2byte 0x0
11646: 0000 .2byte 0x0
11648: 1cc8 .2byte 0x1cc8
1164a: 0001 .2byte 0x1
...
11718: 0001 .2byte 0x1
1171a: 0000 .2byte 0x0
1171c: 0000 .2byte 0x0
1171e: 0000 .2byte 0x0
11720: 330e .2byte 0x330e
11722: abcd .2byte 0xabcd
11724: 1234 .2byte 0x1234
11726: e66d .2byte 0xe66d
11728: deec .2byte 0xdeec
1172a: 0005 .2byte 0x5
1172c: 0000000b .4byte 0xb
...
Disassembly of section .sdata:
0000000000011d78 <_global_impure_ptr>:
11d78: 1630 .2byte 0x1630
11d7a: 0001 .2byte 0x1
11d7c: 0000 .2byte 0x0
...
0000000000011d80 <__dso_handle>:
...
0000000000011d88 <_impure_ptr>:
11d88: 1630 .2byte 0x1630
11d8a: 0001 .2byte 0x1
11d8c: 0000 .2byte 0x0
...
Disassembly of section .bss:
0000000000011d90 <completed.1>:
...
0000000000011d98 <object.0>:
...
Disassembly of section .comment:
0000000000000000 <.comment>:
0: 3a434347 .4byte 0x3a434347
4: 2820 .2byte 0x2820
6: 2029 .2byte 0x2029
8: 3231 .2byte 0x3231
a: 322e .2byte 0x322e
c: 302e .2byte 0x302e
e: 4700 .2byte 0x4700
10: 203a4343 .4byte 0x203a4343
14: 4728 .2byte 0x4728
16: 554e .2byte 0x554e
18: 2029 .2byte 0x2029
1a: 3231 .2byte 0x3231
1c: 322e .2byte 0x322e
1e: 302e .2byte 0x302e
...
Disassembly of section .riscv.attributes:
0000000000000000 <.riscv.attributes>:
0: 2041 .2byte 0x2041
2: 0000 .2byte 0x0
4: 7200 .2byte 0x7200
6: 7369 .2byte 0x7369
8: 01007663 bgeu zero,a6,14 <exit-0x100d4>
c: 0016 .2byte 0x16
e: 0000 .2byte 0x0
10: 1004 .2byte 0x1004
12: 7205 .2byte 0x7205
14: 3676 .2byte 0x3676
16: 6934 .2byte 0x6934
18: 7032 .2byte 0x7032
1a: 5f30 .2byte 0x5f30
1c: 326d .2byte 0x326d
1e: 3070 .2byte 0x3070
...

File diff suppressed because one or more lines are too long

17
old_section.txt Normal file
View File

@ -0,0 +1,17 @@
fe010113
00813c23
02010413
fe042623
00100793
fef42423
fec42783
00078713
fe842783
00f707bb
fef42623
00000013
01813403
02010113
00008067
0
0