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