2

I have a simple c code which is compiled and then the text code extracted using objdump utility. here is the dump file (A piece of dumped file):

0804841b <main>:
 804841b:   8d 4c 24 04             lea    0x4(%esp),%ecx
 804841f:   83 e4 f0                and    $0xfffffff0,%esp
 8048422:   ff 71 fc                pushl  -0x4(%ecx)
 8048425:   55                      push   %ebp
 8048426:   89 e5                   mov    %esp,%ebp
 8048428:   51                      push   %ecx
 8048429:   83 ec 14                sub    $0x14,%esp
 804842c:   c7 45 f0 00 00 00 00    movl   $0x0,-0x10(%ebp)
 8048433:   c7 45 f4 0a 00 00 00    movl   $0xa,-0xc(%ebp)
 804843a:   8b 45 f4                mov    -0xc(%ebp),%eax
 804843d:   01 45 f0                add    %eax,-0x10(%ebp)
 8048440:   8b 45 f0                mov    -0x10(%ebp),%eax
 8048443:   3b 45 f4                cmp    -0xc(%ebp),%eax

 8048446:   7e 0f                   jle    8048457 <main+0x3c>

 8048448:   83 ec 0c                sub    $0xc,%esp
 804844b:   6a 78                   push   $0x78
 804844d:   e8 be fe ff ff          call   8048310 <putchar@plt>
 8048452:   83 c4 10                add    $0x10,%esp
 8048455:   eb 15                   jmp    804846c <main+0x51>
 8048457:   8b 45 f4                mov    -0xc(%ebp),%eax
 804845a:   3b 45 f0                cmp    -0x10(%ebp),%eax
 804845d:   7e 0d                   jle    804846c <main+0x51>

the instruction at address 8048446 is jle 8048457 <main+0x3c> which has the machine code 7e 0f

the <main+0x3c> statement is refer to the location of target instruction shifted from the main address, i.e. the 3c is equal 60 which mean that after 60 bytes from the main, the instruction

8048457:   8b 45 f4                mov    -0xc(%ebp),%eax

is located. The machine code of the instruction at address 8048446 is 7e 0f
7e is the machine code of jle. The 0f what is?

In another branch instruction like this:

 8048455:   eb 15                   jmp    804846c <main+0x51>

what is 15 means?

  • Are asking what the op-codes mean, or are you asking how to change the machine code? Maybe update the title of the question. – U. Windl May 14 at 7:59
  • @U.Windl, yes, you are right... thank you for your suggestion. – husin alhaj ahmade May 15 at 18:17
1

There are absolute jumps/code branching and relative jumps in the Intel CPU architecture.

What you are showing us are relative operand opcode jumps. They have been historically used to save code size.

When you ask what 0f is, it means jumping the current PC at the end of the current instruction being executed + 0f. So 8048448+0f = 8048457, hence the assembly listing showing jle 8048457 (jle means jump if lower or equal)

Likewise, 8048457+15 = 804846c, hence jmp 804846c

Mind you all the values and math are in hexadecimal.

Also as an added call of attention, mind you the operands for the relative jumps opcodes are usually signed. While in these two examples they only jump ahead, they can also jump to previous locations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.