📄 main.s
字号:
.file "main.c" .section .rodata.LC0: .string "error: loss '('\n".LC1: .string "error: loss ')'\n" .align 4.LC2: .string "error: invalid operand size cast\n".LC3: .string "error: illegal prefix\n".LC4: .string "error: loss '['\n".LC5: .string "error: loss ']'\n" .align 4.LC6: .string "error: illegal base or index register\n" .align 4.LC7: .string "error: illegal index register\n".LC8: .string "error: illegal scale value\n" .align 4.LC9: .string "error: illegal displacement value\n".LC10: .string "error: illegal operand\n" .align 4.LC11: .string "error: invalid immediate value\n" .align 4.LC12: .string "error: illegal memory offset value\n" .align 4.LC13: .string "error: illegal operand address mode\n" .align 4.LC14: .string "error: illegal register value\n".LC15: .string "error: invalid operand size\n".LC16: .string "".LC17: .string "error: illegal character\n" .data .align 32 .type ops_errmsg, @object .size ops_errmsg, 72ops_errmsg: .long .LC0 .long .LC1 .long .LC2 .long .LC3 .long .LC4 .long .LC5 .long .LC6 .long .LC7 .long .LC8 .long .LC9 .long .LC10 .long .LC11 .long .LC12 .long .LC13 .long .LC14 .long .LC15 .long .LC16 .long .LC17 .section .rodata.LC18: .string "error: error at label\n".LC19: .string "error: rep define label\n".LC20: .string "error: illegel instruction\n" .align 4.LC21: .string "error: error at line or cannot analyse line\n" .data .align 4 .type line_errmsg, @object .size line_errmsg, 16line_errmsg: .long .LC18 .long .LC19 .long .LC20 .long .LC21 .section .rodata.LC22: .string "help".LC23: .string "verbose".LC24: .string "f".LC25: .string "o".LC26: .string "print-encode".LC27: .string "v".globl opts .data .align 32 .type opts, @object .size opts, 56opts: .long .LC22 .long 0 .long .LC23 .long 0 .long .LC24 .long 1 .long .LC25 .long 1 .long .LC26 .long 0 .long .LC27 .long 0 .long 0 .long 0 .section .rodata .align 4.LC28: .string "author: mik \te-mail: mikdeng@163.com".LC29: .string "\t****** %s ******\n".LC30: .string "usage: \n".LC31: .string "\ta64 [option] <source file>\n".LC32: .string "\ta64 --help for get help\n\n" .text .type usage, @functionusage: pushl %ebp movl %esp, %ebp subl $8, %esp subl $4, %esp pushl $.LC28 pushl $.LC29 pushl stdout call fprintf addl $16, %esp subl $8, %esp pushl $.LC30 pushl stdout call fprintf addl $16, %esp subl $8, %esp pushl $.LC31 pushl stdout call fprintf addl $16, %esp subl $8, %esp pushl $.LC32 pushl stdout call fprintf addl $16, %esp leave ret .size usage, .-usage .section .rodata.LC33: .string "\n--help \t\t\tfor get help\n" .align 4.LC34: .string "--verbose \t\tfor get a64 information\n" .align 4.LC35: .string "-f <object-format> \tfor get object-format's out-object\n" .align 4.LC36: .string "-o <object-name> \tfor get object-name's out-object\n\n" .text .type help, @functionhelp: pushl %ebp movl %esp, %ebp subl $8, %esp subl $4, %esp pushl $.LC28 pushl $.LC29 pushl stdout call fprintf addl $16, %esp subl $8, %esp pushl stdout pushl $.LC33 call fputs addl $16, %esp subl $8, %esp pushl stdout pushl $.LC34 call fputs addl $16, %esp subl $8, %esp pushl stdout pushl $.LC35 call fputs addl $16, %esp subl $8, %esp pushl stdout pushl $.LC36 call fputs addl $16, %esp leave ret .size help, .-help .section .rodata .align 4.LC37: .string "bad option !!!\n%s --help \t\tfor get help\n" .align 4.LC38: .string "the source file isn't valid assemble source file\n" .align 4.LC39: .string "a64: 64-bit assembler for x86-64".LC40: .string "\t%s\n".LC41: .string "version id: 0.1-1-1-0.1".LC42: .string "out file failed!\n".LC43: .string "%x ".LC44: .string "\n" .text.globl main .type main, @functionmain: pushl %ebp movl %esp, %ebp pushl %ebx subl $16484, %esp andl $-16, %esp movl $0, %eax addl $15, %eax addl $15, %eax shrl $4, %eax sall $4, %eax subl %eax, %esp movl $1, -12(%ebp) movl $0, -16(%ebp) movl $0, -20(%ebp) movl $0, -24(%ebp) movl $0, -28(%ebp) movl $0, -32(%ebp) cmpl $1, 8(%ebp) jg .L4 call usage subl $12, %esp pushl $1 call exit.L4: movl 12(%ebp), %eax movl (%eax), %eax movl %eax, program_name.L5: movl -12(%ebp), %eax cmpl 8(%ebp), %eax jge .L6 subl $4, %esp pushl $opts pushl 12(%ebp) pushl -12(%ebp) call parse_option addl $16, %esp movl %eax, -16472(%ebp) cmpl $1, -16472(%ebp) je .L14 cmpl $1, -16472(%ebp) jg .L25 cmpl $-1, -16472(%ebp) je .L9 cmpl $-1, -16472(%ebp) jg .L13 cmpl $-2147483648, -16472(%ebp) je .L10 jmp .L7.L25: cmpl $4, -16472(%ebp) je .L23 cmpl $4, -16472(%ebp) jg .L26 cmpl $3, -16472(%ebp) je .L16 jmp .L7.L26: cmpl $5, -16472(%ebp) je .L24 jmp .L7.L9: subl $4, %esp pushl program_name pushl $.LC37 pushl stderr call fprintf addl $16, %esp subl $12, %esp pushl $1 call exit.L10: movl -16(%ebp), %eax movl %eax, %ecx movl -12(%ebp), %eax leal 0(,%eax,4), %edx movl 12(%ebp), %eax movl (%edx,%eax), %eax movl %eax, read_fname(,%ecx,4) leal -16(%ebp), %eax incl (%eax) movl -20(%ebp), %ebx subl $12, %esp pushl $80 call a64_malloc addl $16, %esp movl %eax, write_fname(,%ebx,4) subl $8, %esp movl -12(%ebp), %eax leal 0(,%eax,4), %edx movl 12(%ebp), %eax pushl (%edx,%eax) movl -20(%ebp), %eax pushl write_fname(,%eax,4) leal -20(%ebp), %eax incl (%eax) call do_parse_file addl $16, %esp testl %eax, %eax je .L7 subl $8, %esp pushl $.LC38 pushl stderr call fprintf addl $16, %esp movl -20(%ebp), %eax cmpl $0, write_fname-4(,%eax,4) je .L12 subl $12, %esp movl -20(%ebp), %eax pushl write_fname-4(,%eax,4) call a64_free addl $16, %esp.L12: subl $12, %esp pushl $1 call exit.L13: call help subl $12, %esp pushl $1 call exit.L14: subl $4, %esp pushl $.LC28 pushl $.LC29 pushl stdout call fprintf addl $16, %esp subl $4, %esp pushl $.LC39 pushl $.LC40 pushl stdout call fprintf addl $16, %esp subl $4, %esp pushl $.LC41 pushl $.LC40 pushl stdout call fprintf addl $16, %esp jmp .L7.L16: movl $1, -28(%ebp) cmpl $1, -16(%ebp) jle .L17 subl $8, %esp pushl $.LC42 pushl stderr call fprintf addl $16, %esp movl $0, -16468(%ebp).L18: movl -16468(%ebp), %eax cmpl -16(%ebp), %eax jge .L19 movl -16468(%ebp), %eax cmpl $0, write_fname(,%eax,4) je .L20 subl $12, %esp movl -16468(%ebp), %eax pushl write_fname(,%eax,4) call a64_free addl $16, %esp.L20: leal -16468(%ebp), %eax incl (%eax) jmp .L18.L19: subl $12, %esp pushl $1 call exit.L17: movl -20(%ebp), %eax cmpl $0, write_fname-4(,%eax,4) je .L22 subl $12, %esp movl -20(%ebp), %eax pushl write_fname-4(,%eax,4) call a64_free addl $16, %esp.L22: movl -20(%ebp), %ecx leal -12(%ebp), %eax incl (%eax) movl -12(%ebp), %eax leal 0(,%eax,4), %edx movl 12(%ebp), %eax movl (%edx,%eax), %eax movl %eax, write_fname-4(,%ecx,4) jmp .L7.L23: movl $1, -24(%ebp) jmp .L7.L24: subl $4, %esp pushl $.LC41 pushl $.LC40 pushl stdout call fprintf addl $16, %esp.L7: leal -12(%ebp), %eax incl (%eax) jmp .L5.L6: movl $0, -12(%ebp).L27: movl -12(%ebp), %eax cmpl -16(%ebp), %eax jge .L28 subl $8, %esp pushl $0 movl -12(%ebp), %eax pushl read_fname(,%eax,4) call open addl $16, %esp movl %eax, -16460(%ebp) subl $4, %esp pushl $436 pushl $577 movl -12(%ebp), %eax pushl write_fname(,%eax,4) call open addl $16, %esp
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -