Subject: _MIPS_BSD_API_LP32_64CLEAN vx. saving regs in traps.
To: None <port-mips@netbsd.org>
From: Chris G. Demetriou <cgd@sibyte.com>
List: port-mips
Date: 09/29/2000 16:23:03
Something I just noticed, while reading some of the MD mips code, and
I want to make sure i'm not asleep at the keyboard.

say you're using _MIPS_BSD_API_LP32_64CLEAN.  (IIRC, at least some
other people had reported that they were trying to use this in some
circumstances.)

Great, reg saves and restores in locore_mips3.S are done with REG_S,
etc., so the 64-bitness is hidden from the mostly-32bit kernel.


However, i note (in mips3_KernGenException, mips3_KernIntr,
mips3_UserIntr):

/*   
 * Save the relevant kernel registers onto the stack.
 * We don't need to save s0 - s8, sp and gp because
 * the compiler does it for us.
 */

and those regs aren't saved or restored.


But, really, the compiler won't do that for us, will it?  (It'll try
to save/restore them as 32-bit values...)


oi.


I suppose a reasonable caveat may be, since that option seems
exploitable only via assembly code, "don't use s0-s8, and don't try to
access sp or gp as other than 32-bit sign-extended values" may be a
reasonable restriction.  But it was ... rather unexpected.  8-)


cgd