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

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