Skip site navigation (1)Skip section navigation (2)
Date:      02 Nov 1999 05:20:11 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        freebsd-questions@freebsd.org
Subject:   Re: NASM for FreeBSD (update...)
Message-ID:  <86904hshoz.fsf@localhost.hell.gr>
In-Reply-To: Isaac Flemming's message of "Mon, 1 Nov 1999 11:48:48 -0500 (EST)"
References:  <Pine.GSO.3.96.991101095826.7261B-100000@mission.mvnc.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Isaac Flemming <iflemmin@mission.mvnc.edu> writes:

> My question now is does anyone know of any documentation that will
> tell me how to do I/O calls to the system in FreeBSD?

You have plenty of alternative choises:

(1) read the sources of the kernel to find out how to call the proper
    system calls to do your I/O.  This is probably the hardest way of
    reinventing the wheel of Unix I/O.  Try to avoid it, since writing
    in C can be a little easier.

(2) use simple C calling conventions for linking your assembly programs
    against the standard C library.  something like the following comes
    as a handy example.

	push 3
	push FORMAT
	call printf
	add esp,8

(3) write a simple function in C that does what you want, then examine
    the output file produced by:

	% gcc -S demo.c

    you want to read demo.S after that.

> Also once I do have information about the I/O calls will I be able to
> execute the programs assembled as stand alone programs or do I have to
> call them with a .c program?

Both can work.  If you link against a C program, see (2) above.  To
build a standalone program, you are probably going to find (1) more
useful, in the long run.

-- 
Giorgos Keramidas, <keramida@ceid.upatras.gr>
"What we have to learn to do, we learn by doing." [Aristotle]


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




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