summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/BaseLib/RiscV64/RiscVSetJumpLongJump.S
blob: 34486eabba4c07e8dc33c94e017ca1d2a68e0e03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//------------------------------------------------------------------------------
//
// Set/Long jump for RISC-V
//
// Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
//------------------------------------------------------------------------------
# define REG_S  sd
# define REG_L  ld
# define SZREG  8
.align 3
    .globl  SetJump

SetJump:
    REG_S ra,  0*SZREG(a0)
    REG_S s0,  1*SZREG(a0)
    REG_S s1,  2*SZREG(a0)
    REG_S s2,  3*SZREG(a0)
    REG_S s3,  4*SZREG(a0)
    REG_S s4,  5*SZREG(a0)
    REG_S s5,  6*SZREG(a0)
    REG_S s6,  7*SZREG(a0)
    REG_S s7,  8*SZREG(a0)
    REG_S s8,  9*SZREG(a0)
    REG_S s9,  10*SZREG(a0)
    REG_S s10, 11*SZREG(a0)
    REG_S s11, 12*SZREG(a0)
    REG_S sp,  13*SZREG(a0)
    li    a0,  0
    ret

    .globl  InternalLongJump
InternalLongJump:
    REG_L ra,  0*SZREG(a0)
    REG_L s0,  1*SZREG(a0)
    REG_L s1,  2*SZREG(a0)
    REG_L s2,  3*SZREG(a0)
    REG_L s3,  4*SZREG(a0)
    REG_L s4,  5*SZREG(a0)
    REG_L s5,  6*SZREG(a0)
    REG_L s6,  7*SZREG(a0)
    REG_L s7,  8*SZREG(a0)
    REG_L s8,  9*SZREG(a0)
    REG_L s9,  10*SZREG(a0)
    REG_L s10, 11*SZREG(a0)
    REG_L s11, 12*SZREG(a0)
    REG_L sp,  13*SZREG(a0)

    add   a0, s0, 0
    add   a1, s1, 0
    add   a2, s2, 0
    add   a3, s3, 0
    ret