Reputation: 2995
I'm trying to create a folder in 64 bit GNU as like this:
.global main
.text
main:
movl $83, %edi # SYS_mkdir
movl $folder, %esi # folder_name
movl $0777, %edx # flags
call syscall
ret # exit
folder: .string "folder"
this code works, however I'd rather implement it using the "int 0x80" call, but I can't seem to get it to work, I've tried it like this:
mov $83, %eax
mov $folder, %ebx
mov $0777, %ecx
syscall
however it does not work, even if I use the 64 bit registers.
Also how could I translate this code to 32 bit? (preferably using int 0x80)
Upvotes: 1
Views: 1106
Reputation: 11435
In 64 bit syntax you have to use syscall like this:
mov $folder, %rdi
mov $0777, %rsi
mov $83, %rax
syscall
In 32 bit all you have to do is replace registers with 32 bit ones and use int 0x80
instead of syscall
Upvotes: 1