07-24-2023, 12:31 PM
Consider the following code, compiled on a 32-bit `Ubuntu 14.04.2` with `gcc 4.8.2`
#include <unistd.h>
int main(){
_exit(0);
}
If I open this code in `gdb` and run `disas /r _exit`, I get the following.
(gdb) disas /r _exit
Dump of assembler code for function _exit@plt:
0x080482f0 <+0>: ff 25 0c a0 04 08 jmp *0x804a00c
0x080482f6 <+6>: 68 00 00 00 00 push $0x0
0x080482fb <+11>: e9 e0 ff ff ff jmp 0x80482e0
End of assembler dump.
(gdb)
The Intel manual tells us that `ff` is the opcode for `JMP`, while the last four bytes are clearly the target address. After some research into the structure of Intel instructions, the `25` appears to be a `Mod R/M` byte, but I could not find how the `Mod R/M` byte should be interpreted with respect to the `JMP` instruction.
I have already read up on the [general interpretation of the Mod R/M byte][1], but I do not understand what specific meaning the byte `0x25` carries in the `disas` output above.
What is the specific meaning of `0x25` here, and what is the general interpretation of the `Mod R/M` byte with respect to `JMP`?
[1]:
#include <unistd.h>
int main(){
_exit(0);
}
If I open this code in `gdb` and run `disas /r _exit`, I get the following.
(gdb) disas /r _exit
Dump of assembler code for function _exit@plt:
0x080482f0 <+0>: ff 25 0c a0 04 08 jmp *0x804a00c
0x080482f6 <+6>: 68 00 00 00 00 push $0x0
0x080482fb <+11>: e9 e0 ff ff ff jmp 0x80482e0
End of assembler dump.
(gdb)
The Intel manual tells us that `ff` is the opcode for `JMP`, while the last four bytes are clearly the target address. After some research into the structure of Intel instructions, the `25` appears to be a `Mod R/M` byte, but I could not find how the `Mod R/M` byte should be interpreted with respect to the `JMP` instruction.
I have already read up on the [general interpretation of the Mod R/M byte][1], but I do not understand what specific meaning the byte `0x25` carries in the `disas` output above.
What is the specific meaning of `0x25` here, and what is the general interpretation of the `Mod R/M` byte with respect to `JMP`?
[1]:
[To see links please register here]