Add some comments, clean things up so routines can be called from the

idle loop.
This commit is contained in:
matt 2004-07-09 22:00:46 +00:00
parent 2de808bec0
commit 4f6490d718
1 changed files with 12 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore_subr.S,v 1.24 2003/11/21 18:07:29 matt Exp $ */ /* $NetBSD: locore_subr.S,v 1.25 2004/07/09 22:00:46 matt Exp $ */
/* /*
* Copyright (c) 2001 Wasabi Systems, Inc. * Copyright (c) 2001 Wasabi Systems, Inc.
@ -151,7 +151,7 @@ GLOBAL(powersave)
* No lwps are runnable, so loop waiting for one. * No lwps are runnable, so loop waiting for one.
* Separate label here for accounting purposes. * Separate label here for accounting purposes.
* When we get here, interrupts are off (MSR[EE]=0), sched_lock is held, * When we get here, interrupts are off (MSR[EE]=0), sched_lock is held,
* spl is IPL_SCHED. * spl is IPL_SCHED, and %r31 is a scratch register.
*/ */
ASENTRY(Idle) ASENTRY(Idle)
lis %r8,_C_LABEL(sched_whichqs)@ha lis %r8,_C_LABEL(sched_whichqs)@ha
@ -164,9 +164,9 @@ ASENTRY(Idle)
bl _C_LABEL(sched_unlock_idle) bl _C_LABEL(sched_unlock_idle)
#endif #endif
li %r3,0 /* drop SPL to 0 */ li %r3,0 /* go IPL_SCHED to IPL_NONE */
bl _C_LABEL(lcsplx) bl _C_LABEL(lcsplx)
/* r3 now contain previous SPL; DO NOT OVERWRITE */ mr %r31,%r3 /* save returned IPL mask */
#if defined(PPC_IBM4XX) #if defined(PPC_IBM4XX)
wrteei 1 /* reenable ints again */ wrteei 1 /* reenable ints again */
@ -177,6 +177,10 @@ ASENTRY(Idle)
isync isync
#endif #endif
/*
* At this point, other routines can be called (such as uvm_pageidlezero).
*/
#if defined(PPC_OEA) #if defined(PPC_OEA)
/* Check if we can use power saving mode */ /* Check if we can use power saving mode */
lis %r8,_C_LABEL(powersave)@ha lis %r8,_C_LABEL(powersave)@ha
@ -185,6 +189,7 @@ ASENTRY(Idle)
ble 1f ble 1f
sync sync
mfmsr %r4
oris %r4,%r4,PSL_POW@h /* enter power saving mode */ oris %r4,%r4,PSL_POW@h /* enter power saving mode */
mtmsr %r4 mtmsr %r4
isync isync
@ -195,13 +200,14 @@ ASENTRY(Idle)
wrteei 0 /* disable interrupts while wrteei 0 /* disable interrupts while
manipulating runque */ manipulating runque */
#else /* PPC_OEA */ #else /* PPC_OEA */
mfmsr %r4
andi. %r4,%r4,~PSL_EE@l /* disable interrupts while andi. %r4,%r4,~PSL_EE@l /* disable interrupts while
manipulating runque */ manipulating runque */
mtmsr %r4 mtmsr %r4
#endif #endif
/* r3 already contain previous SPL */ mr %r3,%r31 /* get back IPL mask */
bl _C_LABEL(lcsplx) /* raise spl back to sched */ bl _C_LABEL(lcsplx) /* raise spl back to IPL_SCHED */
#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG) #if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
bl _C_LABEL(sched_lock_idle) bl _C_LABEL(sched_lock_idle)