Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

pxe_entry.S 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. /****************************************************************************
  21. * !PXE structure
  22. ****************************************************************************
  23. */
  24. .section ".text16.data", "aw", @progbits
  25. .globl ppxe
  26. .align 16
  27. ppxe:
  28. .ascii "!PXE" /* Signature */
  29. .byte pxe_length /* StructLength */
  30. .byte 0 /* StructCksum */
  31. .byte 0 /* StructRev */
  32. .byte 0 /* reserved_1 */
  33. .word undiheader, 0 /* UNDIROMID */
  34. .word 0, 0 /* BaseROMID */
  35. .word pxe_entry_sp, 0 /* EntryPointSP */
  36. .word pxe_entry_esp, 0 /* EntryPointESP */
  37. .word -1, -1 /* StatusCallout */
  38. .byte 0 /* reserved_2 */
  39. .byte SegDescCnt /* SegDescCnt */
  40. .word 0 /* FirstSelector */
  41. pxe_segments:
  42. .word 0, 0, 0, _data16_memsz /* Stack */
  43. .word 0, 0, 0, _data16_memsz /* UNDIData */
  44. .word 0, 0, 0, _text16_memsz /* UNDICode */
  45. .word 0, 0, 0, _text16_memsz /* UNDICodeWrite */
  46. .word 0, 0, 0, 0 /* BC_Data */
  47. .word 0, 0, 0, 0 /* BC_Code */
  48. .word 0, 0, 0, 0 /* BC_CodeWrite */
  49. .equ SegDescCnt, ( ( . - pxe_segments ) / 8 )
  50. .equ pxe_length, . - ppxe
  51. .size ppxe, . - ppxe
  52. /* Define undiheader=0 as a weak symbol for non-ROM builds */
  53. .section ".weak", "a", @nobits
  54. .weak undiheader
  55. undiheader:
  56. /****************************************************************************
  57. * PXENV+ structure
  58. ****************************************************************************
  59. */
  60. .section ".text16.data", "aw", @progbits
  61. .globl pxenv
  62. .align 16
  63. pxenv:
  64. .ascii "PXENV+" /* Signature */
  65. .word 0x0201 /* Version */
  66. .byte pxenv_length /* Length */
  67. .byte 0 /* Checksum */
  68. .word pxenv_entry, 0 /* RMEntry */
  69. .long 0 /* PMEntry */
  70. .word 0 /* PMSelector */
  71. .word 0 /* StackSeg */
  72. .word _data16_memsz /* StackSize */
  73. .word 0 /* BC_CodeSeg */
  74. .word 0 /* BC_CodeSize */
  75. .word 0 /* BC_DataSeg */
  76. .word 0 /* BC_DataSize */
  77. .word 0 /* UNDIDataSeg */
  78. .word _data16_memsz /* UNDIDataSize */
  79. .word 0 /* UNDICodeSeg */
  80. .word _text16_memsz /* UNDICodeSize */
  81. .word ppxe, 0 /* PXEPtr */
  82. .equ pxenv_length, . - pxenv
  83. .size pxenv, . - pxenv
  84. /****************************************************************************
  85. * pxenv_entry (16-bit far call)
  86. *
  87. * PXE API call PXENV+ entry point
  88. *
  89. * Parameters:
  90. * %es:di : Far pointer to PXE parameter structure
  91. * %bx : PXE API call
  92. * Returns:
  93. * %ax : PXE exit status
  94. * Corrupts:
  95. * none
  96. ****************************************************************************
  97. */
  98. /* Wyse Streaming Manager server (WLDRM13.BIN) assumes that
  99. * the PXENV+ entry point is at UNDI_CS:0000; apparently,
  100. * somebody at Wyse has difficulty distinguishing between the
  101. * words "may" and "must"...
  102. */
  103. .section ".text16.null", "ax", @progbits
  104. .code16
  105. pxenv_null_entry:
  106. jmp pxenv_entry
  107. .section ".text16", "ax", @progbits
  108. .code16
  109. pxenv_entry:
  110. pushl $pxe_api_call
  111. pushw %cs
  112. call prot_call
  113. addl $4, %esp
  114. lret
  115. .size pxenv_entry, . - pxenv_entry
  116. /****************************************************************************
  117. * pxe_entry
  118. *
  119. * PXE API call !PXE entry point
  120. *
  121. * Parameters:
  122. * stack : Far pointer to PXE parameter structure
  123. * stack : PXE API call
  124. * Returns:
  125. * %ax : PXE exit status
  126. * Corrupts:
  127. * none
  128. ****************************************************************************
  129. */
  130. .section ".text16", "ax", @progbits
  131. .code16
  132. pxe_entry:
  133. pxe_entry_sp:
  134. /* Preserve original %esp */
  135. pushl %esp
  136. /* Zero high word of %esp to allow use of common code */
  137. movzwl %sp, %esp
  138. jmp pxe_entry_common
  139. pxe_entry_esp:
  140. /* Preserve %esp to match behaviour of pxe_entry_sp */
  141. pushl %esp
  142. pxe_entry_common:
  143. /* Save PXENV+ API call registers */
  144. pushw %es
  145. pushw %di
  146. pushw %bx
  147. /* Load !PXE parameters from stack into PXENV+ registers */
  148. addr32 movw 18(%esp), %bx
  149. movw %bx, %es
  150. addr32 movw 16(%esp), %di
  151. addr32 movw 14(%esp), %bx
  152. /* Make call as for PXENV+ */
  153. pushw %cs
  154. call pxenv_entry
  155. /* Restore PXENV+ registers */
  156. popw %bx
  157. popw %di
  158. popw %es
  159. /* Restore original %esp and return */
  160. popl %esp
  161. lret
  162. .size pxe_entry, . - pxe_entry
  163. /****************************************************************************
  164. * pxe_int_1a
  165. *
  166. * PXE INT 1A handler
  167. *
  168. * Parameters:
  169. * %ax : 0x5650
  170. * Returns:
  171. * %ax : 0x564e
  172. * %es:bx : Far pointer to the PXENV+ structure
  173. * CF cleared
  174. * Corrupts:
  175. * none
  176. ****************************************************************************
  177. */
  178. .section ".text16", "ax", @progbits
  179. .code16
  180. .globl pxe_int_1a
  181. pxe_int_1a:
  182. pushfw
  183. cmpw $0x5650, %ax
  184. jne 1f
  185. /* INT 1A,5650 - PXE installation check */
  186. pushw %cs
  187. popw %es
  188. movw $pxenv, %bx
  189. movw $0x564e, %ax
  190. popfw
  191. clc
  192. lret $2
  193. 1: /* INT 1A,other - pass through */
  194. popfw
  195. ljmp *%cs:pxe_int_1a_vector
  196. .section ".text16.data", "aw", @progbits
  197. .globl pxe_int_1a_vector
  198. pxe_int_1a_vector: .long 0