Hola
Estoy dando mis primeros pasos con ASM, y me ha surgido este problema.
.section .data
msg:
.ascii "KPID\n"
.section .text
.globl _start
_start:
movl $4, %eAX
movl $1, %eBX
movl $msg, %eCX
movl $5, %eDX
int $0x80
movl $37, %eAX
movl $1375, %eBX
movl $9, %eCX
int $0x80
xorl %eAX, %eAX
movl $1, %eAX
movl $0, %eBX
int $0x80
Este código lo escribo y ejecutó en una máquina de 32 bits, cuando lo paso a la mía que es de 64 bits.
El resultado es esté:
Bad system call (core dumped)
Leyendo documentación:
Citarrdi - used to pass 1st argument to functions
rsi - used to pass 2nd argument to functions
rdx - used to pass 3rd argument to functions
rcx - used to pass 4th argument to functions
r8 - used to pass 5th argument to functions
r9 - used to pass 6th argument to functions
Dejo el código así:
.section .data
msg:
.ascii "KPID\n"
.section .text
.globl _start
_start:
movq $4, %rAX
movq $1, %rDI
movq $msg, %rSI
movq $5, %rDX
int $0x80
movq $37, %rAX
movq $1375, %rDI
movq $9, %rSI
int $0x80
xorq %rAX, %rAX
movq $1, %rAX
movq $0, %rBX
int $0x80
La llamada a write funciona, pero a la de kill no, me apaga el sistema.
Utilice otras llamadas simples como mkdir o rmdir, y ninguna funciona en 64 bits pero si en 32 bits.
¿Son los registros o el sistema?
Utilizo OpenBSD.
Un saludo.