我对这段代码非常困惑:
.section .data
value1:
.ascii "This is a test string"
value2:
.ascii "This is a test String"
.section .text
.globl main
main:
movl $1, %eax
leal value1, %esi
leal value2, %edi
movl $21, %ecx
cld
repe cmpsb
je equal
movl %ecx, %ebx
int $0x80
equal:
movl $0, %ebx
int $0x80
输出如下:
es@elegy:~/ATT$ ./cmpstest2
es@elegy:~/ATT$ echo $?
5
为什么ECX包含5个?我期待15,从字符串的开头算起。