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.

undiloader.S 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
  2. #include <librm.h>
  3. .text
  4. .code16
  5. .arch i386
  6. .section ".prefix", "ax", @progbits
  7. /* UNDI loader
  8. *
  9. * Called by an external program to load our PXE stack.
  10. */
  11. .globl undiloader
  12. undiloader:
  13. /* Save registers */
  14. pushl %esi
  15. pushl %edi
  16. pushl %ebp
  17. pushw %ds
  18. pushw %es
  19. pushw %bx
  20. /* ROM segment address to %ds */
  21. pushw %cs
  22. popw %ds
  23. /* UNDI loader parameter structure address into %es:%di */
  24. movw %sp, %bx
  25. movw %ss:22(%bx), %di
  26. movw %ss:24(%bx), %es
  27. /* Install to specified real-mode addresses */
  28. pushw %di
  29. movw %es:12(%di), %bx
  30. movw %es:14(%di), %ax
  31. movl image_source, %esi
  32. call undiloader_source
  33. xorl %edi, %edi
  34. orl $0xffffffff, %ebp /* Allow arbitrary relocation */
  35. call install_prealloc
  36. popw %di
  37. /* Jump to .text16 segment */
  38. pushw %ax
  39. pushw $1f
  40. lret
  41. .section ".text16", "ax", @progbits
  42. 1:
  43. /* Call UNDI loader C code */
  44. virtcall pxe_loader_call
  45. 1: /* Restore registers and return */
  46. popw %bx
  47. popw %es
  48. popw %ds
  49. popl %ebp
  50. popl %edi
  51. popl %esi
  52. lret
  53. /* Update image source address for UNDI loader
  54. *
  55. * Parameters:
  56. * %esi : Image source address
  57. * Returns:
  58. * %esi : Image source address
  59. */
  60. .section ".prefix", "ax", @progbits
  61. .globl undiloader_source
  62. .weak undiloader_source
  63. undiloader_source:
  64. ret