FspHelper.s 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #------------------------------------------------------------------------------
  2. #
  3. # Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
  4. # SPDX-License-Identifier: BSD-2-Clause-Patent
  5. #
  6. # Abstract:
  7. #
  8. # Provide FSP helper function.
  9. #
  10. #------------------------------------------------------------------------------
  11. #
  12. # FspInfoHeaderRelativeOff is patched during build process and initialized to offset of the AsmGetFspBaseAddress
  13. # from the FSP Info header.
  14. #
  15. ASM_GLOBAL ASM_PFX(FspInfoHeaderRelativeOff)
  16. ASM_PFX(FspInfoHeaderRelativeOff):
  17. #
  18. # This value will be pached by the build script
  19. #
  20. .long 0x012345678
  21. #
  22. # Returns FSP Base Address.
  23. #
  24. # This function gets the FSP Info Header using relative addressing and returns the FSP Base from the header structure
  25. #
  26. ASM_GLOBAL ASM_PFX(AsmGetFspBaseAddress)
  27. ASM_PFX(AsmGetFspBaseAddress):
  28. mov $AsmGetFspBaseAddress, %eax
  29. sub FspInfoHeaderRelativeOff, %eax
  30. add $0x01C, %eax
  31. mov (%eax), %eax
  32. ret
  33. #
  34. # No stack counter part of AsmGetFspBaseAddress. Return address is in edi.
  35. #
  36. ASM_GLOBAL ASM_PFX(AsmGetFspBaseAddressNoStack)
  37. ASM_PFX(AsmGetFspBaseAddressNoStack):
  38. mov $AsmGetFspBaseAddress, %eax
  39. sub FspInfoHeaderRelativeOff, %eax
  40. add $0x01C, %eax
  41. mov (%eax), %eax
  42. jmp *%edi
  43. #
  44. # Returns FSP Info Header.
  45. #
  46. # This function gets the FSP Info Header using relative addressing and returns it
  47. #
  48. ASM_GLOBAL ASM_PFX(AsmGetFspInfoHeader)
  49. ASM_PFX(AsmGetFspInfoHeader):
  50. mov $AsmGetFspBaseAddress, %eax
  51. sub FspInfoHeaderRelativeOff, %eax
  52. ret
  53. #
  54. # No stack counter part of AsmGetFspInfoHeader. Return address is in edi.
  55. #
  56. ASM_GLOBAL ASM_PFX(AsmGetFspInfoHeaderNoStack)
  57. ASM_PFX(AsmGetFspInfoHeaderNoStack):
  58. mov $AsmGetFspBaseAddress, %eax
  59. sub FspInfoHeaderRelativeOff, %eax
  60. jmp *%edi