简体   繁体   中英

interpreting assembly instructions

I am trying to translate the following:

Action:
 pushl %ebp
 movl %esp, %eax
 subl $0x32, %esp
 movl $0x0, -0x8(%eax)
 movl $0x0, -0x4(%eax)
 movl -0x4(%eax), %eax
 cmpl $0x32(%eax), %ebp
 movl -0x4(%ebp), %eax
 sall $0x2, %ebp
 addl 0x8(%ebp), %ebp
 movl (%ebp), %ebp
 addl %ebp, -0x8(%eax)
 addl $0x1, -0x4(%eax)

What is the best way to translate this code?

For the original question:

mov     -0x4(%ebp), %eax       # eax = z;
mov     0xc(%ebp), %edx        # edx = y;
mov     (%edx, %eax, 4), %eax  # eax = *(edx + eax + 4)
add     $0x3, %eax             # eax += 3
movb    $0x41, (%eax)          # *eax = 'A'

Dry-running the statements give:

y[z + 4][3] = 'A';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM