]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseLib/LoongArch64/SwitchStack.S
MdePkg/BaseLib: BaseLib for LOONGARCH64 architecture.
[mirror_edk2.git] / MdePkg / Library / BaseLib / LoongArch64 / SwitchStack.S
CommitLineData
cd24eb57
CL
1#------------------------------------------------------------------------------\r
2#\r
3# InternalSwitchStackAsm for LoongArch\r
4#\r
5# Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>\r
6#\r
7# SPDX-License-Identifier: BSD-2-Clause-Patent\r
8#\r
9#------------------------------------------------------------------------------\r
10\r
11#define STORE st.d /* 64 bit mode regsave instruction */\r
12#define LOAD ld.d /* 64 bit mode regload instruction */\r
13#define RSIZE 8 /* 64 bit mode register size */\r
14\r
15ASM_GLOBAL ASM_PFX(InternalSwitchStackAsm)\r
16\r
17/**\r
18 This allows the caller to switch the stack and goes to the new entry point\r
19\r
20 @param JumpBuffer A pointer to CPU context buffer.\r
21**/\r
22\r
23ASM_PFX(InternalSwitchStackAsm):\r
24 LOAD $ra, $a0, RSIZE * 11\r
25 LOAD $s0, $a0, RSIZE * 0\r
26 LOAD $s1, $a0, RSIZE * 1\r
27 LOAD $s2, $a0, RSIZE * 2\r
28 LOAD $s3, $a0, RSIZE * 3\r
29 LOAD $s4, $a0, RSIZE * 4\r
30 LOAD $s5, $a0, RSIZE * 5\r
31 LOAD $s6, $a0, RSIZE * 6\r
32 LOAD $s7, $a0, RSIZE * 7\r
33 LOAD $s8, $a0, RSIZE * 8\r
34 LOAD $sp, $a0, RSIZE * 9\r
35 LOAD $fp, $a0, RSIZE * 10\r
36 LOAD $a0, $sp, 0\r
37 LOAD $a1, $sp, 8\r
38 jirl $zero, $ra, 0\r
39 .end\r