Recitation 3 September 25 2006 Donnie Kim Bryant O Hallaron 15 213 Intro to Comp Systems Stack Frame Structure Fill in the missing part of the stack when the given program just entered foo1 by examining the attached C source code and assembly code Assume the two inputs from the user are 2 and 3 0xffffd4cc 0xffffd4c8 0xffffd4c4 0xffffd4c0 0xffffd4bc 0xffffd4b8 0xffffd4b4 0x00000003 0xffffd4b0 0x00000002 0xffffd4ac 0x08048438 0xffffd4a8 0xffffd4d8 0xffffd4a4 foo2 s frame 0xffffd4a0 0xffffd49c ebp 0xffffd498 esp 0xffffd494 0xffffd498 0xffffd49c foo1 s frame C code include stdio h int foo1 int xp int yp int x xp int y yp xp y yp x return x y int foo2 int x int y int sum foo1 x y int dif x y return dif sum int main void int x y int val scanf d d x y val foo2 x y printf val d n val return 0 ASM code 080483b0 foo1 80483b0 55 80483b1 89 e5 80483b3 53 80483b4 8b 4d 08 80483b7 8b 5d 0c 80483ba 8b 01 80483bc 8b 13 80483be 89 11 80483c0 89 03 80483c2 01 d0 80483c4 5b 80483c5 c9 80483c6 c3 80483c7 89 f6 80483c9 8d bc 27 00 00 00 00 push mov push mov mov mov mov mov mov add pop leave ret mov lea ebp esp ebp ebx 0x8 ebp ecx 0xc ebp ebx ecx eax ebx edx edx ecx eax ebx edx eax ebx esi esi 0x0 edi edi 080483d0 foo2 80483d0 55 80483d1 89 e5 80483d3 83 ec 80483d6 8d 45 80483d9 89 44 80483dd 8d 45 80483e0 89 04 80483e3 e8 c8 80483e8 89 c2 80483ea 8b 45 80483ed 2b 45 80483f0 c9 80483f1 0f af 80483f4 c3 80483f5 8d 74 80483f9 8d bc 08048400 main 8048400 55 8048401 89 e5 8048403 83 ec 8048406 8d 45 8048409 83 e4 804840c 83 ec 804840f 89 44 8048413 8d 45 8048416 c7 04 804841d 89 44 8048421 e8 9e 8048426 8b 45 8048429 89 44 804842d 8b 45 8048430 89 04 8048433 e8 98 8048438 c7 04 804843f 89 44 8048443 e8 9c 8048448 c9 8048449 31 c0 804844b c3 08 0c 24 04 08 24 ff ff ff 08 0c c2 26 00 27 00 00 00 00 18 fc f0 10 24 f8 24 24 fe fc 24 f8 24 ff 24 24 fe 08 3c 85 04 08 04 ff ff 04 ff ff 42 85 04 08 04 ff ff push mov sub lea mov lea mov call mov mov sub leave imul ret lea lea ebp esp ebp 0x8 esp 0xc ebp eax eax 0x4 esp 0x8 ebp eax eax esp 80483b0 foo1 eax edx 0x8 ebp eax 0xc ebp eax push mov sub lea and sub mov lea movl mov call mov mov mov mov call movl mov call leave xor ret ebp esp ebp 0x18 esp 0xfffffffc ebp eax 0xfffffff0 esp 0x10 esp eax 0x8 esp 0xfffffff8 ebp eax 0x804853c esp eax 0x4 esp 80482c4 scanf plt 0xfffffffc ebp eax eax 0x4 esp 0xfffffff8 ebp eax eax esp 80483d0 foo2 0x8048542 esp eax 0x4 esp 80482e4 printf plt edx eax 0x0 esi esi 0x0 edi edi eax eax
View Full Document