This preview shows page 1. Sign up to view the full content.
Unformatted text preview: nstructions follow each other in the order they are listed. A jump instruction can cause the execution to switch to a completely new position in the program. These jump destinations are generally indicated by a label. Consider the following assembly code sequence:
1 2 3 4 5 xorl %eax,%eax jmp .L1 movl (%eax),%edx .L1: popl %edx Set %eax to 0 Goto .L1 Null pointer dereference The instruction jmp .L1 will cause the program to skip over the movl instruction and instead resume execution with the popl instruction. In generating the object code ﬁle, the assembler determines the addresses of all labeled instructions and encodes the jump targets (the addresses of the destination instructions) as part of the jump instructions. The jmp instruction jumps unconditionally. It can be either a direct jump, where the jump target is encoded as part of the instruction, or an indirect jump, where the jump target is read from a register or a memory location. Direct jumps are written in assembly by giving a label as the jump target, e.g., the label “.L1” in the code above. Indirect jumps a...
View Full Document