]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix a bug in the kernel entry window handling where the wrong register
authorjake <jake@FreeBSD.org>
Sat, 20 Oct 2001 17:06:04 +0000 (17:06 +0000)
committerjake <jake@FreeBSD.org>
Sat, 20 Oct 2001 17:06:04 +0000 (17:06 +0000)
commitfd0d094ecb612c1330012a69cb10b32ecde649a1
tree1c4978658631042d93929346447afaac6d5113e1
parent1d421d0a011283f6fee1b65df0a0a0254e25a6ff
Fix a bug in the kernel entry window handling where the wrong register
was used.  This resulted in bogus bad window traps (invalid wstate).

Add a trace to sfsr traps (alignment among other things).

Use KTR_TRAP instead of KTR_CT1.

Use the right registers when storing the values of various
mmu registers into the trap frame.  This fixes a bug where sometimes
the context number reported by a fault would be garbage.  Sometimes
it would be zero for faults on user address space so the kernel would
wrongly think that it was a fault on kernel address space and fail.

Use the preloaded registers in the vectored interrupt trap instead
of reading pointers from memory.  Remove traces due to register
pressure and excess verbosity.  We can probably still sneak in one
trace.  Remove some debug code.

Go back to using the tsb register during kernel page table lookups.
This is the best way to not have to have the address of the kernel tsb be
a compile time constant.  We lie and say we have 1 page tsb when really
its much larger.  This way the hardware provides bits 13-22 of the
virtual address (the lower 9 bits of the virtual page number) in the
form of the address of the tte corresponding to the fault address in
the (1 page) kernel tsb.  With some clever arithmetic we can then get
bits 22 and up from the tte tag and add them to the tte address in
order to index massive tsbs (basically unlimited).

Add traps for physical address hardware watchpoints.

Don't try to pass the window state from the trap table entry point
all the way down to the common trap code.  Its too easy to clobber
and reading it again doesn't cost much.

Fixup some traces.

Fiddle the cwp bits on return from the kernel to user mode so that
the window we are returning to is always the same as the one we
restore to in the trap code.  Strictly speaking this is not necessary,
it only affects return from fork and exec, but setting up the windows
right would require hard coding the right cwp values in cpu_fork and
setregs, basically hard coding the number of frames between syscall and
tl0_ret.  The result of getting it wrong is usually a spill to an invalid
stack pointer; either 0 or pointing into kernel space.  This should also
alleviate the need to context switch the cwp.

Transfer the trap state from locals to alternate globals in the trap
return code so that we can do a restore and rotate the windows before
reloading the trap registers.  If the restore fails we'll trap back
into the kernel, so there's no point in loading the trap registers
before hand.  Its is crucial that the window trap recovery code not
clobber the alternate globals.
sys/sparc64/sparc64/exception.S
sys/sparc64/sparc64/exception.s