Wednesday, October 17, 2018

linux - Assembly language registers changes

I am running assembly language 64bit code on ubuntu 14.04 LTS 64bit



global _start

section .text
_start:
;display on screen
mov rax, 1
mov rdi, 1
mov rsi, message

mov rdx, length
syscall

;exit gracefuly
mov rax, 60
mov rdi, 11
syscall

section .data
message: db 'Hello world!',0xa

length: equ $-message


But when i disasseble it using gdb, it is dumping eax,edi,edx,eax and edi register insted of rax,rdi,rdx,rax and rdi register respectively...



Dump of assembler code for function _start:
0x00000000004000b0 <+0>: mov eax,0x1
0x00000000004000b5 <+5>: mov edi,0x1
0x00000000004000ba <+10>: movabs rsi,0x6000d8
0x00000000004000c4 <+20>: mov edx,0xd

0x00000000004000c9 <+25>: syscall
0x00000000004000cb <+27>: mov eax,0x3c
0x00000000004000d0 <+32>: mov edi,0xb
0x00000000004000d5 <+37>: syscall
End of assembler dump.


Why this is happening ?

No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...