Newsgroups: comp.os.minix
Subject: Re: about 'receive' implementation
References: <b9a7930c.0106061403.2eaac5fb@posting.google.com>
Organization: Syracuse University, Syracuse
From: mcconnel@hydra.syr.edu (Terry R. McConnell)
NNTP-Posting-Host: hydra.syr.edu
Message-ID: <3b1fd132.0@news.syr.edu>
Date: 7 Jun 2001 15:08:34 -0500
X-Trace: 7 Jun 2001 15:08:34 -0500, hydra.syr.edu
Lines: 44
Path: news.adfa.edu.au!clarion.carno.net.au!news0.optus.net.au!news1.optus.net.au!optus!news-out.cwix.com!newsfeed.cwix.com!news.maxwell.syr.edu!news.syr.edu!hydra.syr.edu!mcconnel
Xref: news.adfa.edu.au comp.os.minix:37563

In article <b9a7930c.0106061403.2eaac5fb@posting.google.com>,
romanett <romanett@pacbell.net> wrote:
>Hello,
>
>In my study of Minix I am stuck with the
>implementation of 'receive' (used in at_wini.c for 
>example) located (apparently) in src/lib/i386/rst/_sendrec.s
>
>Here are my naive questions:
>
>1) where does SYSVEC = 33 comes from?
>   the file mentioned there, "../h/com.h" does not exist

That line is probably left over from an old implementation. The com.h header
is in a different place now, probably under /usr/include/minix. (I don't
have my source with me right now to check.) 

>
>2) What does this line do more precisely:
>   int SYSVEC ! trap to the kernel

int 33 causes the hardware to load the address of the routine pointed
to by index 33 in a jump table  as the next instruction to
be executed. As part of its startup the kernel has already filled the
jump table. The entry in question points to a routine called _syscall that
handles system calls. You can study how syscall works by looking at the
low level kernel source code. It expects to find stuff stored at eax, ebx, and
ecx that tell it how to proceed.

>   
>3) Why do ebx need to be saved?
>

Because the line

	mov	ebx, MESSAGE(ebp)	! ebx = message pointer

trashes it. (Minix assembler syntax lists the destination register first.)

-- 
************************************************************************
Terry R. McConnell   Mathematics/304B Carnegie/Syracuse, N.Y. 13244-1150
trmcconn@syr.edu     http://barnyard.syr.edu/~tmc    Question Authority?
************************************************************************
