126 for loops chapter 3 machine level representation

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: 0x10 for instruction 7. Looking at the byte encodings of the instructions, however, we see that the target of jump instruction 1 is encoded (in the second byte) as 0x11 (decimal 17). Adding this to 0xa (decimal 10), the address of the following instruction, we get jump target address 0x1b (decimal 27), the address of instruction 8. Similarly, the target of jump instruction 7 is encoded as 0xf5 (decimal ½½) using a single-byte, two’s complement representation. Adding this to 0x1b (decimal 27), the address of instruction 8, we get 0x10 (decimal 16), the address of instruction 3. The following shows the disassembled version of the program after linking: 1 2 3 4 5 6 7 8 80483c8: 80483ca: 80483d0: 80483d2: 80483d5: 80483d7: 80483d9: 80483db: 7e 8d 89 c1 29 85 7f 89 11 b6 00 00 00 00 d0 f8 01 c2 d2 f5 d0 jle lea mov sar sub test jg mov 80483db <silly+0x1b> 0x0(%esi),%esi %edx,%eax $0x1,%eax %eax,%edx %edx,%edx 80483d0 <silly+0x10> %edx,%eax The instructions have been relocated to different addresses, but the encodings of the jump targets in lines 1 and 7 remain unchanged. By using a PC-relative encoding of the jump targets, the instructions ca...
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