When on move address pointer from cpu register to external memory the address value change with apparent erroneous signed extension
Assembly Code:
.section .data argc: .quad 0 .section .bss argv: .space 8 # pointer variable definition .section .text _start: .global _start movq (%rsp),%rax #arguments number movq %rax,argc movq 8(%rsp),%rdi #string address of first argument of command line movq %rdi,argv #pointer variable initialization GDB debugger stepping execution:
(gdb) p /a $rdi $1 = 0x7fffffffe335 (gdb) p /a argv $2 = 0xffffffffffffe335 The address 0x7fffffffe335 has the MSB to zero ¿ Why the argv value is not equal and has the MSB to one? ¿How can I implemented a variable pointer at external memory?
Thanks in advance
C.A. Mayoz