Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

hdprefix.S 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. FILE_LICENCE ( GPL2_OR_LATER )
  2. .text
  3. .arch i386
  4. .section ".prefix", "awx", @progbits
  5. .code16
  6. .org 0
  7. .globl _hd_start
  8. _hd_start:
  9. movw $load_image, %bp
  10. jmp find_active_partition
  11. #include "bootpart.S"
  12. load_image:
  13. /* Get disk geometry */
  14. pushal
  15. pushw %es
  16. movb $0x08, %ah
  17. int $0x13
  18. jc load_failed
  19. movb %cl, max_sector
  20. movb %dh, max_head
  21. popw %es
  22. popal
  23. 1: /* Read to end of current track */
  24. movb %cl, %al
  25. negb %al
  26. addb max_sector, %al
  27. incb %al
  28. andb $0x3f, %al
  29. movzbl %al, %eax
  30. call *read_sectors
  31. jc load_failed
  32. /* Update %es */
  33. movw %es, %bx
  34. shll $5, %eax
  35. addw %ax, %bx
  36. movw %bx, %es
  37. shrl $5, %eax
  38. /* Update LBA address */
  39. addl %eax, %edi
  40. adcl $0, %esi
  41. /* Update CHS address */
  42. andb $0xc0, %cl
  43. orb $0x01, %cl
  44. incb %dh
  45. cmpb max_head, %dh
  46. jbe 2f
  47. xorb %dh, %dh
  48. incb %ch
  49. jnc 2f
  50. addb $0xc0, %cl
  51. 2:
  52. /* Loop until whole image is read */
  53. subl %eax, load_length
  54. ja 1b
  55. ljmp $BOOT_SEG, $start_image
  56. max_sector:
  57. .byte 0
  58. max_head:
  59. .byte 0
  60. load_length:
  61. .long 0
  62. .section ".zinfo.fixup", "a", @progbits /* Compressor fixups */
  63. .ascii "ADDL"
  64. .long load_length
  65. .long 512
  66. .long 0
  67. .previous
  68. load_failed:
  69. movw $10f, %si
  70. jmp boot_error
  71. 10: .asciz "Could not load iPXE\r\n"
  72. .org 510
  73. .byte 0x55, 0xaa
  74. start_image:
  75. /* Install iPXE */
  76. call install
  77. /* Set up real-mode stack */
  78. movw %bx, %ss
  79. movw $_estack16, %sp
  80. /* Jump to .text16 segment */
  81. pushw %ax
  82. pushw $1f
  83. lret
  84. .section ".text16", "awx", @progbits
  85. 1:
  86. pushl $main
  87. pushw %cs
  88. call prot_call
  89. popl %ecx /* discard */
  90. /* Uninstall iPXE */
  91. call uninstall
  92. /* Boot next device */
  93. int $0x18