Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MOVABS opcode in the assembly code

Tags:

disassembly

While debugging one of the assembly code examples, I found following piece of information:

   (gdb) x /10i 0x4005c4
   0x4005c4:    push   %rbp
   0x4005c5:    mov    %rsp,%rbp
   0x4005c8:    sub    $0xa0,%rsp
   0x4005cf:    mov    %fs:0x28,%rax
   0x4005d8:    mov    %rax,-0x8(%rbp)
   0x4005dc:    xor    %eax,%eax
   0x4005de:    movabs $0x6673646c6a6b3432,%rax
   0x4005e8:    mov    %rax,-0x40(%rbp)
   0x4005ec:    movl   $0x323339,-0x38(%rbp)
   0x4005f3:    movl   $0x553059,-0x90(%rbp)

As per my understanding movabs should not be used, it seems like it was introduced intentionally. Am I right in my understanding?

What should be the equivalent MOV command to replace it?

like image 455
Mangoman_123 Avatar asked Oct 05 '17 20:10

Mangoman_123


1 Answers

As a direct copy from this question: https://reverseengineering.stackexchange.com/questions/2627/what-is-the-meaning-of-movabs-in-gas-x86-att-syntax

[...] The movabs instruction to load arbitrary 64-bit constant into register and to load/store integer register from/to arbitrary constant 64-bit address is available.

http://www.ucw.cz/~hubicka/papers/amd64/node1.html

It does exactly what you'd expect from it - it puts the immediate into the register.

like image 98
Mark Segal Avatar answered Oct 21 '22 02:10

Mark Segal