diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2012-09-08 20:58:51 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2012-09-08 20:58:51 +0000 |
commit | dc061c8d1e82d505a8e7489869fc5d159b01eb64 (patch) | |
tree | 64c340d3308661a29effa391a3358d4474c271ca /sys/arch/sparc64 | |
parent | 2b73565b50b820422d55c7d77fb1524d42454236 (diff) |
On SPARC64 VI/VII CPUs, use the lseep instruction in the idle loop to force a
thread switch in the hope the other thread can do some useful work.
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r-- | sys/arch/sparc64/sparc64/cpu.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/arch/sparc64/sparc64/cpu.c b/sys/arch/sparc64/sparc64/cpu.c index bcdf288a3df..29ee24bb25d 100644 --- a/sys/arch/sparc64/sparc64/cpu.c +++ b/sys/arch/sparc64/sparc64/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.56 2011/01/13 22:55:33 matthieu Exp $ */ +/* $OpenBSD: cpu.c,v 1.57 2012/09/08 20:58:50 kettenis Exp $ */ /* $NetBSD: cpu.c,v 1.13 2001/05/26 21:27:15 chs Exp $ */ /* @@ -788,10 +788,24 @@ cpu_idle_cycle(void) sparc_wrpr(pstate, sparc_rdpr(pstate) & ~PSTATE_IE, 0); } #endif + + /* + * On processors with multiple threads we simply force a + * thread switch. Using the sleep instruction seems to work + * just as well as using the suspend instruction and makes the + * code a little bit less complicated. + */ + __asm __volatile( + "999: nop \n" + " .section .sun4u_mtp_patch, \"ax\" \n" + " .word 999b \n" + " .word 0x81b01060 ! sleep \n" + " .previous \n" + : : : "memory"); } void -cpu_idle_leave() +cpu_idle_leave(void) { if (CPU_ISSUN4V) { sparc_wrpr(pstate, sparc_rdpr(pstate) | PSTATE_IE, 0); |