fix jmp rels
This commit is contained in:
parent
bce8e8356f
commit
855893ee09
|
|
@ -14,8 +14,8 @@
|
||||||
3e 00
|
3e 00
|
||||||
# e_version: u32 = EV_CURRENT
|
# e_version: u32 = EV_CURRENT
|
||||||
01 00 00 00
|
01 00 00 00
|
||||||
# e_entry: u64 = 0x400000
|
# e_entry: u64 = 0x400078
|
||||||
00 00 40 00 00 00 00 00
|
78 00 40 00 00 00 00 00
|
||||||
# e_phoff: u64 = 0x40
|
# e_phoff: u64 = 0x40
|
||||||
40 00 00 00 00 00 00 00
|
40 00 00 00 00 00 00 00
|
||||||
# e_shoff: u64 = 0x0
|
# e_shoff: u64 = 0x0
|
||||||
|
|
@ -47,24 +47,24 @@
|
||||||
00 00 40 00 00 00 00 00
|
00 00 40 00 00 00 00 00
|
||||||
# p_paddr: u64 = 0x0
|
# p_paddr: u64 = 0x0
|
||||||
00 00 00 00 00 00 00 00
|
00 00 00 00 00 00 00 00
|
||||||
# p_filesz: u64 = 0x164
|
# p_filesz: u64 = 0x167
|
||||||
64 01 00 00 00 00 00 00
|
67 01 00 00 00 00 00 00
|
||||||
# p_memsz: u64 = 0x1000
|
# p_memsz: u64 = 0x167
|
||||||
00 10 00 00 00 00 00 00
|
67 01 00 00 00 00 00 00
|
||||||
# p_align: u64 = 0x1000
|
# p_align: u64 = 0x1000
|
||||||
00 10 00 00 00 00 00 00
|
00 10 00 00 00 00 00 00
|
||||||
# End of program header
|
# End of program header
|
||||||
#
|
#
|
||||||
# Code segment (offset 0x40, virtual address 0x400000)
|
# Code segment (offset 0x40, virtual address 0x400000)
|
||||||
#
|
#
|
||||||
# _start:
|
# _start=120:
|
||||||
# ; alloca 0x1000 bytes on the stack
|
# ; alloca 0x1000 bytes on the stack
|
||||||
# mov rbp, rsp
|
# mov rbp, rsp
|
||||||
48 89 e5
|
48 89 e5
|
||||||
# sub rsp, 0x1000
|
# sub rsp, 0x1000
|
||||||
48 81 ec 00 10 00 00
|
48 81 ec 00 10 00 00
|
||||||
# ; read 0x800 bytes from stdin into the stack
|
# ; read 0x800 bytes from stdin into the stack
|
||||||
# .READ: (_start+10)
|
# .READ: (130)
|
||||||
# xor rax, rax
|
# xor rax, rax
|
||||||
48 31 c0
|
48 31 c0
|
||||||
# mov edi, 0 (stdin)
|
# mov edi, 0 (stdin)
|
||||||
|
|
@ -78,8 +78,8 @@
|
||||||
# cmp rax, 0
|
# cmp rax, 0
|
||||||
48 83 f8 00
|
48 83 f8 00
|
||||||
# jle die
|
# jle die
|
||||||
0f 8e a1 00 00 00 # 203 - 42 = 161 = 0xa1
|
0f 8e a8 00 00 00
|
||||||
## (_start+42)
|
## (162)
|
||||||
# ; end = r8
|
# ; end = r8
|
||||||
# mov r8, rax
|
# mov r8, rax
|
||||||
49 89 c0
|
49 89 c0
|
||||||
|
|
@ -94,35 +94,39 @@
|
||||||
# add r10, 0x800
|
# add r10, 0x800
|
||||||
49 81 c2 00 08 00 00
|
49 81 c2 00 08 00 00
|
||||||
# ; while (pos < end) {
|
# ; while (pos < end) {
|
||||||
# ; .L0: (_start+61)
|
# ; .L0: (181)
|
||||||
# cmp r9, r8
|
# cmp r9, r8
|
||||||
4d 39 c1
|
4d 39 c1
|
||||||
# jge .L3
|
# jge .L3
|
||||||
0f 8d 60 00 00 00 ; 166 - 70 = 96 = 0x60
|
0f 8d 67 00 00 00
|
||||||
# (_start+70)
|
# (190)
|
||||||
#
|
#
|
||||||
# ; if (*pos == '#') {
|
# ; if (*pos == '#') {
|
||||||
# mov al , byte [r9]
|
# mov al , byte [r9]
|
||||||
41 8a 41 00
|
41 8a 41 00
|
||||||
# cmp al, '#'
|
# cmp al, '#'
|
||||||
3c 23
|
3c 23
|
||||||
# jne .L1 ; 100 - 82 = 18 = 0x12
|
# jne .L1
|
||||||
0f 85 12 00 00 00
|
0f 85 15 00 00 00
|
||||||
# (_start+82)
|
# (202)
|
||||||
# ; while (*pos != '\n') pos++;
|
# ; while (*pos != '\n') pos++;
|
||||||
# ; .L2: (_start+82)
|
# ; .L2: (202)
|
||||||
# inc r9
|
# inc r9
|
||||||
49 ff c1
|
49 ff c1
|
||||||
# cmp byte [r9], '\n'
|
# cmp byte [r9], '\n'
|
||||||
41 80 39 0a
|
41 80 39 0a
|
||||||
# jne .L2 ; 82 - 95 = -13 = 0xfffffffffffffff3 = 0xf3
|
# jne .L2
|
||||||
0f 85 f3 ff ff ff
|
0f 85 f3 ff ff ff
|
||||||
# (_start+95)
|
# (215)
|
||||||
# jmp .L0 ; 61 - 100 = -39 = 0xfffffffffffffd89 = 0xfd89
|
# inc r9
|
||||||
e9 89 fd ff ff
|
49 ff c1
|
||||||
# (_start+100)
|
# jmp .L0
|
||||||
# ; .L1: (_start+100)
|
e9 d6 ff ff ff
|
||||||
|
# (223)
|
||||||
|
# ; .L1: (223)
|
||||||
# ; convert *pos to high word
|
# ; convert *pos to high word
|
||||||
|
# mov al, byte [r9]
|
||||||
|
41 8a 01
|
||||||
# mov bl, al
|
# mov bl, al
|
||||||
88 c3
|
88 c3
|
||||||
# sub bl, 'a'
|
# sub bl, 'a'
|
||||||
|
|
@ -162,20 +166,20 @@ c0 e0 04
|
||||||
# mov byte [r10], al
|
# mov byte [r10], al
|
||||||
41 88 02
|
41 88 02
|
||||||
# inc r10
|
# inc r10
|
||||||
41 ff c2
|
49 ff c2
|
||||||
# ; if (*pos != '\n') pos++;
|
|
||||||
# cmp byte [r9], '\n'
|
|
||||||
41 80 39 0a
|
|
||||||
# inc r9
|
# inc r9
|
||||||
49 ff c1
|
49 ff c1
|
||||||
# je .L0 ; 61 - 161 = -100 = 0xffffffffffffff9c = 0x9c
|
# ; if (*pos++ == '\n') goto .L1;
|
||||||
0f 84 9c ff ff ff
|
# cmp byte [r9], '\n'
|
||||||
## (_start+161)
|
41 80 39 0a
|
||||||
# jmp .L1 ; 100 - 166 = -66 = 0xffffffffffffffbe = 0xbe
|
# je .L0
|
||||||
e9 be ff ff ff
|
0f 84 95 ff ff ff
|
||||||
## (_start+166)
|
## (288)
|
||||||
|
# jmp .L1 ; - 293
|
||||||
|
e9 ba ff ff ff
|
||||||
|
## (293)
|
||||||
# ; }
|
# ; }
|
||||||
# .L3: (_start+166)
|
# .L3: (293)
|
||||||
# ; write the decoded bytes to stdout
|
# ; write the decoded bytes to stdout
|
||||||
# mov rax, 1 (sys_write)
|
# mov rax, 1 (sys_write)
|
||||||
48 c7 c0 01 00 00 00
|
48 c7 c0 01 00 00 00
|
||||||
|
|
@ -191,11 +195,11 @@ e9 be ff ff ff
|
||||||
48 29 f2
|
48 29 f2
|
||||||
# syscall
|
# syscall
|
||||||
0f 05
|
0f 05
|
||||||
# jmp .READ ; 10 - 203 = -193 = 0xffffffffffffff3f = 0x3f
|
# jmp .READ ; 130 - 330 = -200 = 0xffffffffffffff38
|
||||||
e9 3f ff ff ff
|
e9 38 ff ff ff
|
||||||
## (_start+203)
|
## (330)
|
||||||
#
|
#
|
||||||
# die: (_start+203)
|
# die: (330)
|
||||||
# mov rax, 60 (sys_exit)
|
# mov rax, 60 (sys_exit)
|
||||||
48 c7 c0 3c 00 00 00
|
48 c7 c0 3c 00 00 00
|
||||||
# xor rdi, rdi
|
# xor rdi, rdi
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue