Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Mar 2000 20:39:13 +0100
From:      "Marco van de Voort" <marcov@stack.nl>
To:        Hackers@freebsd.org
Subject:   Re: Can't write to stdout in assembly
Message-ID:  <20000304194140.48F3D2E803@hermes.tue.nl>
In-Reply-To: <38C0EA12.A4252C20@mail.ptd.net>

next in thread | previous in thread | raw e-mail | index | archive | help
> >From what I understand, the following should print "Hello, world." on
> stdout. I stole the code from the Linux HOWTO, but I think it should
> work on FreeBSD as well. Instead, the call to write returns 9 (EBADF).

I disassembled FreeBSD programs (create a small C prog, compile, and use
objdump), and it looks more like this: (I haven't tested this yet, but it is definitely
stack based, not register based, the part which I haven't tested is if the placing
the int $0x80 behind a call is required)

pusl $len
pushl $Msg
pushl $1
mov $4,%eax
call _basicsyscall
addl $12,%esp
.
.
.



_basicsyscall:	int $0x80	
				ret


> As a related question, can anyone point me to the source for the int
> 0x80 handler? I've looked all over but can't find it.

On the libc side? 	

It is very fragmented in several files using a lot of macro
code. If you wish I can look up the names for you (I did this some weeks ago)

I never searched for the kernel side. (the actual 0x80 handler)
Marco van de Voort (MarcoV@Stack.nl)
<http://www.stack.nl/~marcov/xtdlib.htm>;



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000304194140.48F3D2E803>