Why RSP or other registers are 32-bit in 64-bit system?

0

After compilation I check the file:

file program.out 
program.out: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0

then run GDB:

[+] Debug with GDB ... 
Reading symbols from program.out...done.
(gdb) break main
Breakpoint 1 at 0x642: file program.c, line 5.
(gdb) run
Starting program: /home/storenth/program.out 

Breakpoint 1, main () at program.c:5
warning: Source file is more recent than executable.
5     int i;
(gdb) i r rsp rbp
rsp            0x7fffffffd9a0   0x7fffffffd9a0
rbp            0x7fffffffd9b0   0x7fffffffd9b0
(gdb) print sizeof($rsp)
$1 = 8
(gdb) x/8x $rsp
0x7fffffffd9a0: 0xffffda90  0x00007fff  0x00000000  0x00000000
0x7fffffffd9b0: 0x55554680  0x00005555  0xf7a05b97  0x00007fff

Can anyone, please explain to me why the RSP register contains four values by 32-bit, not by 64-bit in my x86-64 machine? Why four values, not just one (for i local variable)? And what are the minimum and maximum size of this register can be? Thank you.

c
gdb
x86-64
cpu-registers
asked on Stack Overflow Aug 27, 2020 by storenth

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0