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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. .long _load_size - 512
  33. .long _load_size - 512
  34. .size segment_header, . - segment_header
  35. /*****************************************************************************
  36. * NBI entry point
  37. *****************************************************************************
  38. */
  39. entry:
  40. /* Install low and high memory regions */
  41. call install
  42. /* Jump to .text16 segment */
  43. pushw %ax
  44. pushw $1f
  45. lret
  46. .section ".text16", "awx", @progbits
  47. 1:
  48. pushl $main
  49. pushw %cs
  50. call prot_call
  51. popl %eax /* discard */
  52. /* Reboot system */
  53. int $0x19
  54. .previous
  55. .size entry, . - entry
  56. nbi_header_end:
  57. .org 512