Simon Glass | 75659ac | 2019-04-25 21:58:52 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
Simon Glass | 202a096 | 2019-09-25 08:11:44 -0600 | [diff] [blame] | 3 | * 32-bit x86 Startup Code when running from TPL. This is the startup code in |
| 4 | * SPL, when TPL is used. |
Simon Glass | 75659ac | 2019-04-25 21:58:52 -0600 | [diff] [blame] | 5 | * |
| 6 | * Copyright 2018 Google, Inc |
| 7 | * Written by Simon Glass <sjg@chromium.org> |
| 8 | */ |
| 9 | |
| 10 | #include <config.h> |
| 11 | |
| 12 | .section .text.start |
| 13 | .code32 |
| 14 | .globl _start |
| 15 | .type _start, @function |
| 16 | _start: |
| 17 | /* Set up memory using the existing stack */ |
| 18 | mov %esp, %eax |
| 19 | call board_init_f_alloc_reserve |
| 20 | mov %eax, %esp |
| 21 | |
| 22 | call board_init_f_init_reserve |
| 23 | |
| 24 | xorl %eax, %eax |
| 25 | call board_init_f |
| 26 | call board_init_f_r |
| 27 | |
| 28 | /* Should not return here */ |
| 29 | jmp . |
| 30 | |
| 31 | .globl board_init_f_r_trampoline |
| 32 | .type board_init_f_r_trampoline, @function |
| 33 | board_init_f_r_trampoline: |
| 34 | /* |
| 35 | * TPL has been executed: SDRAM has been initialised, BSS has been |
| 36 | * cleared. |
| 37 | * |
| 38 | * %eax = Address of top of new stack |
| 39 | */ |
| 40 | |
| 41 | /* Stack grows down from top of SDRAM */ |
| 42 | movl %eax, %esp |
| 43 | |
| 44 | /* Re-enter SPL by calling board_init_f_r() */ |
| 45 | call board_init_f_r |
| 46 | |
| 47 | die: |
| 48 | hlt |
| 49 | jmp die |
| 50 | hlt |