www.pudn.com > ASM86_64.rar > 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, 72
ops_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, 16
line_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, 56
opts:
.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] \n"
.LC32:
.string "\ta64 --help for get help\n\n"
.text
.type usage, @function
usage:
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 \tfor get object-format's out-object\n"
.align 4
.LC36:
.string "-o \tfor get object-name's out-object\n\n"
.text
.type help, @function
help:
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, @function
main:
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
movl %eax, -16464(%ebp)
subl $8, %esp
leal -8248(%ebp), %eax
pushl %eax
pushl -16460(%ebp)
call init_iob
addl $16, %esp
subl $8, %esp
leal -16456(%ebp), %eax
pushl %eax
pushl -16464(%ebp)
call init_iob
addl $16, %esp
subl $12, %esp
leal -8248(%ebp), %eax
pushl %eax
call analyse_file
addl $16, %esp
movl %eax, -32(%ebp)
cmpl $0, -32(%ebp)
je .L30
call print_err
call release_resource
subl $12, %esp
pushl $1
call exit
.L30:
subl $12, %esp
leal -16456(%ebp), %eax
pushl %eax
call generate
addl $16, %esp
movl %eax, -32(%ebp)
cmpl $0, -32(%ebp)
je .L31
call print_err
call release_resource
subl $12, %esp
pushl $1
call exit
.L31:
cmpl $0, -24(%ebp)
je .L32
movl $0, -16468(%ebp)
.L33:
movl -16468(%ebp), %eax
movl %eax, -16480(%ebp)
cltd
movl %edx, -16476(%ebp)
movl -16476(%ebp), %eax
cmpl current_pc+4, %eax
ja .L34
movl -16476(%ebp), %edx
cmpl current_pc+4, %edx
jb .L35
movl -16480(%ebp), %eax
cmpl current_pc, %eax
jae .L34
.L35:
subl $8, %esp
movl -16468(%ebp), %eax
leal -8(%ebp), %edx
addl %edx, %eax
subl $16432, %eax
movb (%eax), %al
andl $255, %eax
pushl %eax
leal -16468(%ebp), %eax
incl (%eax)
pushl $.LC43
call printf
addl $16, %esp
jmp .L33
.L34:
subl $12, %esp
pushl $.LC44
call printf
addl $16, %esp
.L32:
subl $12, %esp
leal -16456(%ebp), %eax
pushl %eax
call flush_all_iob
addl $16, %esp
cmpl $0, -28(%ebp)
jne .L36
movl -16(%ebp), %eax
cmpl $0, write_fname(,%eax,4)
je .L36
subl $12, %esp
movl -16(%ebp), %eax
pushl write_fname(,%eax,4)
call a64_free
addl $16, %esp
.L36:
call release_resource
call reset_environment
subl $12, %esp
pushl -16460(%ebp)
call close
addl $16, %esp
subl $12, %esp
pushl -16464(%ebp)
call close
addl $16, %esp
leal -12(%ebp), %eax
incl (%eax)
jmp .L27
.L28:
movl $0, %eax
movl -4(%ebp), %ebx
leave
ret
.size main, .-main
.section .rodata
.LC45:
.string "s"
.LC46:
.string "asm"
.text
.type do_parse_file, @function
do_parse_file:
pushl %ebp
movl %esp, %ebp
subl $120, %esp
movl $0, -12(%ebp)
movl $0, -108(%ebp)
movl $1, -112(%ebp)
.L39:
subl $12, %esp
movl 12(%ebp), %eax
movsbl (%eax),%eax
pushl %eax
call is_c
addl $16, %esp
testl %eax, %eax
jne .L43
subl $12, %esp
movl 12(%ebp), %eax
movsbl (%eax),%eax
pushl %eax
call is_n
addl $16, %esp
testl %eax, %eax
jne .L43
movl 12(%ebp), %eax
cmpb $95, (%eax)
je .L43
jmp .L42
.L43:
cmpl $79, -108(%ebp)
jle .L44
movl $65536, -116(%ebp)
jmp .L38
.L44:
movl -108(%ebp), %eax
leal -8(%ebp), %edx
addl %edx, %eax
leal -96(%eax), %edx
movl 12(%ebp), %eax
movb (%eax), %al
movb %al, (%edx)
leal -108(%ebp), %eax
incl (%eax)
jmp .L41
.L42:
movl 12(%ebp), %eax
movsbl (%eax),%eax
movl %eax, -120(%ebp)
cmpl $0, -120(%ebp)
je .L48
cmpl $46, -120(%ebp)
je .L47
jmp .L52
.L47:
movl $0, -112(%ebp)
leal -104(%ebp), %eax
addl -108(%ebp), %eax
movb $0, (%eax)
subl $8, %esp
leal -104(%ebp), %eax
pushl %eax
pushl 8(%ebp)
call strcpy
addl $16, %esp
movl $0, -108(%ebp)
jmp .L41
.L48:
leal -104(%ebp), %eax
addl -108(%ebp), %eax
movb $0, (%eax)
cmpl $0, -112(%ebp)
je .L49
movl $65536, -12(%ebp)
.L49:
cmpl $0, -108(%ebp)
je .L51
subl $8, %esp
pushl $.LC45
leal -104(%ebp), %eax
pushl %eax
call str_cmp
addl $16, %esp
testl %eax, %eax
jne .L50
subl $8, %esp
pushl $.LC46
leal -104(%ebp), %eax
pushl %eax
call str_cmp
addl $16, %esp
testl %eax, %eax
jne .L50
.L51:
movl $65536, -12(%ebp)
.L50:
movl -12(%ebp), %eax
movl %eax, -116(%ebp)
jmp .L38
.L52:
movl $65536, -116(%ebp)
jmp .L38
.L41:
leal 12(%ebp), %eax
incl (%eax)
jmp .L39
.L38:
movl -116(%ebp), %eax
leave
ret
.size do_parse_file, .-do_parse_file
.comm i_transfer,264,32
.comm i_set,1752,32
.comm add,220,32
.comm push,360,32
.comm pop,300,32
.comm or,220,32
.comm adc,220,32
.comm sbb,220,32
.comm and,220,32
.comm daa,40,32
.comm sub,220,32
.comm das,40,32
.comm xor,220,32
.comm aaa,40,32
.comm cmp,220,32
.comm aas,40,32
.comm inc,220,32
.comm dec,220,32
.comm pusha,40,32
.comm popa,40,32
.comm bound,40,32
.comm arpl,40,32
.comm movsxd,40,32
.comm imul,120,32
.comm insb,40,32
.comm insw,40,32
.comm insd,40,32
.comm outsb,40,32
.comm outsw,40,32
.comm outsd,40,32
.comm jo,60,32
.comm jno,60,32
.comm jb,60,32
.comm jnb,60,32
.comm jz,60,32
.comm jnz,60,32
.comm jbe,60,32
.comm jnbe,60,32
.comm js,60,32
.comm jns,60,32
.comm jp,60,32
.comm jnp,60,32
.comm jl,60,32
.comm jnl,60,32
.comm jle,60,32
.comm jnle,60,32
.comm test,180,32
.comm xchg,220,32
.comm mov,840,32
.comm lea,40,32
.comm nop,40,32
.comm cbw,40,32
.comm cwde,40,32
.comm cdqe,40,32
.comm cwd,40,32
.comm cdq,40,32
.comm cqo,40,32
.comm call,100,32
.comm wait,40,32
.comm fwait,40,32
.comm pushf,40,32
.comm pushd,60,32
.comm pushq,40,32
.comm popf,40,32
.comm popd,60,32
.comm popq,40,32
.comm sahf,40,32
.comm lahf,40,32
.comm movsb,40,32
.comm movsw,40,32
.comm movsd,40,32
.comm movsq,40,32
.comm cmpsb,40,32
.comm cmpsw,40,32
.comm cmpsd,40,32
.comm cmpsq,40,32
.comm stosb,40,32
.comm stosw,40,32
.comm stosd,40,32
.comm stosq,40,32
.comm lodsb,40,32
.comm lodsw,40,32
.comm lodsd,40,32
.comm lodsq,40,32
.comm scasb,40,32
.comm scasw,40,32
.comm scasd,40,32
.comm scasq,40,32
.comm ret,100,32
.comm les,40,32
.comm lds,40,32
.comm enter,40,32
.comm leave,40,32
.comm int_3,40,32
.comm int_n,40,32
.comm into,40,32
.comm iret,40,32
.comm iretd,40,32
.comm iretq,40,32
.comm loopnz,40,32
.comm loopz,40,32
.comm loop,40,32
.comm jrcxz,40,32
.comm in,100,32
.comm out,100,32
.comm jmp,120,32
.comm int1,40,32
.comm hlt,40,32
.comm cmc,40,32
.comm clc,40,32
.comm stc,40,32
.comm cli,40,32
.comm sti,40,32
.comm cld,40,32
.comm std,40,32
.comm rol,140,32
.comm ror,140,32
.comm rcl,140,32
.comm rcr,140,32
.comm shl,260,32
.comm sal,4,4
.comm shr,140,32
.comm sar,140,32
.comm not,60,32
.comm neg,60,32
.comm mul,60,32
.comm div,60,32
.comm idiv,60,32
.comm sldt,40,32
.comm str,40,32
.comm lldt,40,32
.comm ltr,40,32
.comm verr,40,32
.comm verw,40,32
.comm sgdt,40,32
.comm sidt,40,32
.comm lgdt,40,32
.comm lidt,40,32
.comm smsw,40,32
.comm lmsw,40,32
.comm invlpg,40,32
.comm swapgs,40,32
.comm lfence,40,32
.comm mfence,40,32
.comm sfence,40,32
.comm bt,60,32
.comm bts,60,32
.comm btr,60,32
.comm btc,60,32
.comm cpuid,40,32
.comm seto,40,32
.comm setno,40,32
.comm setb,40,32
.comm setnb,40,32
.comm setz,40,32
.comm setnz,40,32
.comm setbe,40,32
.comm setnbe,40,32
.comm movzx,60,32
.comm sets,40,32
.comm setns,40,32
.comm setp,40,32
.comm setnp,40,32
.comm setl,40,32
.comm setnl,40,32
.comm setle,40,32
.comm setnle,40,32
.comm rsm,40,32
.comm shrd,60,32
.comm bsf,40,32
.comm bsr,40,32
.comm movsx,60,32
.comm lar,40,32
.comm lal,40,32
.comm sys_call,40,32
.comm clts,40,32
.comm sysret,40,32
.comm wrmsr,40,32
.comm rdtsc,40,32
.comm rdmsr,40,32
.comm rdpmc,40,32
.comm sysenter,40,32
.comm sysexit,40,32
.comm cmovo,40,32
.comm cmovno,40,32
.comm cmovb,40,32
.comm cmovnb,40,32
.comm cmovz,40,32
.comm cmovnz,40,32
.comm cmovbe,40,32
.comm cmovnbe,40,32
.comm cmovs,40,32
.comm cmovns,40,32
.comm cmovp,40,32
.comm cmovnp,40,32
.comm cmovl,40,32
.comm cmovnl,40,32
.comm cmovle,40,32
.comm cmovnle,40,32
.comm lss,40,32
.comm lfs,40,32
.comm lgs,40,32
.comm cmpxchg,60,32
.comm bswap,180,32
.comm regs,1048,32
.comm osegs,56,32
.comm scales,40,32
.comm casts,40,32
.comm i_prefixs,56,32
.comm keyword,128,32
.comm modes,48,32
.comm bits,32,32
.comm current_mode,4,4
.comm current_bits,4,4
.comm current_pc,8,8
.comm org,8,8
.comm line,4,4
.comm e_key_link,4,4
.local program_name
.comm program_name,4,4
.local read_fname
.comm read_fname,40,32
.local write_fname
.comm write_fname,40,32
.section .note.GNU-stack,"",@progbits
.ident "GCC: (GNU) 3.4.3"