2002-08-17 20:36:31 +04:00
|
|
|
/* $NetBSD: spl.S,v 1.4 2002/08/17 16:36:34 thorpej Exp $ */
|
1996-03-08 21:03:15 +03:00
|
|
|
|
|
|
|
/*
|
1998-09-05 08:01:53 +04:00
|
|
|
* Copyright (c) 1996-1998 Mark Brinicombe.
|
1996-03-08 21:03:15 +03:00
|
|
|
* Copyright (c) Brini.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
1998-09-05 08:01:53 +04:00
|
|
|
* This product includes software developed by Mark Brinicombe
|
|
|
|
* for the NetBSD Project.
|
1996-03-08 21:03:15 +03:00
|
|
|
* 4. The name of the company nor the name of the author may be used to
|
|
|
|
* endorse or promote products derived from this software without specific
|
|
|
|
* prior written permission.
|
|
|
|
*
|
1998-09-05 08:01:53 +04:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
1996-03-08 21:03:15 +03:00
|
|
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
1998-09-05 08:01:53 +04:00
|
|
|
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
1996-03-08 21:03:15 +03:00
|
|
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* spl routines
|
|
|
|
*
|
|
|
|
* Created : 01/03/96
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "assym.h"
|
2001-11-26 23:51:57 +03:00
|
|
|
#include <arm/arm32/psl.h>
|
1997-10-14 13:54:31 +04:00
|
|
|
#include <machine/asm.h>
|
1996-03-08 21:03:15 +03:00
|
|
|
|
|
|
|
.text
|
|
|
|
.align 0
|
|
|
|
|
2002-08-17 20:36:31 +04:00
|
|
|
.Lcurrent_spl_level:
|
1999-10-26 10:53:41 +04:00
|
|
|
.word _C_LABEL(current_spl_level)
|
1996-03-08 21:03:15 +03:00
|
|
|
|
2002-08-17 20:36:31 +04:00
|
|
|
.Lspl_masks:
|
1999-10-26 10:53:41 +04:00
|
|
|
.word _C_LABEL(spl_masks)
|
1996-03-08 21:03:15 +03:00
|
|
|
|
2002-08-17 20:36:31 +04:00
|
|
|
.Lspl_mask:
|
1999-10-26 10:53:41 +04:00
|
|
|
.word _C_LABEL(spl_mask)
|
1996-03-08 21:03:15 +03:00
|
|
|
|
1997-10-14 13:54:31 +04:00
|
|
|
ENTRY(raisespl)
|
1996-03-08 21:03:15 +03:00
|
|
|
mov r3, r0 /* Save the new value */
|
2002-08-17 20:36:31 +04:00
|
|
|
ldr r1, .Lcurrent_spl_level /* Get the current spl level */
|
1996-03-08 21:03:15 +03:00
|
|
|
ldr r0, [r1]
|
|
|
|
cmp r3, r0
|
|
|
|
movle pc, lr
|
|
|
|
|
1998-09-05 08:01:53 +04:00
|
|
|
str r3, [r1] /* Store the new spl level */
|
1996-03-08 21:03:15 +03:00
|
|
|
|
2002-08-17 20:36:31 +04:00
|
|
|
ldr r2, .Lspl_masks /* Get the spl mask */
|
1996-03-08 21:03:15 +03:00
|
|
|
ldr r2, [r2, r3, lsl #2]
|
|
|
|
|
2002-08-17 20:36:31 +04:00
|
|
|
ldr r1, .Lspl_mask /* Store in the current spl mask */
|
1996-03-08 21:03:15 +03:00
|
|
|
str r2, [r1]
|
|
|
|
|
2001-09-28 14:01:02 +04:00
|
|
|
/* stack alignment is 8 bytes */
|
1996-03-08 21:03:15 +03:00
|
|
|
stmfd sp!, {r0, lr} /* Preserve registers */
|
1999-10-26 10:53:41 +04:00
|
|
|
bl _C_LABEL(irq_setmasks) /* Update the actual masks */
|
1996-03-08 21:03:15 +03:00
|
|
|
ldmfd sp!, {r0, pc} /* Exit */
|
|
|
|
|
1997-10-14 13:54:31 +04:00
|
|
|
ENTRY(lowerspl)
|
1996-03-08 21:03:15 +03:00
|
|
|
mov r3, r0 /* Save the new value */
|
2002-08-17 20:36:31 +04:00
|
|
|
ldr r1, .Lcurrent_spl_level /* Get the current spl level */
|
1996-03-08 21:03:15 +03:00
|
|
|
ldr r0, [r1]
|
|
|
|
cmp r3, r0
|
|
|
|
movge pc, lr
|
|
|
|
|
1998-09-05 08:01:53 +04:00
|
|
|
str r3, [r1] /* Store the new spl level */
|
1996-03-08 21:03:15 +03:00
|
|
|
|
2002-08-17 20:36:31 +04:00
|
|
|
ldr r2, .Lspl_masks /* Get the spl mask */
|
1996-03-08 21:03:15 +03:00
|
|
|
ldr r2, [r2, r3, lsl #2]
|
|
|
|
|
2002-08-17 20:36:31 +04:00
|
|
|
ldr r1, .Lspl_mask /* Store in the current spl mask */
|
1996-03-08 21:03:15 +03:00
|
|
|
str r2, [r1]
|
|
|
|
|
2001-09-28 14:01:02 +04:00
|
|
|
/* stack alignment is 8 bytes */
|
1996-03-08 21:03:15 +03:00
|
|
|
stmfd sp!, {r0, lr} /* Preserve registers */
|
1999-10-26 10:53:41 +04:00
|
|
|
bl _C_LABEL(irq_setmasks) /* Update the actual masks */
|
|
|
|
bl _C_LABEL(dosoftints) /* Process any pending soft ints */
|
1996-03-08 21:03:15 +03:00
|
|
|
ldmfd sp!, {r0, pc} /* Exit */
|
|
|
|
|
1997-10-14 13:54:31 +04:00
|
|
|
ENTRY(splx)
|
2002-08-17 20:36:31 +04:00
|
|
|
ldr r1, .Lcurrent_spl_level /* Get the current spl level */
|
2001-09-28 14:01:02 +04:00
|
|
|
mov r3, r0 /* Save the new value */
|
1996-03-08 21:03:15 +03:00
|
|
|
ldr r0, [r1]
|
|
|
|
cmp r3, r0
|
|
|
|
moveq pc, lr
|
|
|
|
|
1998-09-05 08:01:53 +04:00
|
|
|
str r3, [r1] /* Store the new spl level */
|
1998-03-28 03:14:51 +03:00
|
|
|
|
2002-08-17 20:36:31 +04:00
|
|
|
ldr r2, .Lspl_masks /* Get the spl mask */
|
1996-03-08 21:03:15 +03:00
|
|
|
|
2002-08-17 20:36:31 +04:00
|
|
|
ldr r1, .Lspl_mask /* Store in the current spl mask */
|
1996-03-08 21:03:15 +03:00
|
|
|
|
2001-09-28 14:01:02 +04:00
|
|
|
ldr r2, [r2, r3, lsl #2] /* Use r4 so available later */
|
|
|
|
|
|
|
|
/* stack alignment is 8 bytes */
|
1998-09-05 08:01:53 +04:00
|
|
|
stmfd sp!, {r0, lr} /* Preserve registers */
|
2001-09-28 14:01:02 +04:00
|
|
|
str r2, [r1]
|
|
|
|
|
1999-10-26 10:53:41 +04:00
|
|
|
bl _C_LABEL(irq_setmasks) /* Update the actual masks */
|
|
|
|
bl _C_LABEL(dosoftints) /* Process any pending soft ints */
|
1998-09-05 08:01:53 +04:00
|
|
|
ldmfd sp!, {r0, pc} /* Exit */
|