Subject: possible Sparc locore.s window handler optimization...
To: None <port-sparc@NetBSD.ORG>
From: David S. Miller <davem@caip.rutgers.edu>
List: port-sparc
Date: 09/12/1995 01:12:35
Just idly perusing the window fill/spill and trap window cleaning code
it occurs to me that there is a nice little optimization possible for
checking the user stack validity before dumping the window there.
This is geared for the sun4c but could be easily adapted to the srmmu
some time in the future.  Observe...

Currently, things look something like:

begin:
	1) Check user page %sp is on, if page not mapped
	   or in virtual address space hole, goto 'bad'.

	2) See if reg window save will go onto the next
	   page, if no goto 'ok'

	3) Check second page valiadity, just as in step 1,
	   if things are koshed goto 'ok' else fall through
	   to 'bad'.

bad:
	Dump user register windows into pcb area since
	stack is trashed or not mapped properly.

ok:
	Dump onto %sp

Perhaps it would be quicker to do.

begin:
	1) See if register window save area lies on two pages,
	   if not place %sp in %g5 (or whatever) and goto
	   'one_win'.

	2) Check page at %sp
	3) add %sp, sizeof(reg_window), %g5

one_win:
	4) Check page at %g5

bad:

ok:

etc.  You get the idea.  What do people think?

Later,
David S. Miller
davem@caip.rutgers.edu