Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Simon Glass | 8157b33 | 2017-01-16 07:03:48 -0700 | [diff] [blame] | 2 | /* |
| 3 | * 64-bit x86 Startup Code |
| 4 | * |
Simon Glass | 435f705 | 2019-04-25 21:58:40 -0600 | [diff] [blame] | 5 | * Copyright 2019 Google, Inc |
Simon Glass | 8157b33 | 2017-01-16 07:03:48 -0700 | [diff] [blame] | 6 | * Written by Simon Glass <sjg@chromium.org> |
Simon Glass | 8157b33 | 2017-01-16 07:03:48 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include <config.h> |
| 10 | |
Alexander Graf | 94a10f2 | 2018-06-12 07:48:37 +0200 | [diff] [blame] | 11 | .section .text.start |
Simon Glass | 8157b33 | 2017-01-16 07:03:48 -0700 | [diff] [blame] | 12 | .code64 |
| 13 | .globl _start |
| 14 | .type _start, @function |
| 15 | _start: |
| 16 | /* Set up memory using the existing stack */ |
| 17 | mov %rsp, %rdi |
| 18 | call board_init_f_alloc_reserve |
| 19 | mov %rax, %rsp |
| 20 | |
| 21 | call board_init_f_init_reserve |
| 22 | |
Bin Meng | f92b3d7 | 2018-10-13 20:52:09 -0700 | [diff] [blame] | 23 | xor %rdi, %rdi |
Simon Glass | 8157b33 | 2017-01-16 07:03:48 -0700 | [diff] [blame] | 24 | call board_init_f |
| 25 | call board_init_f_r |
| 26 | |
| 27 | /* Should not return here */ |
| 28 | jmp . |
Simon Glass | e6b0350 | 2023-07-15 21:38:52 -0600 | [diff] [blame] | 29 | |
| 30 | .globl board_init_f_r_trampoline64 |
| 31 | .type board_init_f_r_trampoline64, @function |
| 32 | board_init_f_r_trampoline64: |
| 33 | /* |
| 34 | * SDRAM has been initialised, U-Boot code has been copied into |
| 35 | * RAM, BSS has been cleared and relocation adjustments have been |
| 36 | * made. It is now time to jump into the in-RAM copy of U-Boot |
| 37 | * |
| 38 | * %eax = Address of top of new stack |
| 39 | */ |
| 40 | |
| 41 | /* Stack grows down from top of SDRAM */ |
| 42 | movq %rsi, %rsp |
| 43 | |
| 44 | /* New gd is in rdi */ |
| 45 | |
| 46 | /* Re-enter U-Boot by calling board_init_f_r() */ |
| 47 | call board_init_f_r |