Port-mips archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

Excerpt of message (sent 24 August 2009) by Jason Thorpe:
> On Aug 23, 2009, at 9:04 PM, Matt Thomas wrote:
> > Module Name:        src
> > Committed By:       matt
> > Date:               Mon Aug 24 04:04:53 UTC 2009
> >
> > Modified Files:
> >     src/sys/arch/mips/mips [matt-nb5-mips64]: mipsX_subr.S
> >
> > Log Message:
> > SyscallCall exception didn't save the temporaries which libc no  
> > longer likes.
> > So now it saves them.
> This seems wrong... the syscall trap is like making a function call,  
> so the temporaries should be expected to be clobbered.  If the syscall  
> stubs don't like this, they should make use of callee-saved registers.
> What am I missing?

I wonder about the analogy.  A syscall is a trap instruction, it isn't
a function call.  Yes, the syscall convention passes arguments
somewhat like a function calls (but not exactly like it).  You could
certainly extend the ABI rules to say that what applies to a function
call also applies to a syscall.  But you could equally well say that
it does not.

If you stick an asm("syscall") into the code, the compiler is going to
assume all registers are preserved.  So the "save everything" rule
seems to be logical.   If the actuall syscall is in a function all its
own (possibly one written in assembler) then the compiler will assume
that temps are clobbered, of course, but it will do so based on the
function rules.


Home | Main Index | Thread Index | Old Index