4918
5880
3万
GROAD
曲径通幽,安觅芳踪。
sub source, destination
.section .data data: .int 40 .section .text .global _start _start: nop movl $0, %eax movl $0, %ebx movl $0, %ecx movb $20, %al subb $10, %al movsx %al, %eax movw $100, %cx subw %cx, %bx movsx %bx, %ebx movl $100, %edx subl %eax, %edx subl data, %eax subl %eax, data movl $1, %eax movl $0, %ebx int $0x80
(gdb) print $eax $1 = -30 (gdb) x/d &data 0x80490b4 <data>: 70
使用道具 举报
.section .text .global _start _start: nop movl $5, %eax movl $2, %ebx subl %eax, %ebx jc under movl $1, %eax int $0x80 under: movl $0, %ebx movl $1, %eax int $0x80
$ ./sub2 $ echo $? 0
(gdb) print $ebx $1 = -3
.section .data output: .asciz "The result is %d\\n" .section .text .global _start _start: movl $-1590876934, %ebx movl $1259230143, %eax subl %eax, %ebx jo over pushl %ebx pushl $output call printf add $8, %esp pushl $0 call exit over: pushl $0 pushl $output call printf add $8, %esp pushl $0 call exit
$ as -gstabs -o sub3.o sub3.s $ ld -dynamic-linker /lib/ld-linux.so.2 -lc -o sub3 sub3.o $ ./sub3 The result is 0
$ ./sub3 The result is -331646791
sbb source, destination
.section .data data1: .quad 7252051615 data2: .quad 5732348928 output: .asciz "The result is %qd\\n" .section .text .global _start _start: nop movl data1, %ebx movl data1+4, %eax movl data2, %edx movl data2+4, %ecx subl %ebx, %edx sbbl %eax, %ecx pushl %ecx pushl %edx pushl $output call printf add $12, %esp pushl $0 call exit
$ ./sbb The result is -1519702687
eax 0x1 1 ecx 0xffffffff -1 edx 0xa56b2d61 -1519702687 ebx 0xb041869f -1337882977
dec destination inc destination
本版积分规则 发表回复 回帖后跳转到最后一页
小黑屋|手机版|Archiver|曲径通幽 ( 琼ICP备11001422号-1|公安备案:46900502000207 )
GMT+8, 2026-1-11 06:49 , Processed in 0.074573 second(s), 21 queries .
Powered by Discuz! X3.2
© 2001-2013 Comsenz Inc.