取自 https://github.com/ultraji/linux-0.12
!
! SYS_SIZE is the number of clicks (16 bytes) to be loaded.
! SYS_SIZE 是要加载的系统模块长度(单位是节,每节有16字节)。
! 0x3000 is 0x30000 bytes = 196kB, more than enough for current
! 即 0x30000 bytes = 192 KB(估算,以1000为单位,则是196KB),对于当前的
! 版本空间已足够了。
! 例如,当该值为 0x8000 时,表示内核最大为512KB。
! versions of linux
!
#include <linux/config.h>
!
! 该头文件里定义了内核用到的一些常数符号和 Linus 自己使用的默认硬盘默认参数块。
! 例如:
! DEF_SYSSIZE = 0X3000 系统模块长度
! DEF_INITSEG = 0x9000 该程序将要移动到的目的段位置
! DEF_SETUPSEG = 0x9020 setup程序代码的段位置
! DEF_SYSSEG = 0x1000 从磁盘加载系统模块到内存的段位置
!
SYSSIZE = DEF_SYSSIZE
!
! bootsect.s (C) 1991 Linus Torvalds
! modified by Drew Eckhardt
!
! bootsect.s is loaded at 0x7c00 by the bios-startup routines, and moves
! iself out of the way to address 0x90000, and jumps there.
!
! It then loads 'setup' directly after itself (0x90200), and the system
! at 0x10000, using BIOS interrupts.
!
! NOTE! currently system is at most 8*65536 bytes long. This should be no
! problem, even in the future. I want to keep it simple. This 512 kB
! kernel size should be enough, especially as this doesn't contain the '
! buffer cache as in minix
!
! The loader has been made as simple as possible, and continuos
! read errors will result in a unbreakable loop. Reboot by hand. It
! loads pretty fast by getting whole sectors at a time whenever possible.
! 以下是前面这些文字的翻译:
! bootsect.s (C) 1991 Linus Torvalds 版权所有
! Drew Eckhardt 修改
!
! bootsect.s 被BIOS启动子程序加载至 0x7c00 (31KB)处,并将自己移到了地
! 址 0x90000(576KB)处,并跳转至那里。
!
! 它然后使用BIOS 中断将'setup'直接加载到自己的后面(0x90200)(576.5KB),
! 并将 system 加载到地址 0x10000 处。
!
! 注意! 目前的内核系统最大长度限制为(8*65536)(512KB)字节,即使是在将来
! 这也应该没有问题的。我想让它保持简单明了。这样512KB的最大内核长度应该
! 足够了,尤其是这里没有像MINIX中一样包含缓冲区高速缓冲。
!
! 加载程序已经做得够简单了,所以持续的读操作出错将导致死循环。只能手工重启。
! 只要可能,通过一次读取所有的扇区,加载过程可以做的很快的。
.globl begtext, begdata, begbss, endtext, enddata, endbss
.text
begtext:
.data
begdata:
.bss
begbss:
.text
SETUPLEN = 4 ! nr of setup-sectors
! setup 占用的磁盘扇区数
BOOTSEG = 0x07c0 ! original address of boot-sector
! bootsect 代码所在的原地址(被BIOS子程序加载至此处)
INITSEG = DEF_INITSEG ! we move boot here - out of the way
! bootsect将要移动到的目的段位置,为了避开系统模块占用处
SETUPSEG = DEF_SETUPSEG ! setup starts here
! setup程序代码从该段位置开始
SYSSEG = DEF_SYSSEG ! system loaded at 0x10000 (65536).
! system 模块将被加载到 0x10000
ENDSEG = SYSSEG + SYSSIZE ! where to stop loading
! 停止加载的段地址
! ROOT_DEV & SWAP_DEV are now written by "build".
! 根文件系统设备号 ROOT_DEV 和 交换设备号 SWAP_DEV 现在由 tools 目录下的 build 程序写入。
! 设备号具体值的含义如下:
! 设备号=主设备号*256 + 次设备号(也即 dev_no = ( major <<8 ) + minor )
! (主设备号:1-内存,2-磁盘,3-硬盘,4-ttyx,5-tty,6-并行口,7-非命名管道)
! 0x300 - /dev/hd0 - 代表整个第 1 个硬盘;
!