Rename macroes, as we don't need to mess with alignment faults.

Call ast() if TDF_NEEDRESCHED is set too, not just TDF_ASTPENDING.
This commit is contained in:
cognet 2004-09-23 22:05:40 +00:00
parent f772c01a4d
commit 8cbf7c308c
2 changed files with 19 additions and 51 deletions

View File

@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$");
.text
.align 0
AST_ALIGNMENT_FAULT_LOCALS
AST_LOCALS
/*
* reset_entry:
@ -78,12 +78,11 @@ Lreset_panicmsg:
*/
ASENTRY_NP(swi_entry)
PUSHFRAME
ENABLE_ALIGNMENT_FAULTS
mov r0, sp /* Pass the frame to any function */
bl _C_LABEL(swi_handler) /* It's a SWI ! */
DO_AST_AND_RESTORE_ALIGNMENT_FAULTS
DO_AST
PULLFRAME
movs pc, lr /* Exit */
@ -100,7 +99,6 @@ ASENTRY_NP(prefetch_abort_entry)
sub lr, lr, #0x00000004 /* Adjust the lr */
PUSHFRAMEINSVC
ENABLE_ALIGNMENT_FAULTS
ldr r1, Lprefetch_abort_handler_address
adr lr, exception_exit
mov r0, sp /* pass the stack pointer as r0 */
@ -138,8 +136,6 @@ ASENTRY_NP(data_abort_entry)
sub lr, lr, #0x00000008 /* Adjust the lr */
PUSHFRAMEINSVC /* Push trap frame and switch */
/* to SVC32 mode */
ENABLE_ALIGNMENT_FAULTS
ldr r1, Ldata_abort_handler_address
adr lr, exception_exit
mov r0, sp /* pass the stack pointer as r0 */
@ -191,13 +187,13 @@ Laddress_exception_msg:
* being posted between testing and exit to user mode.
*
* This function uses PULLFRAMEFROMSVCANDEXIT and
* DO_AST_AND_RESTORE_ALIGNMENT_FAULTS thus should
* DO_AST
* only be called if the exception handler used PUSHFRAMEINSVC
* followed by ENABLE_ALIGNMENT_FAULTS.
*
*/
exception_exit:
DO_AST_AND_RESTORE_ALIGNMENT_FAULTS
DO_AST
PULLFRAMEFROMSVCANDEXIT
/*
@ -350,7 +346,6 @@ Lundefined_handler_indirection:
ENTRY_NP(undefinedinstruction_bounce)
PUSHFRAMEINSVC
ENABLE_ALIGNMENT_FAULTS
mov r0, sp
adr lr, exception_exit

View File

@ -141,59 +141,32 @@ name:
#define EMPTY
#define GET_CURPCB_ENTER \
ldr r1, .Laflt_curpcb ;\
ldr r1, [r1]
/*
* This macro must be invoked following PUSHFRAMEINSVC or PUSHFRAME at
* the top of interrupt/exception handlers.
*
* When invoked, r0 *must* contain the value of SPSR on the current
* trap/interrupt frame. This is always the case if ENABLE_ALIGNMENT_FAULTS
* is invoked immediately after PUSHFRAMEINSVC or PUSHFRAME.
*/
#define ENABLE_ALIGNMENT_FAULTS \
and r0, r0, #(PSR_MODE) /* Test for USR32 mode */ ;\
teq r0, #(PSR_USR32_MODE) ;\
bne 1f /* Not USR mode skip AFLT */ ;\
GET_CURPCB_ENTER /* r1 = curpcb */ ;\
cmp r1, #0x00 /* curpcb NULL? */ ;\
ldrne r1, [r1, #PCB_FLAGS] /* Fetch curpcb->pcb_flags */ ;\
tstne r1, #PCB_NOALIGNFLT ;\
beq 1f /* AFLTs already enabled */ ;\
ldr r2, .Laflt_cpufuncs ;\
mov lr, pc ;\
ldr pc, [r2, #CF_CONTROL] /* Enable alignment faults */ ;\
1:
#define DO_AST_AND_RESTORE_ALIGNMENT_FAULTS \
#define DO_AST \
ldr r0, [sp] /* Get the SPSR from stack */ ;\
mrs r4, cpsr /* save CPSR */ ;\
orr r1, r4, #(I32_bit) ;\
msr cpsr_c, r1 /* Disable interrupts */ ;\
and r0, r0, #(PSR_MODE) /* Returning to USR mode? */ ;\
teq r0, #(PSR_USR32_MODE) ;\
bne 2f /* Nope, get out now */ ;\
bic r4, r4, #(I32_bit) ;\
1: orr r0, r4, #(I32_bit) /* Disable IRQs */ ;\
msr cpsr_c, r0 ;\
ldr r5, .Laflt_curthread ;\
1: ldr r5, .Lcurthread ;\
ldr r5, [r5] ;\
ldr r5, [r5, #(TD_FLAGS)] ;\
and r5, r5, #(TDF_ASTPENDING) ;\
teq r5, #0x00000000 ;\
ldr r1, [r5, #(TD_FLAGS)] ;\
and r1, r1, #(TDF_ASTPENDING|TDF_NEEDRESCHED) ;\
teq r1, #0x00000000 ;\
beq 2f /* Nope. Just bail */ ;\
msr cpsr_c, r4 /* Restore interrupts */ ;\
mov r0, sp ;\
adr lr, 1b ;\
b _C_LABEL(ast) /* ast(frame) */ ;\
bl _C_LABEL(ast) /* ast(frame) */ ;\
orr r0, r4, #(I32_bit) ;\
msr cpsr_c, r0 ;\
b 1b ;\
2:
#define AST_ALIGNMENT_FAULT_LOCALS ;\
.Laflt_curpcb: ;\
.word _C_LABEL(__pcpu) + PC_CURPCB ;\
.Laflt_cpufuncs: ;\
.word _C_LABEL(cpufuncs) ;\
.Laflt_curthread: ;\
#define AST_LOCALS ;\
.Lcurthread: ;\
.word _C_LABEL(__pcpu) + PC_CURTHREAD