📄 booting-loading_process_5.htm
字号:
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US></SPAN></SPAN> </P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US><FONT face="Times New Roman TUR"><FONT
size=3>主机在Power-on或Reset后,经过POST,然后读取磁盘的第一扇区之后,常规内存的布局如上图所示。<SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US></SPAN></SPAN></FONT></FONT></SPAN></SPAN></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US><FONT size=3></FONT></SPAN></SPAN></SPAN></SPAN> </P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US><FONT face="Times New Roman TUR"><FONT size=3><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US>我们在进入保护模式之前<FONT face="Times New Roman TUR">BIOS Interrupt
Ventors Table, BIOS Data Area和Extend BIOS Data Area都可能会有用,即使进入Protected
Mode之后,如果你想让你的OS支持VM8086模式,也就是说如果你想让你的OS上可以运行Real
Mode软件,这两个区域也会用得着,所以不要去对这些内容进行修改</FONT>。</SPAN></SPAN>令人不解的是,为什么BIOS厂商将BIOS Data
Area和Extend BIOS Data
Area分别放在常规RAM的顶端和底部。在进行内存布局规划的时候,面临着令人非常困扰的选择。这也是为什么Linux对640KB常规内存进行规划的时候,将最底部的64KB保留,而最顶部的64KB中只有低地址的16KB被使用,其它的部分都被保留的原因。</FONT></FONT></SPAN></SPAN></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US><FONT size=3></FONT></SPAN></SPAN> </P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><FONT size=3>由于First Boot Block只有512
bytes的大小,所以它所能做的事情非常有限,如果我们想在Real Mode下作更多的事情,我们必须有一个Second
booter,它一方面负责获取各种物理设备参数,这些参数将来要被OS Kernel使用;另一方面,如果OS Kernel运行在Protected
Mode下的话,The Second Booter需要为进入Protected Mode做各种准备,并进入Protected Mode。</FONT></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><FONT size=3></FONT> </P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><FONT size=3>既然The Second
Booter没有局促的大小限制——最起码几十K是没有问题的,如果用汇编的话,几十K已经足够了——那么我们就没有必要花费心思让The First Boot
Block做太多的工作,我们只需要让The Second Booter来做就可以了。The First Boot
Block需要做的只是检测启动设备类型,并将The Second Booter装入RAM。</FONT></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US><FONT size=3></FONT></SPAN></SPAN> </P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><FONT face="Times New Roman Greek"><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US><FONT size=3><FONT face="Times New Roman TUR">当载入OS
Kernel时,你需要仔细决定将其载入到哪个位置。OS
Kernel可能会比较大,这时候,你可以将Kernel的Image压缩,然后将其读入到常规内存中;读入之后将其解压,将解压后的Kernel放置到扩展内存中(1M以上的位置)。</FONT></FONT></SPAN></SPAN></FONT></P>
<P><FONT face="Times New Roman TUR" size=3><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US>
<HR width="100%" SIZE=1>
<P></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left></SPAN></SPAN></FONT><FONT face="Times New Roman TUR"><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US><FONT size=3><FONT face="Times New Roman TUR"><EM><STRONG>How to
place big kernel into extend
memory?</STRONG></EM></FONT></FONT></SPAN></SPAN></FONT></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><EM><FONT face=楷体_GB2312 size=3><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US></SPAN></SPAN></FONT><FONT face=楷体_GB2312 size=3><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US></SPAN></SPAN></FONT></EM> </P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><FONT face=楷体_GB2312><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US><FONT size=3><EM><FONT
face=楷体_GB2312>1.Linux大内核方式(bzImage)所用的方法,使用int 15h,每次拷贝64k数据</FONT>。
</EM></FONT></SPAN></SPAN></FONT></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><FONT face=楷体_GB2312><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US><FONT size=3><FONT face=楷体_GB2312><EM>2.用BIOS所用的方法,临时切换到保护模式,
设置某一个段描述为0~4G,再切换回实模式,引用这个段,就可以自由访问4G空间了</EM></FONT>。</FONT></SPAN></SPAN></FONT></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left> </P><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US>
<HR width="100%" SIZE=2>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><STRONG><FONT
face="Times New Roman TUR" size=5></FONT></STRONG></SPAN> </P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><STRONG><FONT
face="Times New Roman TUR" size=5>1.5.3 Floppy
System</FONT></STRONG></SPAN></P><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><FONT size=3><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN
lang=EN-US><FONT size=3></FONT></SPAN></SPAN></SPAN></SPAN></FONT> </P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><FONT face="Times New Roman TUR"
size=3>相对于其他大多数子系统,软盘BIOS服务的相关资料要详尽的多。从第一台PC机开始,软盘系统的基本控制器接口就基本保持未变。当然,AT还加入了一些新的BIOS服务,最新的系统还支持2.88M的软盘。</FONT></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><FONT face="Times New Roman TUR" size=3></FONT> </P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><FONT face="Times New Roman TUR"
size=3>软盘的访问要通过适配卡上的硬件和内置于系统主BIOS内的BIOS软件。该组合提供了简单方便的格式化,读和写软盘操作,从AT开始起,BIOS所支持的软盘驱动器的数目从四个减少到两个以内。访问两个以上的软驱需要专门的适配器硬件和驱动程序,比如MS-DOS的Driver.sys。</FONT></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=center><IMG src="booting-loading_process_5.files/floppy.gif"
tppabs="http://pagoda-ooos.51.net/os_book/booting/loading-process/floppy.gif"></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=center> </P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=center><IMG src="booting-loading_process_5.files/floppy2.gif"
tppabs="http://pagoda-ooos.51.net/os_book/booting/loading-process/floppy2.gif"></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left> </P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><FONT face="Times New Roman TUR"
size=3>上面两图表现的是软盘的逻辑结构,每个软盘分为柱面(Cylinder),磁道(Track),扇区(Sector),最小的组成部分是扇区,通常每个扇区有512
Bytes的数据。多个扇区组成一个磁道。例如,一个1.44
MB的软盘每磁道有18个扇区,其它软盘类型每个磁道有9到36个扇区,这取决于在每英寸介质上可以可靠保存的位数。两个对称的磁道,软盘的一面各一个,定义为一个柱面。软盘有40或80个柱面,这取决于介质类型。</FONT></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><FONT face="Times New Roman TUR" size=3></FONT> </P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><FONT face="Times New Roman TUR"
size=3>事实上,一个扇区的坐标位置由柱面,磁道,和扇区三个因素的坐标共同决定:X-柱面(0-39或0-79),Y-磁道(0-1),Z-扇区(0-9或0-18或0-36)。如下图所示:</FONT></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=center><IMG src="booting-loading_process_5.files/floppy3.gif"
tppabs="http://pagoda-ooos.51.net/os_book/booting/loading-process/floppy3.gif"></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"
align=left><FONT face="Times New Roman TUR" size=3>下表总结了由512
bytes扇区组成的各种软盘的参数。此表也列出了所使用的传输率,单位是bit/second。它是数据在Driver和Controler之间传输的速率。传输速率取决于软盘的容量、Driver类型以及软盘转动的速率,单位是RPM(Running
Per Minute)转每分。软盘转得越快,每线性英寸的介质上被选中的数据就越多,传输速率总是固定的,软件不能对其进行定义。</FONT></P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -