Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

pxe_entry.S 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*
  2. * Copyright (C) 2006 Michael Brown <mbrown@fensystems.co.uk>.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of the
  7. * License, or any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. *
  18. */
  19. .arch i386
  20. .section ".text16", "awx", @progbits
  21. .section ".text16.data", "aw", @progbits
  22. .section ".data16", "aw", @progbits
  23. /****************************************************************************
  24. * !PXE structure
  25. ****************************************************************************
  26. */
  27. .section ".text16.data"
  28. .globl ppxe
  29. .align 16
  30. ppxe:
  31. .ascii "!PXE" /* Signature */
  32. .byte pxe_length /* StructLength */
  33. .byte 0 /* StructCksum */
  34. .byte 0 /* StructRev */
  35. .byte 0 /* reserved_1 */
  36. .word undiheader, 0 /* UNDIROMID */
  37. .word 0, 0 /* BaseROMID */
  38. .word pxe_entry_sp, 0 /* EntryPointSP */
  39. .word pxe_entry_esp, 0 /* EntryPointESP */
  40. .word -1, -1 /* StatusCallout */
  41. .byte 0 /* reserved_2 */
  42. .byte SegDescCnt /* SegDescCnt */
  43. .word 0 /* FirstSelector */
  44. pxe_segments:
  45. .word 0, 0, 0, _data16_size /* Stack */
  46. .word 0, 0, 0, _data16_size /* UNDIData */
  47. .word 0, 0, 0, _text16_size /* UNDICode */
  48. .word 0, 0, 0, _text16_size /* UNDICodeWrite */
  49. .word 0, 0, 0, 0 /* BC_Data */
  50. .word 0, 0, 0, 0 /* BC_Code */
  51. .word 0, 0, 0, 0 /* BC_CodeWrite */
  52. .equ SegDescCnt, ( ( . - pxe_segments ) / 8 )
  53. .equ pxe_length, . - ppxe
  54. .size ppxe, . - ppxe
  55. /* Define undiheader=0 as a weak symbol for non-ROM builds */
  56. .section ".weak"
  57. .weak undiheader
  58. undiheader:
  59. /****************************************************************************
  60. * PXENV+ structure
  61. ****************************************************************************
  62. */
  63. .section ".text16.data"
  64. .globl pxenv
  65. .align 16
  66. pxenv:
  67. .ascii "PXENV+" /* Signature */
  68. .word 0x0201 /* Version */
  69. .byte pxenv_length /* Length */
  70. .byte 0 /* Checksum */
  71. .word pxenv_entry, 0 /* RMEntry */
  72. .long 0 /* PMEntry */
  73. .word 0 /* PMSelector */
  74. .word 0 /* StackSeg */
  75. .word _data16_size /* StackSize */
  76. .word 0 /* BC_CodeSeg */
  77. .word 0 /* BC_CodeSize */
  78. .word 0 /* BC_DataSeg */
  79. .word 0 /* BC_DataSize */
  80. .word 0 /* UNDIDataSeg */
  81. .word _data16_size /* UNDIDataSize */
  82. .word 0 /* UNDICodeSeg */
  83. .word _text16_size /* UNDICodeSize */
  84. .word ppxe, 0 /* PXEPtr */
  85. .equ pxenv_length, . - pxenv
  86. .size pxenv, . - pxenv
  87. /****************************************************************************
  88. * pxenv_entry (16-bit far call)
  89. *
  90. * PXE API call PXENV+ entry point
  91. *
  92. * Parameters:
  93. * %es:di : Far pointer to PXE parameter structure
  94. * %bx : PXE API call
  95. * Returns:
  96. * %ax : PXE exit status
  97. * Corrupts:
  98. * none
  99. ****************************************************************************
  100. */
  101. /* Wyse Streaming Manager server (WLDRM13.BIN) assumes that
  102. * the PXENV+ entry point is at UNDI_CS:0000; apparently,
  103. * somebody at Wyse has difficulty distinguishing between the
  104. * words "may" and "must"...
  105. */
  106. .section ".text16.null"
  107. .code16
  108. pxenv_null_entry:
  109. jmp pxenv_entry
  110. .section ".text16"
  111. .code16
  112. pxenv_entry:
  113. pushl $pxe_api_call
  114. pushw %cs
  115. call prot_call
  116. addl $4, %esp
  117. lret
  118. .size pxenv_entry, . - pxenv_entry
  119. /****************************************************************************
  120. * pxe_entry
  121. *
  122. * PXE API call !PXE entry point
  123. *
  124. * Parameters:
  125. * stack : Far pointer to PXE parameter structure
  126. * stack : PXE API call
  127. * Returns:
  128. * %ax : PXE exit status
  129. * Corrupts:
  130. * none
  131. ****************************************************************************
  132. */
  133. .section ".text16"
  134. .code16
  135. pxe_entry:
  136. pxe_entry_sp:
  137. /* Preserve original %esp */
  138. pushl %esp
  139. /* Zero high word of %esp to allow use of common code */
  140. movzwl %sp, %esp
  141. jmp pxe_entry_common
  142. pxe_entry_esp:
  143. /* Preserve %esp to match behaviour of pxe_entry_sp */
  144. pushl %esp
  145. pxe_entry_common:
  146. /* Save PXENV+ API call registers */
  147. pushw %es
  148. pushw %di
  149. pushw %bx
  150. /* Load !PXE parameters from stack into PXENV+ registers */
  151. addr32 movw 18(%esp), %bx
  152. movw %bx, %es
  153. addr32 movw 16(%esp), %di
  154. addr32 movw 14(%esp), %bx
  155. /* Make call as for PXENV+ */
  156. pushw %cs
  157. call pxenv_entry
  158. /* Restore PXENV+ registers */
  159. popw %bx
  160. popw %di
  161. popw %es
  162. /* Restore original %esp and return */
  163. popl %esp
  164. lret
  165. .size pxe_entry, . - pxe_entry
  166. /****************************************************************************
  167. * pxe_int_1a
  168. *
  169. * PXE INT 1A handler
  170. *
  171. * Parameters:
  172. * %ax : 0x5650
  173. * Returns:
  174. * %ax : 0x564e
  175. * %es:bx : Far pointer to the PXENV+ structure
  176. * CF cleared
  177. * Corrupts:
  178. * none
  179. ****************************************************************************
  180. */
  181. .section ".text16"
  182. .code16
  183. .globl pxe_int_1a
  184. pxe_int_1a:
  185. pushfw
  186. cmpw $0x5650, %ax
  187. jne 1f
  188. /* INT 1A,5650 - PXE installation check */
  189. pushw %cs
  190. popw %es
  191. movw $pxenv, %bx
  192. movw $0x564e, %ax
  193. popfw
  194. clc
  195. lret $2
  196. 1: /* INT 1A,other - pass through */
  197. popfw
  198. ljmp *%cs:pxe_int_1a_vector
  199. .section ".text16.data"
  200. .globl pxe_int_1a_vector
  201. pxe_int_1a_vector: .long 0