I wrote the following assembly
$ cat l0_basic.asm
BITS 64
_start:
mov rax, 59 ; this is the syscall number of execve
lea rdi, [rel binsh] ; points the first argument of execve at the /bin/sh string below
mov rsi, 0 ; this makes the second argument, argv, NULL
mov rdx, 0 ; this makes the third argument, envp, NULL
syscall ; this triggers the system call
section .data
binsh: db `/bin/sh` ; a label marking where the /bin/sh string is
Then assemble it with
$ nasm -felf64 l0_basic.asm -o l0_basic.o
$ objdump -d l0_basic.o
l0_basic.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <_start>:
0: b8 3b 00 00 00 mov eax,0x3b
5: 48 8d 3d 00 00 00 00 lea rdi,[rip+0x0] # c <_start+0xc>
c: be 00 00 00 00 mov esi,0x0
11: ba 00 00 00 00 mov edx,0x0
16: 0f 05 syscall
You can see it changes rax to eax, rsi to esi. I dont want this automatic conversion. How can I make nasm keep the same instruction I wrote?