1/*
2 * Copyright (c) 2006-2020, RT-Thread Development Team
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Change Logs:
7 * Date           Author       Notes
8 * 2024-03-28     Shell        Move vector handling codes from context_gcc.S
9 */
10
11#ifndef __ASSEMBLY__
12#define __ASSEMBLY__
13#endif
14
15#include "../include/vector_gcc.h"
16#include "context_gcc.h"
17
18#include <rtconfig.h>
19#include <asm-generic.h>
20#include <asm-fpu.h>
21#include <armv8.h>
22
23.section .text
24
25vector_fiq:
26    .align  8
27    .globl vector_fiq
28
29    SAVE_IRQ_CONTEXT
30    bl      rt_hw_trap_fiq
31
32    b       rt_hw_irq_exit
33
34.globl      rt_thread_switch_interrupt_flag
35.globl      rt_hw_context_switch_interrupt_do
36
37/**
38 * void rt_hw_vector_irq_sched(void *eframe)
39 * @brief do IRQ scheduling
40 */
41rt_hw_vector_irq_sched:
42    .globl rt_hw_vector_irq_sched
43    .align  8
44
45    /**
46     * if rt_thread_switch_interrupt_flag set, jump to
47     * rt_hw_context_switch_interrupt_do and don't return
48     */
49    ldr     x1, =rt_thread_switch_interrupt_flag
50    ldr     x2, [x1]
51    cmp     x2, #1
52    bne     1f
53
54    /* clear flag */
55    mov     x2,  #0
56    str     x2,  [x1]
57
58    bl      rt_hw_context_switch_interrupt_do
59
601:
61    b       rt_hw_irq_exit
62