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.
 
 
 
 
 
 

99 regels
2.1 KiB

  1. /*
  2. * bootsect.S Copyright (C) 1991, 1992 Linus Torvalds
  3. *
  4. * modified by Drew Eckhardt
  5. * modified by Bruce Evans (bde)
  6. * modified by Chris Noe (May 1999) (as86 -> gas)
  7. * gutted by H. Peter Anvin (Jan 2003)
  8. *
  9. * BIG FAT NOTE: We're in real mode using 64k segments. Therefore segment
  10. * addresses must be multiplied by 16 to obtain their respective linear
  11. * addresses. To avoid confusion, linear addresses are written using leading
  12. * hex while segment addresses are written as segment:offset.
  13. *
  14. */
  15. #include <asm/boot.h>
  16. SETUPSECTS = 4 /* default nr of setup-sectors */
  17. BOOTSEG = 0x07C0 /* original address of boot-sector */
  18. INITSEG = DEF_INITSEG /* we move boot here - out of the way */
  19. SETUPSEG = DEF_SETUPSEG /* setup starts here */
  20. SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536) */
  21. SYSSIZE = DEF_SYSSIZE /* system size: # of 16-byte clicks */
  22. /* to be loaded */
  23. ROOT_DEV = 0 /* ROOT_DEV is now written by "build" */
  24. SWAP_DEV = 0 /* SWAP_DEV is now written by "build" */
  25. #ifndef SVGA_MODE
  26. #define SVGA_MODE ASK_VGA
  27. #endif
  28. #ifndef RAMDISK
  29. #define RAMDISK 0
  30. #endif
  31. #ifndef ROOT_RDONLY
  32. #define ROOT_RDONLY 1
  33. #endif
  34. .code16
  35. .text
  36. .global _start
  37. _start:
  38. # Normalize the start address
  39. jmpl $BOOTSEG, $start2
  40. start2:
  41. movw %cs, %ax
  42. movw %ax, %ds
  43. movw %ax, %es
  44. movw %ax, %ss
  45. movw $0x7c00, %sp
  46. sti
  47. cld
  48. movw $bugger_off_msg, %si
  49. msg_loop:
  50. lodsb
  51. andb %al, %al
  52. jz die
  53. movb $0xe, %ah
  54. movw $7, %bx
  55. int $0x10
  56. jmp msg_loop
  57. die:
  58. # Allow the user to press a key, then reboot
  59. xorw %ax, %ax
  60. int $0x16
  61. int $0x19
  62. # int 0x19 should never return. In case it does anyway,
  63. # invoke the BIOS reset code...
  64. ljmp $0xf000,$0xfff0
  65. bugger_off_msg:
  66. .ascii "Direct booting from floppy is no longer supported.\r\n"
  67. .ascii "Please use a boot loader program instead.\r\n"
  68. .ascii "\n"
  69. .ascii "Remove disk and press any key to reboot . . .\r\n"
  70. .byte 0
  71. # Kernel attributes; used by setup
  72. .org 497
  73. setup_sects: .byte SETUPSECTS
  74. root_flags: .word ROOT_RDONLY
  75. syssize: .word SYSSIZE
  76. swap_dev: .word SWAP_DEV
  77. ram_size: .word RAMDISK
  78. vid_mode: .word SVGA_MODE
  79. root_dev: .word ROOT_DEV
  80. boot_flag: .word 0xAA55