Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 lines
3.4 KiB

  1. //++
  2. //
  3. // Module name
  4. // SuSetup.s
  5. // Author
  6. // Allen Kay (akay) Jun-12-95
  7. // Description
  8. // Startup module for Ia64 NT OS loader.
  9. // Notes
  10. // This is the startup routine for Ia64 NT boot loader. It sets up
  11. // the CPU state and turns on the address translation before calling
  12. // the C routine main() which then does some initial setup then passes
  13. // control to BlOsLoader().
  14. //---
  15. #include "ksia64.h"
  16. .file "susetup.s"
  17. PublicFunction(SuMain)
  18. //#define FW_SPEC_PATCH
  19. #if defined(FW_SPEC_PATCH)
  20. PublicFunction(memcpy)
  21. #endif
  22. .global StackBase
  23. .global StackLimit
  24. .global BspLimit
  25. NESTED_ENTRY(main)
  26. NESTED_SETUP(2,6,3,0)
  27. ImageHandle = loc2
  28. SystemTable = loc3
  29. mov ImageHandle = a0
  30. mov SystemTable = a1
  31. movl gp = _gp // setup gp register
  32. invala // invalidate ALAT
  33. mov ar.rsc = r0
  34. ;;
  35. //
  36. // Switch to our own sp and bspstore.
  37. //
  38. loadrs
  39. movl sp = StackBase
  40. ;;
  41. mov ar.bspstore = sp
  42. add sp = -STACK_SCRATCH_AREA, sp
  43. ;;
  44. #if defined(FW_SPEC_PATCH)
  45. //
  46. // Set Unaligned fault Vector
  47. //
  48. mov loc4 = 0x5a00
  49. mov loc5 = cr.iva
  50. movl out1 = BldrFaultDeferStart
  51. movl out2 = BldrFaultDeferEnd - BldrFaultDeferStart
  52. ;;
  53. add out0 = loc4, loc5 // out0 = address of IVT vector
  54. ;;
  55. br.call.sptk brp = memcpy
  56. ;;
  57. //
  58. // Set dirty bit fault Vector
  59. //
  60. mov loc4 = 0x2000
  61. mov loc5 = cr.iva
  62. movl out1 = BldrFaultDeferStart
  63. movl out2 = BldrFaultDeferEnd - BldrFaultDeferStart
  64. ;;
  65. add out0 = loc4, loc5 // out0 = address of IVT vector
  66. ;;
  67. br.call.sptk brp = memcpy
  68. ;;
  69. //
  70. // Set instruction access bit fault Vector
  71. //
  72. mov loc4 = 0x2400
  73. mov loc5 = cr.iva
  74. movl out1 = BldrFaultDeferStart
  75. movl out2 = BldrFaultDeferEnd - BldrFaultDeferStart
  76. ;;
  77. add out0 = loc4, loc5 // out0 = address of IVT vector
  78. ;;
  79. br.call.sptk brp = memcpy
  80. ;;
  81. sync.i
  82. ;;
  83. srlz.i
  84. ;;
  85. #endif // FW_SPEC_PATCH
  86. //
  87. // Transfer control to Sumain()
  88. //
  89. mov out0 = ImageHandle
  90. mov out1 = SystemTable
  91. br.call.spnt brp = SuMain
  92. ;;
  93. NESTED_EXIT(main)
  94. #if defined(FW_SPEC_PATCH)
  95. BldrFaultDeferStart::
  96. mov h28 = pr
  97. mov h27 = cr.isr
  98. mov h26 = cr.ipsr
  99. ;;
  100. tbit.nz p6, p7 = h27, ISR_SP
  101. ;;
  102. (p6) dep h26 = 1, h26, PSR_ED, 1
  103. ;;
  104. (p6) mov cr.ipsr = h26
  105. ;;
  106. mov pr = h28
  107. ;;
  108. rfi
  109. ;;
  110. BldrFaultDeferEnd::
  111. #endif
  112. //
  113. // Reserve memory for loader stack
  114. //
  115. .section .StackBase = "wa", "progbits"
  116. StackLimit::
  117. .skip 0x20000
  118. StackBase::
  119. .skip 0x4000
  120. BspLimit::
  121. //
  122. // Reserve memory for loader stack
  123. //
  124. string " -section:.BdPcr,,align=PAGE_SIZE"
  125. .section .BdPcr = "wa", "progbits"
  126. BdPcr::
  127. .skip PAGE_SIZE
  128. .skip PAGE_SIZE