Skip to content

Commit 00c2ca8

Browse files
seehearfeelchenhuacai
authored andcommitted
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: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 5872080 commit 00c2ca8

File tree

4 files changed

+36
-28
lines changed

4 files changed

+36
-28
lines changed

arch/loongarch/include/asm/linkage.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,12 @@
3333
.cfi_endproc; \
3434
SYM_END(name, SYM_T_FUNC)
3535

36+
#define SYM_CODE_START(name) \
37+
SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) \
38+
.cfi_startproc;
39+
40+
#define SYM_CODE_END(name) \
41+
.cfi_endproc; \
42+
SYM_END(name, SYM_T_NONE)
43+
3644
#endif

arch/loongarch/kernel/entry.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
.text
1919
.cfi_sections .debug_frame
2020
.align 5
21-
SYM_FUNC_START(handle_syscall)
21+
SYM_CODE_START(handle_syscall)
2222
csrrd t0, PERCPU_BASE_KS
2323
la.pcrel t1, kernelsp
2424
add.d t1, t1, t0
@@ -71,7 +71,7 @@ SYM_FUNC_START(handle_syscall)
7171
bl do_syscall
7272

7373
RESTORE_ALL_AND_RET
74-
SYM_FUNC_END(handle_syscall)
74+
SYM_CODE_END(handle_syscall)
7575
_ASM_NOKPROBE(handle_syscall)
7676

7777
SYM_CODE_START(ret_from_fork)

arch/loongarch/kernel/genex.S

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ SYM_FUNC_START(__arch_cpu_idle)
3131
1: jr ra
3232
SYM_FUNC_END(__arch_cpu_idle)
3333

34-
SYM_FUNC_START(handle_vint)
34+
SYM_CODE_START(handle_vint)
3535
BACKUP_T0T1
3636
SAVE_ALL
3737
la_abs t1, __arch_cpu_idle
@@ -46,11 +46,11 @@ SYM_FUNC_START(handle_vint)
4646
la_abs t0, do_vint
4747
jirl ra, t0, 0
4848
RESTORE_ALL_AND_RET
49-
SYM_FUNC_END(handle_vint)
49+
SYM_CODE_END(handle_vint)
5050

51-
SYM_FUNC_START(except_vec_cex)
51+
SYM_CODE_START(except_vec_cex)
5252
b cache_parity_error
53-
SYM_FUNC_END(except_vec_cex)
53+
SYM_CODE_END(except_vec_cex)
5454

5555
.macro build_prep_badv
5656
csrrd t0, LOONGARCH_CSR_BADV
@@ -66,7 +66,7 @@ SYM_FUNC_END(except_vec_cex)
6666

6767
.macro BUILD_HANDLER exception handler prep
6868
.align 5
69-
SYM_FUNC_START(handle_\exception)
69+
SYM_CODE_START(handle_\exception)
7070
666:
7171
BACKUP_T0T1
7272
SAVE_ALL
@@ -76,7 +76,7 @@ SYM_FUNC_END(except_vec_cex)
7676
jirl ra, t0, 0
7777
668:
7878
RESTORE_ALL_AND_RET
79-
SYM_FUNC_END(handle_\exception)
79+
SYM_CODE_END(handle_\exception)
8080
SYM_DATA(unwind_hint_\exception, .word 668b - 666b)
8181
.endm
8282

@@ -93,7 +93,7 @@ SYM_FUNC_END(except_vec_cex)
9393
BUILD_HANDLER watch watch none
9494
BUILD_HANDLER reserved reserved none /* others */
9595

96-
SYM_FUNC_START(handle_sys)
96+
SYM_CODE_START(handle_sys)
9797
la_abs t0, handle_syscall
9898
jr t0
99-
SYM_FUNC_END(handle_sys)
99+
SYM_CODE_END(handle_sys)

arch/loongarch/mm/tlbex.S

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@
1717
#define PTRS_PER_PTE_BITS (PAGE_SHIFT - 3)
1818

1919
.macro tlb_do_page_fault, write
20-
SYM_FUNC_START(tlb_do_page_fault_\write)
20+
SYM_CODE_START(tlb_do_page_fault_\write)
2121
SAVE_ALL
2222
csrrd a2, LOONGARCH_CSR_BADV
2323
move a0, sp
2424
REG_S a2, sp, PT_BVADDR
2525
li.w a1, \write
2626
bl do_page_fault
2727
RESTORE_ALL_AND_RET
28-
SYM_FUNC_END(tlb_do_page_fault_\write)
28+
SYM_CODE_END(tlb_do_page_fault_\write)
2929
.endm
3030

3131
tlb_do_page_fault 0
3232
tlb_do_page_fault 1
3333

34-
SYM_FUNC_START(handle_tlb_protect)
34+
SYM_CODE_START(handle_tlb_protect)
3535
BACKUP_T0T1
3636
SAVE_ALL
3737
move a0, sp
@@ -41,9 +41,9 @@ SYM_FUNC_START(handle_tlb_protect)
4141
la_abs t0, do_page_fault
4242
jirl ra, t0, 0
4343
RESTORE_ALL_AND_RET
44-
SYM_FUNC_END(handle_tlb_protect)
44+
SYM_CODE_END(handle_tlb_protect)
4545

46-
SYM_FUNC_START(handle_tlb_load)
46+
SYM_CODE_START(handle_tlb_load)
4747
csrwr t0, EXCEPTION_KS0
4848
csrwr t1, EXCEPTION_KS1
4949
csrwr ra, EXCEPTION_KS2
@@ -187,16 +187,16 @@ nopage_tlb_load:
187187
csrrd ra, EXCEPTION_KS2
188188
la_abs t0, tlb_do_page_fault_0
189189
jr t0
190-
SYM_FUNC_END(handle_tlb_load)
190+
SYM_CODE_END(handle_tlb_load)
191191

192-
SYM_FUNC_START(handle_tlb_load_ptw)
192+
SYM_CODE_START(handle_tlb_load_ptw)
193193
csrwr t0, LOONGARCH_CSR_KS0
194194
csrwr t1, LOONGARCH_CSR_KS1
195195
la_abs t0, tlb_do_page_fault_0
196196
jr t0
197-
SYM_FUNC_END(handle_tlb_load_ptw)
197+
SYM_CODE_END(handle_tlb_load_ptw)
198198

199-
SYM_FUNC_START(handle_tlb_store)
199+
SYM_CODE_START(handle_tlb_store)
200200
csrwr t0, EXCEPTION_KS0
201201
csrwr t1, EXCEPTION_KS1
202202
csrwr ra, EXCEPTION_KS2
@@ -343,16 +343,16 @@ nopage_tlb_store:
343343
csrrd ra, EXCEPTION_KS2
344344
la_abs t0, tlb_do_page_fault_1
345345
jr t0
346-
SYM_FUNC_END(handle_tlb_store)
346+
SYM_CODE_END(handle_tlb_store)
347347

348-
SYM_FUNC_START(handle_tlb_store_ptw)
348+
SYM_CODE_START(handle_tlb_store_ptw)
349349
csrwr t0, LOONGARCH_CSR_KS0
350350
csrwr t1, LOONGARCH_CSR_KS1
351351
la_abs t0, tlb_do_page_fault_1
352352
jr t0
353-
SYM_FUNC_END(handle_tlb_store_ptw)
353+
SYM_CODE_END(handle_tlb_store_ptw)
354354

355-
SYM_FUNC_START(handle_tlb_modify)
355+
SYM_CODE_START(handle_tlb_modify)
356356
csrwr t0, EXCEPTION_KS0
357357
csrwr t1, EXCEPTION_KS1
358358
csrwr ra, EXCEPTION_KS2
@@ -497,16 +497,16 @@ nopage_tlb_modify:
497497
csrrd ra, EXCEPTION_KS2
498498
la_abs t0, tlb_do_page_fault_1
499499
jr t0
500-
SYM_FUNC_END(handle_tlb_modify)
500+
SYM_CODE_END(handle_tlb_modify)
501501

502-
SYM_FUNC_START(handle_tlb_modify_ptw)
502+
SYM_CODE_START(handle_tlb_modify_ptw)
503503
csrwr t0, LOONGARCH_CSR_KS0
504504
csrwr t1, LOONGARCH_CSR_KS1
505505
la_abs t0, tlb_do_page_fault_1
506506
jr t0
507-
SYM_FUNC_END(handle_tlb_modify_ptw)
507+
SYM_CODE_END(handle_tlb_modify_ptw)
508508

509-
SYM_FUNC_START(handle_tlb_refill)
509+
SYM_CODE_START(handle_tlb_refill)
510510
csrwr t0, LOONGARCH_CSR_TLBRSAVE
511511
csrrd t0, LOONGARCH_CSR_PGD
512512
lddir t0, t0, 3
@@ -521,4 +521,4 @@ SYM_FUNC_START(handle_tlb_refill)
521521
tlbfill
522522
csrrd t0, LOONGARCH_CSR_TLBRSAVE
523523
ertn
524-
SYM_FUNC_END(handle_tlb_refill)
524+
SYM_CODE_END(handle_tlb_refill)

0 commit comments

Comments
 (0)