Exception vectors: Rearrange to use absolute offets instead of .align hacks

This commit is contained in:
Angus Gratton 2015-09-10 21:35:18 +10:00
parent a5a179beef
commit 45d4e0da2d

View file

@ -12,7 +12,7 @@
Part of esp-open-rtos Part of esp-open-rtos
Original vector contents Copyright (C) 2014-2015 Espressif Systems Original vector contents Copyright (C) 2014-2015 Espressif Systems
Additions Copyright (C) Superhouse Automation Pty Ltd Additions Copyright (C) Superhouse Automation Pty Ltd and Angus Gratton
BSD Licensed as described in the file LICENSE BSD Licensed as described in the file LICENSE
*/ */
@ -23,9 +23,9 @@
.text .text
.section .vecbase.text, "x" .section .vecbase.text, "x"
.align 256
.global VecBase .global VecBase
.type VecBase, @function /* it's not really a function, but treat it like one */ .type VecBase, @function /* it's not really a function, but treat it like one */
.org 0
VecBase: VecBase:
/* IMPORTANT: exception vector literals will go here, but we /* IMPORTANT: exception vector literals will go here, but we
can't have more than 4 otherwise we push DebugExceptionVector past can't have more than 4 otherwise we push DebugExceptionVector past
@ -33,40 +33,43 @@ VecBase:
and also keep the VecBase offsets easy to read, but this works for now. and also keep the VecBase offsets easy to read, but this works for now.
*/ */
.literal_position .literal_position
.align 16 .org 0x10
DebugExceptionVector: DebugExceptionVector:
wsr.excsave2 a0 wsr.excsave2 a0
call0 sdk_user_fatal_exception_handler call0 sdk_user_fatal_exception_handler
rfi 2 rfi 2
.align 16
.org 0x20
NMIExceptionVector: NMIExceptionVector:
wsr.excsave3 a0 wsr.excsave3 a0
call0 CallNMIExceptionHandler call0 CallNMIExceptionHandler
rfi 3 /* CallNMIExceptionHandler should call rfi itself */ rfi 3 /* CallNMIExceptionHandler should call rfi itself */
.align 16
.org 0x30
KernelExceptionVector: KernelExceptionVector:
break 1, 0 break 1, 0
call0 sdk_user_fatal_exception_handler call0 sdk_user_fatal_exception_handler
rfe rfe
.align 16
.L_EmptyVectorEntry: .org 0x50
nop
.align 16
UserExceptionVector: UserExceptionVector:
wsr.excsave1 a0 wsr.excsave1 a0
rsr.exccause a0 rsr.exccause a0
beqi a0, CAUSE_SYSCALL, UserSyscallHandler beqi a0, CAUSE_SYSCALL, UserSyscallHandler
beqi a0, CAUSE_LOADSTORE, UserExceptionLoadStoreHandler beqi a0, CAUSE_LOADSTORE, UserExceptionLoadStoreHandler
j UserExceptionHandler j UserExceptionHandler
/* Empty exception slot goes here, but previous slot is large enough we can skip it */
.align 16 .org 0x70
DoubleExceptionVector: DoubleExceptionVector:
break 1, 4 break 1, 4
j DoubleExceptionHandler rsr.exccause a0
.align 16 beqi a0, CAUSE_LOADSTORE, DoubleExceptionLoadStoreHandler
.L_UnusedResetVector: call0 sdk_user_fatal_exception_handler
/* reset vector slot doesn't get used, as vecbase goes back to mask ROM on reset */
nop /* Reset vector would go here at offset 0x80 but should be unused,
as vecbase goes back to mask ROM vectors on reset */
/***** end of exception vectors *****/
.section .bss .section .bss
NMIHandlerStack: /* stack space for NMI handler */ NMIHandlerStack: /* stack space for NMI handler */
@ -242,15 +245,6 @@ UserSyscallHandler:
rsr.excsave1 a0 rsr.excsave1 a0
rfe rfe
.text
.section .vecbase.text
.literal_position
.align 4
DoubleExceptionHandler:
rsr.exccause a0
beqi a0, CAUSE_LOADSTORE, DoubleExceptionLoadStoreHandler
call0 sdk_user_fatal_exception_handler
.text .text
.section .vecbase.text .section .vecbase.text
.literal_position .literal_position