Subject: port-sh3/24007: sh3 cpu_exit() is volatile
To: None <>
From: Jaromir Dolecek <>
List: netbsd-bugs
Date: 01/06/2004 21:09:23
>Number:         24007
>Category:       port-sh3
>Synopsis:       sh3 cpu_exit() is volatile
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    port-sh3-maintainer
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 06 20:09:00 UTC 2004
>Originator:     Jaromir Dolecek
>Release:        NetBSD 1.6ZG
System: NetBSD 1.6ZG NetBSD 1.6ZG (SARUMAN.MP) #10: Sun Jan 4 12:48:32 CET 2004 i386
Architecture: i386
Machine: i386

	sh3 cpu_exit() uses lwp0 stack and memory after it's reclaimed
	('l' pointer after lwp_exit2() call, where the lwp is freed).
	This only works due to the initial excessive interrupt blocking
	via splsched, and feels as somewhat of a hack.

	It would be safer to follow practice of other ports, which
	switch to idle context, call lwp_exit2() from that context,
	and then use special code path to schedule another lwp
	instead of the one which exitted. I also believe this
	would be necessary for MP, tho I'm not sure if Super-H 3
	supports MP at all.

	code inspection
	Sorry, no patch.