1 #------------------------------------------------------------------------------
3 # InternalSwitchStackAsm for LoongArch
5 # Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
7 # SPDX-License-Identifier: BSD-2-Clause-Patent
9 #------------------------------------------------------------------------------
11 #define STORE st.d /* 64 bit mode regsave instruction */
12 #define LOAD ld.d /* 64 bit mode regload instruction */
13 #define RSIZE 8 /* 64 bit mode register size */
15 ASM_GLOBAL ASM_PFX(InternalSwitchStackAsm)
18 This allows the caller to switch the stack and goes to the new entry point
20 @param JumpBuffer A pointer to CPU context buffer.
23 ASM_PFX(InternalSwitchStackAsm):
24 LOAD $ra, $a0, RSIZE * 11
25 LOAD $s0, $a0, RSIZE * 0
26 LOAD $s1, $a0, RSIZE * 1
27 LOAD $s2, $a0, RSIZE * 2
28 LOAD $s3, $a0, RSIZE * 3
29 LOAD $s4, $a0, RSIZE * 4
30 LOAD $s5, $a0, RSIZE * 5
31 LOAD $s6, $a0, RSIZE * 6
32 LOAD $s7, $a0, RSIZE * 7
33 LOAD $s8, $a0, RSIZE * 8
34 LOAD $sp, $a0, RSIZE * 9
35 LOAD $fp, $a0, RSIZE * 10