~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/loongarch/kernel/entry.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
  4  *
  5  * Derived from MIPS:
  6  * Copyright (C) 1994 - 2000, 2001, 2003 Ralf Baechle
  7  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
  8  * Copyright (C) 2001 MIPS Technologies, Inc.
  9  */
 10 
 11 #include <asm/asm.h>
 12 #include <asm/asmmacro.h>
 13 #include <asm/loongarch.h>
 14 #include <asm/regdef.h>
 15 #include <asm/stackframe.h>
 16 #include <asm/thread_info.h>
 17 #include <asm/unwind_hints.h>
 18 
 19         .text
 20         .cfi_sections   .debug_frame
 21         .align  5
 22 SYM_CODE_START(handle_syscall)
 23         UNWIND_HINT_UNDEFINED
 24         csrrd           t0, PERCPU_BASE_KS
 25         la.pcrel        t1, kernelsp
 26         add.d           t1, t1, t0
 27         move            t2, sp
 28         ld.d            sp, t1, 0
 29 
 30         addi.d          sp, sp, -PT_SIZE
 31         cfi_st          t2, PT_R3
 32         cfi_rel_offset  sp, PT_R3
 33         st.d            zero, sp, PT_R0
 34         csrrd           t2, LOONGARCH_CSR_PRMD
 35         st.d            t2, sp, PT_PRMD
 36         csrrd           t2, LOONGARCH_CSR_CRMD
 37         st.d            t2, sp, PT_CRMD
 38         csrrd           t2, LOONGARCH_CSR_EUEN
 39         st.d            t2, sp, PT_EUEN
 40         csrrd           t2, LOONGARCH_CSR_ECFG
 41         st.d            t2, sp, PT_ECFG
 42         csrrd           t2, LOONGARCH_CSR_ESTAT
 43         st.d            t2, sp, PT_ESTAT
 44         cfi_st          ra, PT_R1
 45         cfi_st          a0, PT_R4
 46         cfi_st          a1, PT_R5
 47         cfi_st          a2, PT_R6
 48         cfi_st          a3, PT_R7
 49         cfi_st          a4, PT_R8
 50         cfi_st          a5, PT_R9
 51         cfi_st          a6, PT_R10
 52         cfi_st          a7, PT_R11
 53         csrrd           ra, LOONGARCH_CSR_ERA
 54         st.d            ra, sp, PT_ERA
 55         cfi_rel_offset  ra, PT_ERA
 56 
 57         cfi_st          tp, PT_R2
 58         cfi_st          u0, PT_R21
 59         cfi_st          fp, PT_R22
 60 
 61         SAVE_STATIC
 62         UNWIND_HINT_REGS
 63 
 64 #ifdef CONFIG_KGDB
 65         li.w            t1, CSR_CRMD_WE
 66         csrxchg         t1, t1, LOONGARCH_CSR_CRMD
 67 #endif
 68 
 69         move            u0, t0
 70         li.d            tp, ~_THREAD_MASK
 71         and             tp, tp, sp
 72 
 73         move            a0, sp
 74         bl              do_syscall
 75 
 76         RESTORE_ALL_AND_RET
 77 SYM_CODE_END(handle_syscall)
 78 _ASM_NOKPROBE(handle_syscall)
 79 
 80 SYM_CODE_START(ret_from_fork)
 81         UNWIND_HINT_REGS
 82         bl              schedule_tail           # a0 = struct task_struct *prev
 83         move            a0, sp
 84         bl              syscall_exit_to_user_mode
 85         RESTORE_STATIC
 86         RESTORE_SOME
 87         RESTORE_SP_AND_RET
 88 SYM_CODE_END(ret_from_fork)
 89 
 90 SYM_CODE_START(ret_from_kernel_thread)
 91         UNWIND_HINT_REGS
 92         bl              schedule_tail           # a0 = struct task_struct *prev
 93         move            a0, s1
 94         jirl            ra, s0, 0
 95         move            a0, sp
 96         bl              syscall_exit_to_user_mode
 97         RESTORE_STATIC
 98         RESTORE_SOME
 99         RESTORE_SP_AND_RET
100 SYM_CODE_END(ret_from_kernel_thread)

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php