Slight re-org of the alignment/ast exit macro to better mimic the

original behaviour WRT cpsr/I32_bit handling.
This commit is contained in:
scw 2003-11-14 16:57:28 +00:00
parent b2fe3a3641
commit 571f89c4ad
1 changed files with 15 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: frame.h,v 1.7 2003/10/30 08:57:24 scw Exp $ */ /* $NetBSD: frame.h,v 1.8 2003/11/14 16:57:28 scw Exp $ */
/* /*
* Copyright (c) 1994-1997 Mark Brinicombe. * Copyright (c) 1994-1997 Mark Brinicombe.
@ -198,15 +198,15 @@ void validate_trapframe __P((trapframe_t *, int));
* PULLFRAME at the end of interrupt/exception handlers. * PULLFRAME at the end of interrupt/exception handlers.
*/ */
#define DO_AST_AND_RESTORE_ALIGNMENT_FAULTS \ #define DO_AST_AND_RESTORE_ALIGNMENT_FAULTS \
mrs r4, cpsr /* save CPSR */ ;\
ldr r0, [sp] /* Get the SPSR from stack */ ;\ ldr r0, [sp] /* Get the SPSR from stack */ ;\
orr r4, r4, #(I32_bit) /* Disable IRQs */ ;\ mrs r4, cpsr /* save CPSR */ ;\
msr cpsr_c, r4 ;\
and r0, r0, #(PSR_MODE) /* Returning to USR mode? */ ;\ and r0, r0, #(PSR_MODE) /* Returning to USR mode? */ ;\
teq r0, #(PSR_USR32_MODE) ;\ teq r0, #(PSR_USR32_MODE) ;\
ldreq r5, .Laflt_astpending ;\ ldreq r5, .Laflt_astpending ;\
bne 3f /* Nope, get out now */ ;\ bne 3f /* Nope, get out now */ ;\
1: ldr r1, [r5] /* Pending AST? */ ;\ 1: orr r0, r4, #(I32_bit) /* Disable IRQs */ ;\
msr cpsr_all, r0 ;\
ldr r1, [r5] /* Pending AST? */ ;\
teq r1, #0x00000000 ;\ teq r1, #0x00000000 ;\
bne 2f /* Yup. Go deal with it */ ;\ bne 2f /* Yup. Go deal with it */ ;\
GET_CURPCB_EXIT /* r1 = curpcb, r2 = cpuinfo */ ;\ GET_CURPCB_EXIT /* r1 = curpcb, r2 = cpuinfo */ ;\
@ -222,12 +222,10 @@ void validate_trapframe __P((trapframe_t *, int));
ldr pc, [r2, #CF_CONTROL] /* Set new CTRL reg value */ ;\ ldr pc, [r2, #CF_CONTROL] /* Set new CTRL reg value */ ;\
2: mov r1, #0x00000000 ;\ 2: mov r1, #0x00000000 ;\
str r1, [r5] /* Clear astpending */ ;\ str r1, [r5] /* Clear astpending */ ;\
bic r0, r4, #(I32_bit) /* Enable IRQs */ ;\ msr cpsr_all, r4 /* Restore interrupts */ ;\
msr cpsr_c, r0 ;\
mov r0, sp ;\ mov r0, sp ;\
bl _C_LABEL(ast) /* ast(frame) */ ;\ adr lr, 1b ;\
msr cpsr_c, r4 /* Disable IRQs */ ;\ b _C_LABEL(ast) /* ast(frame) */ ;\
b 1b /* Check for more ASTs */ ;\
3: 3:
#else /* !(COMPAT_15 && EXEC_AOUT) */ #else /* !(COMPAT_15 && EXEC_AOUT) */
@ -239,25 +237,23 @@ void validate_trapframe __P((trapframe_t *, int));
#define ENABLE_ALIGNMENT_FAULTS /* nothing */ #define ENABLE_ALIGNMENT_FAULTS /* nothing */
#define DO_AST_AND_RESTORE_ALIGNMENT_FAULTS \ #define DO_AST_AND_RESTORE_ALIGNMENT_FAULTS \
mrs r4, cpsr /* save CPSR */ ;\
ldr r0, [sp] /* Get the SPSR from stack */ ;\ ldr r0, [sp] /* Get the SPSR from stack */ ;\
orr r4, r4, #(I32_bit) /* Disable IRQs */ ;\ mrs r4, cpsr /* save CPSR */ ;\
msr cpsr_c, r4 ;\
and r0, r0, #(PSR_MODE) /* Returning to USR mode? */ ;\ and r0, r0, #(PSR_MODE) /* Returning to USR mode? */ ;\
teq r0, #(PSR_USR32_MODE) ;\ teq r0, #(PSR_USR32_MODE) ;\
ldreq r5, .Laflt_astpending ;\ ldreq r5, .Laflt_astpending ;\
bne 2f /* Nope, get out now */ ;\ bne 2f /* Nope, get out now */ ;\
1: ldr r1, [r5] /* Pending AST? */ ;\ 1: orr r0, r4, #(I32_bit) /* Disable IRQs */ ;\
msr cpsr_all, r0 ;\
ldr r1, [r5] /* Pending AST? */ ;\
teq r1, #0x00000000 ;\ teq r1, #0x00000000 ;\
beq 2f /* Nope. Just bail */ ;\ beq 2f /* Nope. Just bail */ ;\
mov r1, #0x00000000 ;\ mov r1, #0x00000000 ;\
str r1, [r5] /* Clear astpending */ ;\ str r1, [r5] /* Clear astpending */ ;\
bic r0, r4, #(I32_bit) /* Enable IRQs */ ;\ msr cpsr_all, r4 /* Restore interrupts */ ;\
msr cpsr_c, r0 ;\
mov r0, sp ;\ mov r0, sp ;\
bl _C_LABEL(ast) /* ast(frame) */ ;\ adr lr, 1b ;\
msr cpsr_c, r4 /* Disable IRQs */ ;\ b _C_LABEL(ast) /* ast(frame) */ ;\
b 1b /* Check for more ASTs */ ;\
2: 2:
#endif /* COMPAT_15 && EXEC_AOUT */ #endif /* COMPAT_15 && EXEC_AOUT */