2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2018 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #include <grub/symbol.h>
24 GRUB_MOD_LICENSE "GPLv3+"
28 #if __riscv_xlen == 64
29 #define STORE_IDX(reg, idx) sd reg, (idx*8)(a0)
30 #define LOAD_IDX(reg, idx) ld reg, (idx*8)(a0)
32 #define STORE_IDX(reg, idx) sw reg, (idx*4)(a0)
33 #define LOAD_IDX(reg, idx) lw reg, (idx*4)(a0)
37 * int grub_setjmp (grub_jmp_buf env)
40 /* Preserve all callee-saved registers and the SP */
59 * int grub_longjmp (grub_jmp_buf env, int val)
61 FUNCTION(grub_longjmp)
77 /* Move the return value in place, but return 1 if passed 0. */
78 beq a1, zero, longjmp_1