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.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 entry, 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. entry:
  48. /* Install iPXE */
  49. call install
  50. /* Jump to .text16 segment */
  51. pushw %ax
  52. pushw $1f
  53. lret
  54. .section ".text16", "awx", @progbits
  55. 1:
  56. pushl $main
  57. pushw %cs
  58. call prot_call
  59. popl %ecx /* discard */
  60. /* Uninstall iPXE */
  61. call uninstall
  62. /* Reboot system */
  63. int $0x19
  64. .previous
  65. .size entry, . - entry
  66. nbi_header_end:
  67. .org 512