2020-01-10 10:38:21 +08:00
|
|
|
/*
|
2022-12-20 17:49:37 +08:00
|
|
|
* Copyright (c) 2006-2020, RT-Thread Development Team
|
2020-01-15 16:46:19 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
2024-06-28 00:23:09 +08:00
|
|
|
* Change Logs:
|
2020-01-10 10:38:21 +08:00
|
|
|
* Date Author Notes
|
2024-06-28 00:23:09 +08:00
|
|
|
* 2018-10-06 ZhaoXiaowei the first version
|
|
|
|
* 2024-03-28 Shell Move vector handling codes from context_gcc.S
|
2020-01-10 10:38:21 +08:00
|
|
|
*/
|
|
|
|
|
2024-06-28 00:23:09 +08:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#define __ASSEMBLY__
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <rtconfig.h>
|
|
|
|
|
|
|
|
.text
|
2020-01-10 10:38:21 +08:00
|
|
|
.globl system_vectors
|
2022-12-20 17:49:37 +08:00
|
|
|
.globl vector_exception
|
2020-01-10 10:38:21 +08:00
|
|
|
.globl vector_irq
|
|
|
|
.globl vector_fiq
|
2022-12-20 17:49:37 +08:00
|
|
|
|
2022-02-17 01:00:29 +08:00
|
|
|
system_vectors:
|
2022-12-20 17:49:37 +08:00
|
|
|
.align 11
|
|
|
|
.set VBAR, system_vectors
|
|
|
|
.org VBAR
|
|
|
|
|
|
|
|
/* Exception from CurrentEL (EL1) with SP_EL0 (SPSEL=1) */
|
|
|
|
.org (VBAR + 0x00 + 0)
|
2024-06-28 00:23:09 +08:00
|
|
|
b vector_serror /* Synchronous */
|
2022-12-20 17:49:37 +08:00
|
|
|
.org (VBAR + 0x80 + 0)
|
2024-06-28 00:23:09 +08:00
|
|
|
b vector_serror /* IRQ/vIRQ */
|
2022-12-20 17:49:37 +08:00
|
|
|
.org (VBAR + 0x100 + 0)
|
2024-06-28 00:23:09 +08:00
|
|
|
b vector_serror /* FIQ/vFIQ */
|
2022-12-20 17:49:37 +08:00
|
|
|
.org (VBAR + 0x180 + 0)
|
2024-06-28 00:23:09 +08:00
|
|
|
b vector_serror /* Error/vError */
|
2020-01-10 10:38:21 +08:00
|
|
|
|
2022-12-20 17:49:37 +08:00
|
|
|
/* Exception from CurrentEL (EL1) with SP_ELn */
|
|
|
|
.org (VBAR + 0x200 + 0)
|
2024-06-28 00:23:09 +08:00
|
|
|
b vector_exception /* Synchronous */
|
2022-12-20 17:49:37 +08:00
|
|
|
.org (VBAR + 0x280 + 0)
|
2024-06-28 00:23:09 +08:00
|
|
|
b vector_irq /* IRQ/vIRQ */
|
2022-12-20 17:49:37 +08:00
|
|
|
.org (VBAR + 0x300 + 0)
|
2024-06-28 00:23:09 +08:00
|
|
|
b vector_fiq /* FIQ/vFIQ */
|
2022-12-20 17:49:37 +08:00
|
|
|
.org (VBAR + 0x380 + 0)
|
2024-06-28 00:23:09 +08:00
|
|
|
b vector_serror
|
2020-01-10 10:38:21 +08:00
|
|
|
|
2022-02-17 01:00:29 +08:00
|
|
|
/* Exception from lower EL, aarch64 */
|
2022-12-20 17:49:37 +08:00
|
|
|
.org (VBAR + 0x400 + 0)
|
2024-06-28 00:23:09 +08:00
|
|
|
b vector_exception
|
2022-12-20 17:49:37 +08:00
|
|
|
.org (VBAR + 0x480 + 0)
|
2024-06-28 00:23:09 +08:00
|
|
|
b vector_irq
|
2022-12-20 17:49:37 +08:00
|
|
|
.org (VBAR + 0x500 + 0)
|
2024-06-28 00:23:09 +08:00
|
|
|
b vector_fiq
|
2022-12-20 17:49:37 +08:00
|
|
|
.org (VBAR + 0x580 + 0)
|
2024-06-28 00:23:09 +08:00
|
|
|
b vector_serror
|
2020-01-10 10:38:21 +08:00
|
|
|
|
2022-02-17 01:00:29 +08:00
|
|
|
/* Exception from lower EL, aarch32 */
|
2022-12-20 17:49:37 +08:00
|
|
|
.org (VBAR + 0x600 + 0)
|
2024-06-28 00:23:09 +08:00
|
|
|
b vector_serror
|
2022-12-20 17:49:37 +08:00
|
|
|
.org (VBAR + 0x680 + 0)
|
2024-06-28 00:23:09 +08:00
|
|
|
b vector_serror
|
2022-12-20 17:49:37 +08:00
|
|
|
.org (VBAR + 0x700 + 0)
|
2024-06-28 00:23:09 +08:00
|
|
|
b vector_serror
|
2022-12-20 17:49:37 +08:00
|
|
|
.org (VBAR + 0x780 + 0)
|
2024-06-28 00:23:09 +08:00
|
|
|
b vector_serror
|
|
|
|
|
|
|
|
#include "include/vector_gcc.h"
|
2024-08-27 12:45:12 +08:00
|
|
|
#define EFRAMEX x19
|
2024-06-28 00:23:09 +08:00
|
|
|
|
|
|
|
START_POINT(vector_exception)
|
|
|
|
SAVE_IRQ_CONTEXT
|
2024-08-27 12:45:12 +08:00
|
|
|
mov EFRAMEX, sp
|
|
|
|
|
|
|
|
SAVE_USER_CTX EFRAMEX, x0
|
2024-06-28 00:23:09 +08:00
|
|
|
|
2024-08-27 12:45:12 +08:00
|
|
|
mov x0, EFRAMEX
|
2024-06-28 00:23:09 +08:00
|
|
|
bl rt_hw_trap_exception
|
2024-08-27 12:45:12 +08:00
|
|
|
RESTORE_USER_CTX EFRAMEX, x0
|
2024-06-28 00:23:09 +08:00
|
|
|
|
2024-09-14 10:52:46 +08:00
|
|
|
/* do exception switch for IRQ/exception handlers */
|
|
|
|
EXCEPTION_SWITCH sp, x0
|
|
|
|
|
2024-08-27 12:45:12 +08:00
|
|
|
RESTORE_IRQ_CONTEXT
|
2024-09-14 10:52:46 +08:00
|
|
|
eret
|
2024-06-28 00:23:09 +08:00
|
|
|
START_POINT_END(vector_exception)
|
|
|
|
|
|
|
|
START_POINT(vector_serror)
|
|
|
|
SAVE_IRQ_CONTEXT
|
2024-08-27 12:45:12 +08:00
|
|
|
mov EFRAMEX, sp
|
2024-06-28 00:23:09 +08:00
|
|
|
|
2024-08-27 12:45:12 +08:00
|
|
|
SAVE_USER_CTX EFRAMEX, x0
|
2024-06-28 00:23:09 +08:00
|
|
|
|
2024-08-27 12:45:12 +08:00
|
|
|
mov x0, EFRAMEX
|
2024-06-28 00:23:09 +08:00
|
|
|
bl rt_hw_trap_serror
|
2024-08-27 12:45:12 +08:00
|
|
|
|
|
|
|
RESTORE_USER_CTX EFRAMEX, x0
|
|
|
|
|
|
|
|
NEVER_RETURN
|
2024-06-28 00:23:09 +08:00
|
|
|
START_POINT_END(vector_serror)
|
2024-08-27 12:45:12 +08:00
|
|
|
|
|
|
|
START_POINT(vector_irq)
|
|
|
|
SAVE_IRQ_CONTEXT
|
|
|
|
mov EFRAMEX, sp
|
|
|
|
|
|
|
|
/* trace IRQ level */
|
|
|
|
bl rt_interrupt_enter
|
|
|
|
|
|
|
|
SAVE_USER_CTX EFRAMEX, x0
|
|
|
|
|
|
|
|
/* handline IRQ */
|
|
|
|
mov x0, EFRAMEX
|
|
|
|
bl rt_hw_trap_irq
|
|
|
|
|
|
|
|
RESTORE_USER_CTX EFRAMEX, x0
|
|
|
|
|
|
|
|
/* restore IRQ level */
|
|
|
|
bl rt_interrupt_leave
|
|
|
|
|
|
|
|
mov x0, EFRAMEX
|
|
|
|
bl rt_hw_vector_irq_sched
|
|
|
|
|
|
|
|
b rt_hw_irq_exit
|
|
|
|
START_POINT_END(vector_irq)
|
|
|
|
|
|
|
|
rt_hw_irq_exit:
|
|
|
|
.globl rt_hw_irq_exit
|
|
|
|
|
2024-09-14 10:52:46 +08:00
|
|
|
/* do exception switch for IRQ/exception handlers */
|
|
|
|
EXCEPTION_SWITCH sp, x0
|
|
|
|
|
2024-08-27 12:45:12 +08:00
|
|
|
RESTORE_IRQ_CONTEXT
|
2024-09-14 10:52:46 +08:00
|
|
|
eret
|