start_from_tpl.S 958 B

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