Ich schrieb diese grundlegende Linux x86 Assembly App. Ich erwarte, dass es zurückgibt, wenn ich echo $?
mache, aber der Status ist immer . Was mache ich falsch?Basic Linux x86 Montage Mindestzahl falsch zurück
.section .data
data_items:
.long 3,67,34,222,45,2,54,34,44,33,22,11,66,0
.section .text
.global _start
_start:
movl $0, %edi
movl data_items(,%edi,4), %eax
movl %eax, %ebx
start_loop:
cmpl $0, %eax
je loop_exit
incl %edi
movl data_items(,%edi,4), %eax
cmpl %ebx, %eax
jge start_loop
movl %eax, %ebx
jmp start_loop
loop_exit:
movl $1, %eax
int $0x80
Hinweis: %ebx
enthält immer den Statuscode, und es sollte den minimalen Wert von Ausgangszeit enthalten.
Korrigiert:
_start:
movl $0, %edi
movl data_items(,%edi,4), %ebx
start_loop:
incl %edi
movl data_items(, %edi, 4), %eax
cmpl $0, %eax
je loop_exit
cmpl %ebx, %eax
jge start_loop
movl %eax, %ebx
Sie haben natürlich Recht! Ich hoffe, dass das Buch, das ich lese, bald debuggt. – sprocket12