fill table end question
Consider the following C code
1 # i n c l u d e <s t d i o . h>
2
3 voi d my c a l l e e ( i n t s , i n t e , c h a r buf )
4 {
5 f o r ( ; s<e ; s ++) buf [ s ]= s ;
6 r e t u r n ;
7 }
8
9 voi d my c a l l e r ( void )
10 {
11 i n t i ;
12 c h a r buf [ 1 6 ] ;
13
14 my c a l l e e ( 9 , 1 6 , buf ) ;
15 f o r ( i =0; i <16; i ++) p r i n t f (”%d : %dn ” , i , buf [ i ] ) ;
16 r e t u r n ;
17 }
18
19 i n t main ( void )
20 {
21 my c a l l e r ( ) ;
22 r e t u r n 0 ;
23 }
and the following dissasembly:
1 Dump of assembler code for function mycaller :
2 0 x080483c4 <my c a l l e r +0>: push %ebp
3 0 x080483c5 <my c a l l e r +1>: mov %esp ,%ebp
4 0 x080483c7 <my c a l l e r +3>: sub $0x38 ,%e sp
5 0 x080483ca <my c a l l e r +6>: l e a -0x14(%ebp ) ,%eax
6 0 x080483cd <my c a l l e r +9>: mov %eax , 0 x8(%e sp )
7 0 x080483d1 <my c a l l e r +13>: movl $0x10 , 0 x4(%e sp )
8 0 x080483d9 <my c a l l e r +21>: movl $0x9 ,(% e sp )
9 0 x080483e0 <my c a l l e r +28>: c a l l 0 x80483a4 <myc a l l e e>
10 0 x080483e5 <my c a l l e r +33>: movl $0x0 ,-0x4(%ebp )
11 . . .
Given the above update the memory diagram on the next page assuming the following starting values and execution
up to 0x080483e5:
pc = 0x080483c5
esp = 0xbfffea58
Memory values not updated maybe left blank. Remember that an int value is 4 bytes located with the least significant
byte at the address and the remaining 3 bytes in the successive byte addresses. Eg. If we know that six bytes starting
at 0xbfffec10 is 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 then we would have to write down :
0xbfffec10: 04030201
0xbfffec14: ????0605
Individual bytes of an int that whose value are unknown should be specifed as ??.
Address int hex value Description
0xbfffea5c 0x08048432 return address for call to mycaller
0xbfffea58 0xbfffea68 old frame pointer
0xbfffea54
0xbfffea50
0xbfffea4c
0xbfffea48
0xbfffea44
0xbfffea40
0xbfffea3c
0xbfffea38
0xbfffea34
0xbfffea30
0xbfffea2c
0xbfffea28
0xbfffea24
0xbfffea20
0xbfffea1c
In the descriptions be sure to indicate if an address corresponds to a specific variable and its value or if an address is a return address and its value.