C 734 problem 1010 solution pg 545 appendix b

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: --------+ | 31 30 39 38 | +-------------+ | 37 36 35 34 | +-------------+ | 33 32 31 30 | +-------------+ Return Address Saved %ebp <-- %ebp buf[4-7] buf[0-3] C. The program is attempting to return to address 0x08048600. The low-order byte was overwritten by the terminating null character. D. The saved value of register %ebp was changed to 0x31303938, and this will be loaded into the register before getline returns. The other saved registers are not affected, since they are saved on the stack at lower addresses than buf. E. The call to malloc should have had strlen(buf)+1 as its argument, and it should also check that the returned value is non-null. Problem 3.25 Solution: [Pg. 178] This problem gives you a chance to try out the recursive procedure described in 3.14.3. B.3. MACHINE LEVEL REPRESENTATION OF C PROGRAMS 713 1 ´ · ¡ ¡ ¡ ¡ µ %st(2) %st(1) %st(0) load c %st(0) 8 load b ´ · µ %st(3) %st(2) %st(1) %st(1) 2 load b %st(0) 9 load a %st(0) µ 3 multp ¡ ¡ ´ · %st(2) %st(1) %st(0) %st(0) 10 %st(1) %st(0) 11 mult...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online