Subject: Assembly hello world help..?
To: None <netbsd-help@netbsd.org>
From: None <sudog@sudog.com>
List: netbsd-help
Date: 05/28/2001 22:41:02
I'm trying to get the following assembly (nasm style) to work:
section .text
global _start
msg db "Hello world!",0xa
len equ $-msg
_syscall:
int 0x80
ret
_start:
push dword len
push dword msg
push dword 1
mov eax,0x4
call _syscall
add esp,12
push dword 0
mov eax,0x1
call _syscall
0x4 is the syscall "write" according to syscalls.master.
0x1 is the syscall "exit"..
this program works perfectly on my other netbsd machine at work.
running it through ALD (after getting ALD to compile successfully for
NetBSD) tells me that everything is proceeding as expected, and then
suddenly the syscall appears to fail--returning FFFFFFF7 in eax.
Isn't that something other than a simple "-1" like what write claims
to return in write(2)?
any particular reason why this sort of banging around wouldn't work?
Is int 0x80 the wrong one?
thanks!
marc tooley