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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. .text
  2. .arch i386
  3. .section ".prefix", "ax", @progbits
  4. .section ".prefix.data", "aw", @progbits
  5. .code16
  6. .section ".prefix"
  7. .org 0
  8. nbi_header:
  9. /*****************************************************************************
  10. * NBI file header
  11. *****************************************************************************
  12. */
  13. file_header:
  14. .long 0x1b031336 /* Signature */
  15. .byte 0x04 /* 16 bytes header, no vendor info */
  16. .byte 0
  17. .byte 0
  18. .byte 0 /* No flags */
  19. .word 0x0000, 0x07c0 /* Load header to 0x07c0:0x0000 */
  20. .word entry, 0x07c0 /* Start execution at 0x07c0:entry */
  21. .size file_header, . - file_header
  22. /*****************************************************************************
  23. * NBI segment header
  24. *****************************************************************************
  25. */
  26. segment_header:
  27. .byte 0x04 /* 16 bytes header, no vendor info */
  28. .byte 0
  29. .byte 0
  30. .byte 0x04 /* Last segment */
  31. .long 0x00007e00
  32. imglen: .long _filesz - 512
  33. memlen: .long _filesz - 512
  34. .size segment_header, . - segment_header
  35. .section ".zinfo.fixup", "a" /* Compressor fixup information */
  36. .ascii "SUBL"
  37. .long imglen
  38. .long 1
  39. .long 0
  40. .ascii "SUBL"
  41. .long memlen
  42. .long 1
  43. .long 0
  44. .previous
  45. /*****************************************************************************
  46. * NBI entry point
  47. *****************************************************************************
  48. */
  49. entry:
  50. /* Install low and high memory regions */
  51. call install
  52. /* Jump to .text16 segment */
  53. pushw %ax
  54. pushw $1f
  55. lret
  56. .section ".text16", "awx", @progbits
  57. 1:
  58. pushl $main
  59. pushw %cs
  60. call prot_call
  61. popl %eax /* discard */
  62. /* Reboot system */
  63. int $0x19
  64. .previous
  65. .size entry, . - entry
  66. nbi_header_end:
  67. .org 512