I should create in assembly code (at & t Style) a function that creates a directory (Linux OS).debugging with gdb when I run my code returns a permission error. I think I'm wrong in passing parameters. thank you very much.
.data
Messaggio: .string "Salve\n"
cartella: .string "prova"
length = .-Messaggio
s_irusr = 00400
s_iwusr = 00200
s_ixusr = 00100
.text
.global _lpshow
.global _cd
_lpshow:
mov $4,%eax
mov $1,%ebx #stdout
mov $Messaggio,%ecx #message address
mov $length,%edx # message string length
int $0x80
#sys_exit(return_code)
mov $1,%eax # sys_exit syscall
mov $0,%ebx #return 0 (success)
int $0x80
ret
_cd :
mov $39,%eax
mov $cartella,%ebx
mov s_iwusr|s_irusr|s_ixusr,%ecx
int $0x80
ret
The line mov s_iwusr|s_irusr|s_ixusr,%ecx
is missing a $
sign to denote an immediate, like mov $s_iwusr|s_irusr|s_ixusr,%ecx
.
Of course the code as-is will exit before it even tries to create the directory, but I assume you have something that tries to call _cd
(which is a misleading name, by the way).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.