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