Date: Thu, 1 Feb 2007 21:40:43 GMT From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 113865 for review Message-ID: <200702012140.l11LehCl035593@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=113865 Change 113865 by gonzo@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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702012140.l11LehCl035593>