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.

nbiprefix.S 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
  2. .text
  3. .arch i386
  4. .code16
  5. .section ".prefix", "ax", @progbits
  6. .org 0
  7. nbi_header:
  8. /*****************************************************************************
  9. * NBI file header
  10. *****************************************************************************
  11. */
  12. file_header:
  13. .long 0x1b031336 /* Signature */
  14. .byte 0x04 /* 16 bytes header, no vendor info */
  15. .byte 0
  16. .byte 0
  17. .byte 0 /* No flags */
  18. .word 0x0000, 0x07c0 /* Load header to 0x07c0:0x0000 */
  19. .word _nbi_start, 0x07c0 /* Start execution at 0x07c0:entry */
  20. .size file_header, . - file_header
  21. /*****************************************************************************
  22. * NBI segment header
  23. *****************************************************************************
  24. */
  25. segment_header:
  26. .byte 0x04 /* 16 bytes header, no vendor info */
  27. .byte 0
  28. .byte 0
  29. .byte 0x04 /* Last segment */
  30. .long 0x00007e00
  31. imglen: .long -512
  32. memlen: .long -512
  33. .size segment_header, . - segment_header
  34. .section ".zinfo.fixup", "a", @progbits /* Compressor fixups */
  35. .ascii "ADDL"
  36. .long imglen
  37. .long 1
  38. .long 0
  39. .ascii "ADDL"
  40. .long memlen
  41. .long 1
  42. .long 0
  43. .previous
  44. /*****************************************************************************
  45. * NBI entry point
  46. *****************************************************************************
  47. */
  48. .globl _nbi_start
  49. _nbi_start:
  50. /* Install iPXE */
  51. call install
  52. /* Set up real-mode stack */
  53. movw %bx, %ss
  54. movw $_estack16, %sp
  55. /* Jump to .text16 segment */
  56. pushw %ax
  57. pushw $1f
  58. lret
  59. .section ".text16", "awx", @progbits
  60. 1:
  61. pushl $main
  62. call prot_call
  63. /* Uninstall iPXE */
  64. call uninstall
  65. /* Reboot system */
  66. int $0x19
  67. .previous
  68. .size _nbi_start, . - _nbi_start
  69. nbi_header_end:
  70. .org 512