PeiCoreEntry.asm 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. ;------------------------------------------------------------------------------
  2. ;
  3. ; Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
  4. ; SPDX-License-Identifier: BSD-2-Clause-Patent
  5. ;
  6. ; Module Name:
  7. ;
  8. ; SecEntry.asm
  9. ;
  10. ; Abstract:
  11. ;
  12. ; This is the code that goes from real-mode to protected mode.
  13. ; It consumes the reset vector, calls two basic APIs from FSP binary.
  14. ;
  15. ;------------------------------------------------------------------------------
  16. .686p
  17. .xmm
  18. .model flat, c
  19. .code
  20. EXTRN SecStartup:NEAR
  21. EXTRN PlatformInit:NEAR
  22. CallPeiCoreEntryPoint PROC PUBLIC
  23. ;
  24. ; Obtain the hob list pointer
  25. ;
  26. mov eax, [esp+4]
  27. ;
  28. ; Obtain the stack information
  29. ; ECX: start of range
  30. ; EDX: end of range
  31. ;
  32. mov ecx, [esp+8]
  33. mov edx, [esp+0Ch]
  34. ;
  35. ; Platform init
  36. ;
  37. pushad
  38. push edx
  39. push ecx
  40. push eax
  41. call PlatformInit
  42. pop eax
  43. pop eax
  44. pop eax
  45. popad
  46. ;
  47. ; Set stack top pointer
  48. ;
  49. mov esp, edx
  50. ;
  51. ; Push the hob list pointer
  52. ;
  53. push eax
  54. ;
  55. ; Save the value
  56. ; ECX: start of range
  57. ; EDX: end of range
  58. ;
  59. mov ebp, esp
  60. push ecx
  61. push edx
  62. ;
  63. ; Push processor count to stack first, then BIST status (AP then BSP)
  64. ;
  65. mov eax, 1
  66. cpuid
  67. shr ebx, 16
  68. and ebx, 0000000FFh
  69. cmp bl, 1
  70. jae PushProcessorCount
  71. ;
  72. ; Some processors report 0 logical processors. Effectively 0 = 1.
  73. ; So we fix up the processor count
  74. ;
  75. inc ebx
  76. PushProcessorCount:
  77. push ebx
  78. ;
  79. ; We need to implement a long-term solution for BIST capture. For now, we just copy BSP BIST
  80. ; for all processor threads
  81. ;
  82. xor ecx, ecx
  83. mov cl, bl
  84. PushBist:
  85. movd eax, mm0
  86. push eax
  87. loop PushBist
  88. ; Save Time-Stamp Counter
  89. movd eax, mm5
  90. push eax
  91. movd eax, mm6
  92. push eax
  93. ;
  94. ; Pass entry point of the PEI core
  95. ;
  96. mov edi, 0FFFFFFE0h
  97. push DWORD PTR ds:[edi]
  98. ;
  99. ; Pass BFV into the PEI Core
  100. ;
  101. mov edi, 0FFFFFFFCh
  102. push DWORD PTR ds:[edi]
  103. ;
  104. ; Pass stack size into the PEI Core
  105. ;
  106. mov ecx, [ebp - 4]
  107. mov edx, [ebp - 8]
  108. push ecx ; RamBase
  109. sub edx, ecx
  110. push edx ; RamSize
  111. ;
  112. ; Pass Control into the PEI Core
  113. ;
  114. call SecStartup
  115. CallPeiCoreEntryPoint ENDP
  116. END