Commit 00c2ca84 authored by Tiezhu Yang's avatar Tiezhu Yang Committed by Huacai Chen

LoongArch: Use SYM_CODE_* to annotate exception handlers

As described in include/linux/linkage.h,

  FUNC -- C-like functions (proper stack frame etc.)
  CODE -- non-C code (e.g. irq handlers with different, special stack etc.)

  SYM_FUNC_{START, END} -- use for global functions
  SYM_CODE_{START, END} -- use for non-C (special) functions

So use SYM_CODE_* to annotate exception handlers.
Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
parent 58720809
...@@ -33,4 +33,12 @@ ...@@ -33,4 +33,12 @@
.cfi_endproc; \ .cfi_endproc; \
SYM_END(name, SYM_T_FUNC) SYM_END(name, SYM_T_FUNC)
#define SYM_CODE_START(name) \
SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) \
.cfi_startproc;
#define SYM_CODE_END(name) \
.cfi_endproc; \
SYM_END(name, SYM_T_NONE)
#endif #endif
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
.text .text
.cfi_sections .debug_frame .cfi_sections .debug_frame
.align 5 .align 5
SYM_FUNC_START(handle_syscall) SYM_CODE_START(handle_syscall)
csrrd t0, PERCPU_BASE_KS csrrd t0, PERCPU_BASE_KS
la.pcrel t1, kernelsp la.pcrel t1, kernelsp
add.d t1, t1, t0 add.d t1, t1, t0
...@@ -71,7 +71,7 @@ SYM_FUNC_START(handle_syscall) ...@@ -71,7 +71,7 @@ SYM_FUNC_START(handle_syscall)
bl do_syscall bl do_syscall
RESTORE_ALL_AND_RET RESTORE_ALL_AND_RET
SYM_FUNC_END(handle_syscall) SYM_CODE_END(handle_syscall)
_ASM_NOKPROBE(handle_syscall) _ASM_NOKPROBE(handle_syscall)
SYM_CODE_START(ret_from_fork) SYM_CODE_START(ret_from_fork)
......
...@@ -31,7 +31,7 @@ SYM_FUNC_START(__arch_cpu_idle) ...@@ -31,7 +31,7 @@ SYM_FUNC_START(__arch_cpu_idle)
1: jr ra 1: jr ra
SYM_FUNC_END(__arch_cpu_idle) SYM_FUNC_END(__arch_cpu_idle)
SYM_FUNC_START(handle_vint) SYM_CODE_START(handle_vint)
BACKUP_T0T1 BACKUP_T0T1
SAVE_ALL SAVE_ALL
la_abs t1, __arch_cpu_idle la_abs t1, __arch_cpu_idle
...@@ -46,11 +46,11 @@ SYM_FUNC_START(handle_vint) ...@@ -46,11 +46,11 @@ SYM_FUNC_START(handle_vint)
la_abs t0, do_vint la_abs t0, do_vint
jirl ra, t0, 0 jirl ra, t0, 0
RESTORE_ALL_AND_RET RESTORE_ALL_AND_RET
SYM_FUNC_END(handle_vint) SYM_CODE_END(handle_vint)
SYM_FUNC_START(except_vec_cex) SYM_CODE_START(except_vec_cex)
b cache_parity_error b cache_parity_error
SYM_FUNC_END(except_vec_cex) SYM_CODE_END(except_vec_cex)
.macro build_prep_badv .macro build_prep_badv
csrrd t0, LOONGARCH_CSR_BADV csrrd t0, LOONGARCH_CSR_BADV
...@@ -66,7 +66,7 @@ SYM_FUNC_END(except_vec_cex) ...@@ -66,7 +66,7 @@ SYM_FUNC_END(except_vec_cex)
.macro BUILD_HANDLER exception handler prep .macro BUILD_HANDLER exception handler prep
.align 5 .align 5
SYM_FUNC_START(handle_\exception) SYM_CODE_START(handle_\exception)
666: 666:
BACKUP_T0T1 BACKUP_T0T1
SAVE_ALL SAVE_ALL
...@@ -76,7 +76,7 @@ SYM_FUNC_END(except_vec_cex) ...@@ -76,7 +76,7 @@ SYM_FUNC_END(except_vec_cex)
jirl ra, t0, 0 jirl ra, t0, 0
668: 668:
RESTORE_ALL_AND_RET RESTORE_ALL_AND_RET
SYM_FUNC_END(handle_\exception) SYM_CODE_END(handle_\exception)
SYM_DATA(unwind_hint_\exception, .word 668b - 666b) SYM_DATA(unwind_hint_\exception, .word 668b - 666b)
.endm .endm
...@@ -93,7 +93,7 @@ SYM_FUNC_END(except_vec_cex) ...@@ -93,7 +93,7 @@ SYM_FUNC_END(except_vec_cex)
BUILD_HANDLER watch watch none BUILD_HANDLER watch watch none
BUILD_HANDLER reserved reserved none /* others */ BUILD_HANDLER reserved reserved none /* others */
SYM_FUNC_START(handle_sys) SYM_CODE_START(handle_sys)
la_abs t0, handle_syscall la_abs t0, handle_syscall
jr t0 jr t0
SYM_FUNC_END(handle_sys) SYM_CODE_END(handle_sys)
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#define PTRS_PER_PTE_BITS (PAGE_SHIFT - 3) #define PTRS_PER_PTE_BITS (PAGE_SHIFT - 3)
.macro tlb_do_page_fault, write .macro tlb_do_page_fault, write
SYM_FUNC_START(tlb_do_page_fault_\write) SYM_CODE_START(tlb_do_page_fault_\write)
SAVE_ALL SAVE_ALL
csrrd a2, LOONGARCH_CSR_BADV csrrd a2, LOONGARCH_CSR_BADV
move a0, sp move a0, sp
...@@ -25,13 +25,13 @@ ...@@ -25,13 +25,13 @@
li.w a1, \write li.w a1, \write
bl do_page_fault bl do_page_fault
RESTORE_ALL_AND_RET RESTORE_ALL_AND_RET
SYM_FUNC_END(tlb_do_page_fault_\write) SYM_CODE_END(tlb_do_page_fault_\write)
.endm .endm
tlb_do_page_fault 0 tlb_do_page_fault 0
tlb_do_page_fault 1 tlb_do_page_fault 1
SYM_FUNC_START(handle_tlb_protect) SYM_CODE_START(handle_tlb_protect)
BACKUP_T0T1 BACKUP_T0T1
SAVE_ALL SAVE_ALL
move a0, sp move a0, sp
...@@ -41,9 +41,9 @@ SYM_FUNC_START(handle_tlb_protect) ...@@ -41,9 +41,9 @@ SYM_FUNC_START(handle_tlb_protect)
la_abs t0, do_page_fault la_abs t0, do_page_fault
jirl ra, t0, 0 jirl ra, t0, 0
RESTORE_ALL_AND_RET RESTORE_ALL_AND_RET
SYM_FUNC_END(handle_tlb_protect) SYM_CODE_END(handle_tlb_protect)
SYM_FUNC_START(handle_tlb_load) SYM_CODE_START(handle_tlb_load)
csrwr t0, EXCEPTION_KS0 csrwr t0, EXCEPTION_KS0
csrwr t1, EXCEPTION_KS1 csrwr t1, EXCEPTION_KS1
csrwr ra, EXCEPTION_KS2 csrwr ra, EXCEPTION_KS2
...@@ -187,16 +187,16 @@ nopage_tlb_load: ...@@ -187,16 +187,16 @@ nopage_tlb_load:
csrrd ra, EXCEPTION_KS2 csrrd ra, EXCEPTION_KS2
la_abs t0, tlb_do_page_fault_0 la_abs t0, tlb_do_page_fault_0
jr t0 jr t0
SYM_FUNC_END(handle_tlb_load) SYM_CODE_END(handle_tlb_load)
SYM_FUNC_START(handle_tlb_load_ptw) SYM_CODE_START(handle_tlb_load_ptw)
csrwr t0, LOONGARCH_CSR_KS0 csrwr t0, LOONGARCH_CSR_KS0
csrwr t1, LOONGARCH_CSR_KS1 csrwr t1, LOONGARCH_CSR_KS1
la_abs t0, tlb_do_page_fault_0 la_abs t0, tlb_do_page_fault_0
jr t0 jr t0
SYM_FUNC_END(handle_tlb_load_ptw) SYM_CODE_END(handle_tlb_load_ptw)
SYM_FUNC_START(handle_tlb_store) SYM_CODE_START(handle_tlb_store)
csrwr t0, EXCEPTION_KS0 csrwr t0, EXCEPTION_KS0
csrwr t1, EXCEPTION_KS1 csrwr t1, EXCEPTION_KS1
csrwr ra, EXCEPTION_KS2 csrwr ra, EXCEPTION_KS2
...@@ -343,16 +343,16 @@ nopage_tlb_store: ...@@ -343,16 +343,16 @@ nopage_tlb_store:
csrrd ra, EXCEPTION_KS2 csrrd ra, EXCEPTION_KS2
la_abs t0, tlb_do_page_fault_1 la_abs t0, tlb_do_page_fault_1
jr t0 jr t0
SYM_FUNC_END(handle_tlb_store) SYM_CODE_END(handle_tlb_store)
SYM_FUNC_START(handle_tlb_store_ptw) SYM_CODE_START(handle_tlb_store_ptw)
csrwr t0, LOONGARCH_CSR_KS0 csrwr t0, LOONGARCH_CSR_KS0
csrwr t1, LOONGARCH_CSR_KS1 csrwr t1, LOONGARCH_CSR_KS1
la_abs t0, tlb_do_page_fault_1 la_abs t0, tlb_do_page_fault_1
jr t0 jr t0
SYM_FUNC_END(handle_tlb_store_ptw) SYM_CODE_END(handle_tlb_store_ptw)
SYM_FUNC_START(handle_tlb_modify) SYM_CODE_START(handle_tlb_modify)
csrwr t0, EXCEPTION_KS0 csrwr t0, EXCEPTION_KS0
csrwr t1, EXCEPTION_KS1 csrwr t1, EXCEPTION_KS1
csrwr ra, EXCEPTION_KS2 csrwr ra, EXCEPTION_KS2
...@@ -497,16 +497,16 @@ nopage_tlb_modify: ...@@ -497,16 +497,16 @@ nopage_tlb_modify:
csrrd ra, EXCEPTION_KS2 csrrd ra, EXCEPTION_KS2
la_abs t0, tlb_do_page_fault_1 la_abs t0, tlb_do_page_fault_1
jr t0 jr t0
SYM_FUNC_END(handle_tlb_modify) SYM_CODE_END(handle_tlb_modify)
SYM_FUNC_START(handle_tlb_modify_ptw) SYM_CODE_START(handle_tlb_modify_ptw)
csrwr t0, LOONGARCH_CSR_KS0 csrwr t0, LOONGARCH_CSR_KS0
csrwr t1, LOONGARCH_CSR_KS1 csrwr t1, LOONGARCH_CSR_KS1
la_abs t0, tlb_do_page_fault_1 la_abs t0, tlb_do_page_fault_1
jr t0 jr t0
SYM_FUNC_END(handle_tlb_modify_ptw) SYM_CODE_END(handle_tlb_modify_ptw)
SYM_FUNC_START(handle_tlb_refill) SYM_CODE_START(handle_tlb_refill)
csrwr t0, LOONGARCH_CSR_TLBRSAVE csrwr t0, LOONGARCH_CSR_TLBRSAVE
csrrd t0, LOONGARCH_CSR_PGD csrrd t0, LOONGARCH_CSR_PGD
lddir t0, t0, 3 lddir t0, t0, 3
...@@ -521,4 +521,4 @@ SYM_FUNC_START(handle_tlb_refill) ...@@ -521,4 +521,4 @@ SYM_FUNC_START(handle_tlb_refill)
tlbfill tlbfill
csrrd t0, LOONGARCH_CSR_TLBRSAVE csrrd t0, LOONGARCH_CSR_TLBRSAVE
ertn ertn
SYM_FUNC_END(handle_tlb_refill) SYM_CODE_END(handle_tlb_refill)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment