Isolating an instruction in one page


I have written main function with one assembly add instruction. According to the GDB, the code is

(gdb) disass /r main
Dump of assembler code for function main:
   0x00000000004004ed <+0>: 55  push   %rbp
   0x00000000004004ee <+1>: 48 89 e5    mov    %rsp,%rbp
   0x00000000004004f1 <+4>: 01 c1   add    %eax,%ecx
   0x00000000004004f3 <+6>: 5d  pop    %rbp
   0x00000000004004f4 <+7>: c3  retq   
End of assembler dump.

As I looked the IP and print the memory content after that, I see

(gdb) x/10x $rip
0x4004f1 <main+4>:  0xc35dc101  0x1f0f2e66  0x00000084  0x41900000
0x400501 <__libc_csu_init+1>:   0xff894157  0x89495641  0x495541f6  0x5441d589
0x400511 <__libc_csu_init+17>:  0xf8258d4c  0x55002008

Actually, I want to put my add %eax, %ecx in just one page and isolate it from before and after that. Here, I don't have the information about pages and don't know if add and retq are in the same page or not.

Any comment?

P.S: As you can see c3 in 0xc35dc101 is the retq instruction. The question is, what are the subsequent bytes?

asked on Stack Overflow Jul 8, 2019 by mahmood

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0