I'm doing this project and this particular portion is confusing me. We are given this machine level representation and it will read six numbers that I have to figure out. So far I know that this is a loop and it will iterate until it reaches it's stop clause. We do not want it to ever make the call to explode at 0x08048d3a : call 0x80492f3 . Does anyone know what six numbers are going to be generated. Any help is greatly appreciated.
0x08048d0b <phase_2+0>: push %ebp
0x08048d0c <phase_2+1>: mov %esp,%ebp
0x08048d0e <phase_2+3>: push %esi
0x08048d0f <phase_2+4>: push %ebx
0x08048d10 <phase_2+5>: sub $0x30,%esp
0x08048d13 <phase_2+8>: lea -0x20(%ebp),%eax
0x08048d16 <phase_2+11>: mov %eax,0x4(%esp)
0x08048d1a <phase_2+15>: mov 0x8(%ebp),%eax
0x08048d1d <phase_2+18>: mov %eax,(%esp)
0x08048d20 <phase_2+21>: call 0x8049335 <read_six_numbers>
0x08048d25 <phase_2+26>: mov $0x2,%ebx
0x08048d2a <phase_2+31>: lea -0x20(%ebp),%esi
0x08048d2d <phase_2+34>: mov -0x8(%esi,%ebx,4),%eax
0x08048d31 <phase_2+38>: add $0x5,%eax
0x08048d34 <phase_2+41>: cmp %eax,-0x4(%esi,%ebx,4)
0x08048d38 <phase_2+45>: je 0x8048d3f <phase_2+52>
0x08048d3a <phase_2+47>: call 0x80492f3 <explode_bomb>
0x08048d3f <phase_2+52>: add $0x1,%ebx
0x08048d42 <phase_2+55>: cmp $0x7,%ebx
0x08048d45 <phase_2+58>: jne 0x8048d2d <phase_2+34>
0x08048d47 <phase_2+60>: add $0x30,%esp
0x08048d4a <phase_2+63>: pop %ebx
0x08048d4b <phase_2+64>: pop %esi
0x08048d4c <phase_2+65>: pop %ebp
0x08048d4d <phase_2+66>: ret
Specifically can you explain what happens at these lines
0x08048d10 <phase_2+5>: sub $0x30,%esp
0x08048d13 <phase_2+8>: lea -0x20(%ebp),%eax
0x08048d16 <phase_2+11>: mov %eax,0x4(%esp)
0x08048开发者_如何学Pythond1a <phase_2+15>: mov 0x8(%ebp),%eax
0x08048d1d <phase_2+18>: mov %eax,(%esp)
Thank you!!
This AT&T syntax confuses me, but this part is simple:
0x08048d10 <phase_2+5>: sub $0x30,%esp //reserve additional 0x30bytes 12 ints) on the stack
0x08048d13 <phase_2+8>: lea -0x20(%ebp),%eax // int vals[6]; eax = vals;
0x08048d16 <phase_2+11>: mov %eax,0x4(%esp) // int some_local_var = vals;
0x08048d1a <phase_2+15>: mov 0x8(%ebp),%eax // first param we received
0x08048d1d <phase_2+18>: mov %eax,(%esp) // pass it as param to function
0x08048d20 <phase_2+21>: call 0x8049335 <read_six_numbers>
char answer[6];
answer[0] = any_char
for n > 0
answer[n] = answer[n-1] + 5;
精彩评论