Subject: Re: k0/k1 register while mulhi/mullo manipulation
To: Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: port-pmax
Date: 02/23/2000 11:08:26
On Wed, 23 Feb 2000 20:07:39 +0900 (JST) 
 nisimura@itc.aist-nara.ac.jp (Toru Nishimura) wrote:

 > My vague memory whispers me 'k0/k1 contents might be trashed under certain
 > circumstances, e.g., after calling mt*/mf* for mulhi/mullo'.  I can not
 > remember where I got the knowledge, and I might be wrong.

According to my R3000/R4000 manual, there are no restrictions on register
usage for {mf,mt}{hi,lo}, but there are restrictions on what can be done
after it.  Specifically, the two instructions following must *not* be:

	mult
	multu
	div
	divu
	{mf,mt}{hi,lo}

k0 and k1 are just general purpose registers, as far as the CPU is
concerned.  It's merely convention how we use them :-)

Personally, I find the whole kdbaux thing to be a little suspicious...  It
occurs to me that what you really want to do is just always reserve the
space on the stack frame for the saved registers, and maybe save yourself
the work of actually saving/restoring them if you don't have DDB in the
kernel.

        -- Jason R. Thorpe <thorpej@nas.nasa.gov>