PERFORCE change 113865 for review
Oleksandr Tymoshenko
gonzo at FreeBSD.org
Thu Feb 1 21:40:44 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=113865
Change 113865 by gonzo at gonzo_jeeves on 2007/02/01 21:40:41
o In order to have userland binaries respecting ABI call conventions
syscall handler should skip first 4 words starting from $sp to get
arguments counting from 5th. This chunk of stack is called
"arguments slot" though it carries no actual values. It is just
reserved space which could be filled with $a0..$a4 values by called
routine.
Affected files ...
.. //depot/projects/mips2/src/sys/mips/mips/trap.c#15 edit
Differences ...
==== //depot/projects/mips2/src/sys/mips/mips/trap.c#15 (text+ko) ====
@@ -407,8 +407,16 @@
/* Copy arguments from stack (if any) */
if(i < nargs)
{
- error = copyin((void *)frame->tf_regs[TF_SP], copyargs + i,
- (nargs - i) * sizeof(register_t));
+ /*
+ * ABI NOTE:
+ * syscall routine does not modify SP so we should take into
+ * account "arguments slot" - four words reserved by callee
+ * for called routine. These words *might* be used by called
+ * routine as a store place for $a0..$a3 however content of
+ * slot is undefined.
+ */
+ error = copyin((void *)(frame->tf_regs[TF_SP] + 16),
+ copyargs + i, (nargs - i) * sizeof(register_t));
if (error)
goto bad;
More information about the p4-projects
mailing list