assembly - Why %ebx value is getting corrupted when I try to use it as an exit code? -


my code find largest value:

# %edi - holds current index # %ebx - largest element far # %eax - current element  .section .data      data_items:         .int 3,67,34,222,45,75,65,55,45,35,100,300,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             jle start_loop             movl %eax, %ebx             jmp start_loop     loop_exit:             movl $1,%eax             int $0x80 

the output of code: echo $? getting printed 44. when debug using gdbtui getting value 300 in %ebx. why corrupting value of %ebx while calling program exit interrupt?


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -