Re: printf....!

2003-02-09 Thread Giorgos Keramidas
On 2003-02-08 16:23, David Leimbach <[EMAIL PROTECTED]> wrote:
> Dave
> On Saturday, February 8, 2003, at 04:12 PM, Auge Mike wrote:
> >Hi all,
> >
> >I was trying to know how "printf" works in FreeBSD... I hvae
> >reached to this point :
> >
> >#define _write(fd, s, n) \
> > __syscall(SYS_write, (int)(fd), (const void *)(s), (size_t)(n))
>
> Isn't it ultimately interrupt 08 on the PC with an index in the EAX
> register for the write "subroutine"?

Interrupt 0x80.

> I am pretty sure that's correct.  I might have the interrupt value
> wrong though.

- Giorgos


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: printf....!

2003-02-09 Thread Wes Peters
On Saturday 08 February 2003 22:12, Auge Mike wrote:
> Hi all,
>
> I was trying to know how "printf" works in FreeBSD... I hvae reached to
> this point :
>
> #define _write(fd, s, n) \
>   __syscall(SYS_write, (int)(fd), (const void *)(s), (size_t)(n))
>
> I'am not really familiar with the way FreeBSD handle interrupts. I like
> from any one of you to tell me what functions will be called next and in
> which files, till we get the string of the printf function argment
> displayed in the terminal.

This is the syscall (kernel entry) that implements the write(2) kernel 
function.  Then next function will be in kernel space, and will be the 
handler for SYS_write, the 'write' function in sys/kern/sys_generic.c.

By "handles interrupts" I assume you meant the syscall interface, right?

-- 

Where am I, and what am I doing in this handbasket?

Wes Peters   [EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: printf....!

2003-02-09 Thread clemens fischer
"Auge Mike" <[EMAIL PROTECTED]>:

> I was trying to know how "printf" works in FreeBSD... I hvae reached
> to this point :
>
> #define _write(fd, s, n) \
>   __syscall(SYS_write, (int)(fd), (const void *)(s), (size_t)(n))

if your program runs in user-space, try strace(1) or ktrace(1).

  clemens

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: printf....!

2003-02-08 Thread Craig Rodrigues
>I was trying to know how "printf" works in FreeBSD... I hvae reached 
>to this
>point :
>
>#define _write(fd, s, n) \
>   __syscall(SYS_write, (int)(fd), (const void *)(s), (size_t)(n))
>
>I'am not really familiar with the way FreeBSD handle interrupts. I 
>like from
>any one of you to tell me what functions will be called next and in 
>which
>files, till we get the string of the printf function argment displayed 
>in
>the terminal.


Look in /usr/src/sys/kern/syscalls.master.  You will see that
this write() is listed as a system call.  If you run the
script makesyscalls.sh which is in the same directory, it will
create syscalls.c, syscalls.h, sysproto.h, and syscall.mk.

If you look at /usr/src/sys/sys/syscall.h, you will see SYS_write
defined in that file.

You can see the man page for syscall() to see what it does when
you do syscall(SYS_write, ...);

Look in /usr/src/sys/kern/sys_generic.c, and look at
the write() function there.


I'm not familiar with DOS interrupts, but hopefully that
will give you more clues:)

You should also look at the Developer's Handbook:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/




-- 
Craig Rodrigues
http://home.attbi.com/~rodrigc
[EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: printf....!

2003-02-08 Thread Miguel Mendez
On Sat, 8 Feb 2003 16:23:21 -0600
David Leimbach <[EMAIL PROTECTED]> wrote:

Howdy.

> Isn't it ultimately interrupt 08 on the PC with an index in the EAX 
> register for the write "subroutine"?
> 
> I am pretty sure that's correct.  I might have the interrupt value 
> wrong though.

s/08/0x80/ :-)
 
Cheers,
-- 
Miguel Mendez - [EMAIL PROTECTED]
GPG Public Key :: http://energyhq.homeip.net/files/pubkey.txt
EnergyHQ :: http://www.energyhq.tk
Of course it runs NetBSD!



msg52019/pgp0.pgp
Description: PGP signature


Re: printf....!

2003-02-08 Thread David Leimbach
Isn't it ultimately interrupt 08 on the PC with an index in the EAX 
register for the write "subroutine"?

I am pretty sure that's correct.  I might have the interrupt value 
wrong though.

Dave
On Saturday, February 8, 2003, at 04:12 PM, Auge Mike wrote:





Hi all,

I was trying to know how "printf" works in FreeBSD... I hvae reached 
to this
point :

#define _write(fd, s, n) \
	__syscall(SYS_write, (int)(fd), (const void *)(s), (size_t)(n))

I'am not really familiar with the way FreeBSD handle interrupts. I 
like from
any one of you to tell me what functions will be called next and in 
which
files, till we get the string of the printf function argment displayed 
in
the terminal.

Yours,



_
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message