linux-mips
[Top] [All Lists]

Re: Details of MIPS(Octeon) system call semantics

To: adnan iqbal <adnan.iqbal@seecs.edu.pk>
Subject: Re: Details of MIPS(Octeon) system call semantics
From: Ralf Baechle <ralf@linux-mips.org>
Date: Wed, 2 Jun 2010 14:38:09 +0100
Cc: linux-mips@linux-mips.org
In-reply-to: <AANLkTino_WFpj8aueN4zGwkRV-SCVqA5NGsKQOGU9qho@mail.gmail.com>
References: <AANLkTino_WFpj8aueN4zGwkRV-SCVqA5NGsKQOGU9qho@mail.gmail.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.20 (2009-08-17)
On Wed, Jun 02, 2010 at 03:17:38PM +0500, adnan iqbal wrote:

> I am able to find system call list (o32 and n64) in
> /usr/include/asm/unistd.h over octeon/debian board. I am looking for details
> about these system calls so that for each system call i know exactly
> 
> 1. What parmeters should be set in which registers before syscall
> 2. Which registers contain output of those system calls.

The basic concept for all ABIs is that syscalls are working almost like
subroutine calls, so:

 o arguments are passed in $a0 - $a3 for o32
 o arguments are passed in $a0 - $a7 for N32 and N64
 o argument that don't fit into the argument registers are passed on the
   stack.
 o for details such as alignment of 64-bit arguments the usual ABI
   conventions apply
 o the result is return in $v0

In addition to normal subroutine calls:

 o $a3 on syscall return will indicate success or error.  0 means success,
   non-zero means an error happened in which case $v0 will contain an
   errno.h error code.
 o Many syscalls deviate from this convention.  For example the sigreturn
   family of syscalls doesn't return a result or error status.
 o pipe() will return the 2nd filedescriptor of the result in $v1.
 o vfork is even more weird.
 o The ABI differences mean there are many subtle difference between the
   syscall handlers.

  Ralf

<Prev in Thread] Current Thread [Next in Thread>