| 1 |
/* |
| 2 |
* GRUB -- GRand Unified Bootloader |
| 3 |
* Copyright (C) 2018 Free Software Foundation, Inc. |
| 4 |
* |
| 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. |
| 9 |
* |
| 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. |
| 14 |
* |
| 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/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
#include <grub/symbol.h> |
| 20 |
|
| 21 |
#if __riscv_xlen == 64 |
| 22 |
#define sl sd |
| 23 |
#define ll ld |
| 24 |
#else |
| 25 |
#define sl sw |
| 26 |
#define ll lw |
| 27 |
#endif |
| 28 |
|
| 29 |
|
| 30 |
.file "startup.S" |
| 31 |
.text |
| 32 |
FUNCTION(_start) |
| 33 |
/* |
| 34 |
* EFI_SYSTEM_TABLE and EFI_HANDLE are passed in a1/a0. |
| 35 |
*/ |
| 36 |
|
| 37 |
ll a2, efi_image_handle_val |
| 38 |
sl a0, 0(a2) |
| 39 |
ll a2, efi_system_table_val |
| 40 |
sl a1, 0(a2) |
| 41 |
ll a2, grub_main_val |
| 42 |
jr a2 |
| 43 |
grub_main_val: |
| 44 |
.quad EXT_C(grub_main) |
| 45 |
efi_system_table_val: |
| 46 |
.quad EXT_C(grub_efi_system_table) |
| 47 |
efi_image_handle_val: |
| 48 |
.quad EXT_C(grub_efi_image_handle) |