Skip to content

Commit

Permalink
wip: LoongArch: Kill la.abs
Browse files Browse the repository at this point in the history
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
  • Loading branch information
xry111 committed Sep 3, 2022
1 parent 56a433f commit 48203e6
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 32 deletions.
8 changes: 4 additions & 4 deletions arch/loongarch/include/asm/stackframe.h
Expand Up @@ -76,8 +76,8 @@
* kernelsp array for it. It stores the current sp in t0 and loads the
* new value in sp.
*/
.macro get_saved_sp docfi=0
la.abs t1, kernelsp
.macro get_saved_sp docfi=0
la.pcrel t1, kernelsp
#ifdef CONFIG_SMP
csrrd t0, PERCPU_BASE_KS
LONG_ADD t1, t1, t0
Expand All @@ -89,8 +89,8 @@
LONG_L sp, t1, 0
.endm

.macro set_saved_sp stackp temp temp2
la.abs \temp, kernelsp
.macro set_saved_sp stackp temp temp2
la.pcrel \temp, kernelsp
#ifdef CONFIG_SMP
LONG_ADD \temp, \temp, u0
#endif
Expand Down
1 change: 0 additions & 1 deletion arch/loongarch/include/asm/uaccess.h
Expand Up @@ -21,7 +21,6 @@
extern u64 __ua_limit;

#define __UA_ADDR ".dword"
#define __UA_LA "la.abs"
#define __UA_LIMIT __ua_limit

/*
Expand Down
6 changes: 3 additions & 3 deletions arch/loongarch/kernel/entry.S
Expand Up @@ -18,9 +18,9 @@
.text
.cfi_sections .debug_frame
.align 5
SYM_FUNC_START(handle_syscall)
SYM_FUNC_START(handle_sys)
csrrd t0, PERCPU_BASE_KS
la.abs t1, kernelsp
la.pcrel t1, kernelsp
add.d t1, t1, t0
move t2, sp
ld.d sp, t1, 0
Expand Down Expand Up @@ -66,7 +66,7 @@ SYM_FUNC_START(handle_syscall)
bl do_syscall

RESTORE_ALL_AND_RET
SYM_FUNC_END(handle_syscall)
SYM_FUNC_END(handle_sys)

SYM_CODE_START(ret_from_fork)
bl schedule_tail # a0 = struct task_struct *prev
Expand Down
13 changes: 3 additions & 10 deletions arch/loongarch/kernel/genex.S
Expand Up @@ -34,7 +34,7 @@ SYM_FUNC_END(__arch_cpu_idle)
SYM_FUNC_START(handle_vint)
# BACKUP_T0T1
SAVE_ALL
la.abs t1, __arch_cpu_idle
la.pcrel t1, __arch_cpu_idle
LONG_L t0, sp, PT_ERA
/* 32 byte rollback region */
ori t0, t0, 0x1f
Expand All @@ -43,8 +43,7 @@ SYM_FUNC_START(handle_vint)
LONG_S t0, sp, PT_ERA
1: move a0, sp
move a1, sp
la.abs t0, do_vint
jirl ra, t0, 0
bl do_vint
RESTORE_ALL_AND_RET
SYM_FUNC_END(handle_vint)

Expand All @@ -71,8 +70,7 @@ SYM_FUNC_END(except_vec_cex)
SAVE_ALL
build_prep_\prep
move a0, sp
la.abs t0, do_\handler
jirl ra, t0, 0
bl do_\handler
RESTORE_ALL_AND_RET
SYM_FUNC_END(handle_\exception)
.endm
Expand All @@ -89,11 +87,6 @@ SYM_FUNC_END(except_vec_cex)
BUILD_HANDLER watch watch none
BUILD_HANDLER reserved reserved none /* others */

SYM_FUNC_START(handle_sys)
la.abs t0, handle_syscall
jr t0
SYM_FUNC_END(handle_sys)

SYM_FUNC_START(handler_trampoline)
csrwr t0, EXCEPTION_KS0
csrwr t1, EXCEPTION_KS1
Expand Down
2 changes: 1 addition & 1 deletion arch/loongarch/kernel/head.S
Expand Up @@ -107,7 +107,7 @@ SYM_CODE_START(smpboot_entry)
li.w t0, 0x00 # FPE=0, SXE=0, ASXE=0, BTE=0
csrwr t0, LOONGARCH_CSR_EUEN

la.abs t0, cpuboot_data
la.pcrel t0, cpuboot_data
ld.d sp, t0, CPU_BOOT_STACK
ld.d tp, t0, CPU_BOOT_TINFO

Expand Down
21 changes: 8 additions & 13 deletions arch/loongarch/mm/tlbex.S
Expand Up @@ -17,8 +17,7 @@
move a0, sp
REG_S a2, sp, PT_BVADDR
li.w a1, \write
la.abs t0, do_page_fault
jirl ra, t0, 0
bl do_page_fault
RESTORE_ALL_AND_RET
SYM_FUNC_END(tlb_do_page_fault_\write)
.endm
Expand All @@ -33,8 +32,7 @@ SYM_FUNC_START(handle_tlb_protect)
move a1, zero
csrrd a2, LOONGARCH_CSR_BADV
REG_S a2, sp, PT_BVADDR
la.abs t0, do_page_fault
jirl ra, t0, 0
bl do_page_fault
RESTORE_ALL_AND_RET
SYM_FUNC_END(handle_tlb_protect)

Expand Down Expand Up @@ -123,7 +121,7 @@ leave_load:
ertn
#ifdef CONFIG_64BIT
vmalloc_load:
la.abs t1, swapper_pg_dir
la.pcrel t1, swapper_pg_dir
b vmalloc_done_load
#endif

Expand Down Expand Up @@ -197,8 +195,7 @@ tlb_huge_update_load:
nopage_tlb_load:
dbar 0
csrrd ra, EXCEPTION_KS2
la.abs t0, tlb_do_page_fault_0
jr t0
b tlb_do_page_fault_0
SYM_FUNC_END(handle_tlb_load)

SYM_FUNC_START(handle_tlb_store)
Expand Down Expand Up @@ -289,7 +286,7 @@ leave_store:
ertn
#ifdef CONFIG_64BIT
vmalloc_store:
la.abs t1, swapper_pg_dir
la.pcrel t1, swapper_pg_dir
b vmalloc_done_store
#endif

Expand Down Expand Up @@ -365,8 +362,7 @@ tlb_huge_update_store:
nopage_tlb_store:
dbar 0
csrrd ra, EXCEPTION_KS2
la.abs t0, tlb_do_page_fault_1
jr t0
b tlb_do_page_fault_1
SYM_FUNC_END(handle_tlb_store)

SYM_FUNC_START(handle_tlb_modify)
Expand Down Expand Up @@ -454,7 +450,7 @@ leave_modify:
ertn
#ifdef CONFIG_64BIT
vmalloc_modify:
la.abs t1, swapper_pg_dir
la.pcrel t1, swapper_pg_dir
b vmalloc_done_modify
#endif

Expand Down Expand Up @@ -524,8 +520,7 @@ tlb_huge_update_modify:
nopage_tlb_modify:
dbar 0
csrrd ra, EXCEPTION_KS2
la.abs t0, tlb_do_page_fault_1
jr t0
b tlb_do_page_fault_1
SYM_FUNC_END(handle_tlb_modify)

SYM_FUNC_START(handle_tlb_refill)
Expand Down

0 comments on commit 48203e6

Please sign in to comment.