From owner-freebsd-hackers Sat Mar 4 11:41:53 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from kweetal.tue.nl (kweetal.tue.nl [131.155.2.7]) by hub.freebsd.org (Postfix) with ESMTP id 6BF5837B869 for ; Sat, 4 Mar 2000 11:41:50 -0800 (PST) (envelope-from marcov@toad.stack.nl) Received: from hermes.tue.nl [131.155.2.46] by kweetal.tue.nl (8.9.3) for id UAA25342 (ESMTP); Sat, 4 Mar 2000 20:41:41 +0100 (MET) Received: from deathstar (n71.dial.tue.nl [131.155.209.70]) by hermes.tue.nl (Postfix) with ESMTP id 48F3D2E803 for ; Sat, 4 Mar 2000 20:41:40 +0100 (CET) From: "Marco van de Voort" To: Hackers@freebsd.org Date: Sat, 4 Mar 2000 20:39:13 +0100 Subject: Re: Can't write to stdout in assembly In-reply-to: <38C0EA12.A4252C20@mail.ptd.net> X-mailer: Pegasus Mail for Win32 (v3.12b) Message-Id: <20000304194140.48F3D2E803@hermes.tue.nl> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > >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) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message