1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
6 * Copyright (C) 1994 - 2000, 2001, 2003 Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2002, 2007 Maciej W. Rozycki
9 * Copyright (C) 2001, 2012 MIPS Technologies, Inc. All rights reserved.
12 #include <asm/asmmacro.h>
13 #include <asm/loongarch.h>
14 #include <asm/regdef.h>
15 #include <asm/fpregdef.h>
16 #include <asm/stackframe.h>
17 #include <asm/thread_info.h>
20 SYM_FUNC_START(__arch_cpu_idle)
21 /* start of rollback region */
22 LONG_L t0, tp, TI_FLAGS
24 andi t0, t0, _TIF_NEED_RESCHED
30 /* end of rollback region */
32 SYM_FUNC_END(__arch_cpu_idle)
34 SYM_CODE_START(handle_vint)
38 la_abs t1, __arch_cpu_idle
40 /* 32 byte rollback region */
50 SYM_CODE_END(handle_vint)
52 SYM_CODE_START(except_vec_cex)
55 SYM_CODE_END(except_vec_cex)
57 .macro build_prep_badv
58 csrrd t0, LOONGARCH_CSR_BADV
59 PTR_S t0, sp, PT_BVADDR
62 .macro build_prep_fcsr
66 .macro build_prep_none
69 .macro BUILD_HANDLER exception handler prep
71 SYM_CODE_START(handle_\exception)
78 la_abs t0, do_\handler
82 SYM_CODE_END(handle_\exception)
83 .pushsection ".data", "aw", %progbits
84 SYM_DATA(unwind_hint_\exception, .word 668b - 666b)
88 BUILD_HANDLER ade ade badv
89 BUILD_HANDLER ale ale badv
90 BUILD_HANDLER bce bce none
91 BUILD_HANDLER bp bp none
92 BUILD_HANDLER fpe fpe fcsr
93 BUILD_HANDLER fpu fpu none
94 BUILD_HANDLER lsx lsx none
95 BUILD_HANDLER lasx lasx none
96 BUILD_HANDLER lbt lbt none
97 BUILD_HANDLER ri ri none
98 BUILD_HANDLER watch watch none
99 BUILD_HANDLER reserved reserved none /* others */
101 SYM_CODE_START(handle_sys)
102 UNWIND_HINT_UNDEFINED
103 la_abs t0, handle_syscall
105 SYM_CODE_END(handle_sys)