⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 booting-a20_4.htm

📁 编写自己的操作系统
💻 HTM
📖 第 1 页 / 共 4 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0056)http://www.huihoo.com/gnu_linux/own_os/booting-a20_4.htm -->
<HTML xmlns:o = "urn:schemas-microsoft-com:office:office"><HEAD><TITLE></TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY bgColor=#d2b48c background="">
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT 
face="Times New Roman" size=6><SPAN style="mso-tab-count: 1"><STRONG>1.4 A20 
Gate</STRONG></SPAN></FONT></SPAN></P><SPAN lang=EN-US><FONT 
face="Times New Roman" size=5><SPAN style="mso-tab-count: 1">
<P>
<P><FONT size=3>[</FONT><A 
href="index.htm" 
tppabs="http://pagoda-ooos.51.net/os_book/index.htm"><FONT 
size=3>Home</FONT></A><FONT size=3>]&nbsp; [</FONT><A 
href="booting.htm" 
tppabs="http://pagoda-ooos.51.net/os_book/booting.htm"><FONT 
size=3>Top</FONT></A><FONT size=3>]&nbsp; [</FONT><A 
href="booting-bios_3.htm" 
tppabs="http://pagoda-ooos.51.net/os_book/booting/booting-bios_3.htm"><FONT 
size=3>Previous</FONT></A><FONT size=3>]&nbsp; [</FONT><A 
href="booting-loading_process_5.htm" 
tppabs="http://pagoda-ooos.51.net/os_book/booting/booting-loading_process_5.htm"><FONT 
size=3>Next</FONT></A><FONT size=3>]</FONT></P>
<P><STRONG>
<HR width="100%" SIZE=2>
</STRONG>
<P></P>
<P></P></SPAN></FONT></SPAN><SPAN lang=EN-US><FONT 
face="Times New Roman TUR"><SPAN style="mso-tab-count: 1">
<P class=MsoNormal 
style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; tab-stops: list 21.0pt; mso-list: l5 level1 lfo3"><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN 
lang=EN-US><STRONG><FONT face="Times New Roman" size=5>1.4.1 
Overview</FONT></STRONG></SPAN></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"><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"></SPAN>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><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><SPAN 
lang=EN-US>A20 Gate</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">就是其中之一。</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT 
face="Times New Roman TUR"></FONT></SPAN>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><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><SPAN 
lang=EN-US>8086/8088</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中,只有</SPAN><SPAN 
lang=EN-US>20</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">根地址总线,所以可以访问的地址是</SPAN><SPAN 
lang=EN-US>2^20=1M</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,但由于</SPAN><SPAN 
lang=EN-US>8086/8088</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</SPAN><SPAN 
lang=EN-US>16</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">位地址模式,能够表示的地址范围是</SPAN><SPAN 
lang=EN-US>0-64K</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,所以为了在</SPAN><SPAN 
lang=EN-US>8086/8088</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">下能够访问</SPAN><SPAN 
lang=EN-US>1M</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">内存,</SPAN><SPAN 
lang=EN-US>Intel</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">采取了分段的模式:</SPAN><SPAN 
lang=EN-US>16</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">位段基地址</SPAN><SPAN 
lang=EN-US>:16</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">位偏移。其绝对地址计算方法为:</SPAN><SPAN 
lang=EN-US>16</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">位基地址左移</SPAN><SPAN 
lang=EN-US>4</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">位</SPAN><SPAN 
lang=EN-US>+16</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">位偏移</SPAN><SPAN 
lang=EN-US>=20</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">位地址。</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT 
face="Times New Roman TUR"></FONT></SPAN>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><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><SPAN 
lang=EN-US>FFFFh:FFFFh=FFFF0h+FFFFh=10FFEFh=1M+64K-16Bytes</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(</SPAN><SPAN 
lang=EN-US>1M</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">多余出来的部分被称做高端内存区</SPAN><SPAN 
lang=EN-US>HMA</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">)。但</SPAN><SPAN 
lang=EN-US>8086/8088只有</SPAN><SPAN lang=EN-US>20</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">位地址线,如果访问</SPAN><SPAN 
lang=EN-US>100000h~10FFEFh之间的内存,则必须有第21根地址线。</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所以当程序员给出超过</SPAN><SPAN 
lang=EN-US>1M</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(</SPAN><SPAN 
lang=EN-US>100000H-10FFEFH</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">)的地址时,系统并不认为其访问越界而产生异常,而是自动从重新</SPAN><SPAN 
lang=EN-US>0</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">开始计算,也就是说系统计算实际地址的时候是按照对</SPAN><SPAN 
lang=EN-US>1M</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">求模的方式进行的,这种技术被称为</SPAN><SPAN 
lang=EN-US>wrap-around</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT 
face="Times New Roman TUR"></FONT></SPAN>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><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><SPAN 
lang=EN-US>80286</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,系统的地址总线发展为</SPAN><SPAN 
lang=EN-US>24</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">根,这样能够访问的内存可以达到</SPAN><SPAN 
lang=EN-US>2^24=16M</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN><SPAN 
lang=EN-US>Intel在设计80286时</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">提出的目标是,在实模式下,系统所表现的行为应该和</SPAN><SPAN 
lang=EN-US>8086/8088</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所表现的完全一样,也就是说,在实模式下,</SPAN><SPAN 
lang=EN-US>80286</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">以及后续系列,应该和</SPAN><SPAN 
lang=EN-US>8086/8088</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">完全兼容。但最终,</SPAN><SPAN 
lang=EN-US>80286</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">芯片却存在一个</SPAN><SPAN 
lang=EN-US>BUG</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">:如果程序员访问</SPAN><SPAN 
lang=EN-US>100000H-10FFEFH</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">之间的内存,系统将实际访问这块内存,而不是象过去一样重新从</SPAN><SPAN 
lang=EN-US>0</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">开始。</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><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></FONT>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt" align=center><FONT 
face="Times New Roman TUR"><FONT size=2><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><IMG 
height=361 alt="" hspace=0 src="booting-a20_4.files/a20_3.jpg" width=569 
border=2 
tppabs="http://pagoda-ooos.51.net/os_book/booting/a20/a20_3.jpg"></SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><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></FONT>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><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><SPAN 
lang=EN-US>IBM使用</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">键盘控制器上剩余的一些输出线来管理第21根地址线(从0开始数是第20根),被称为</SPAN><SPAN 
lang=EN-US>A20 Gate</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">:如果</SPAN><SPAN 
lang=EN-US>A20 Gate</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">被打开,则当程序员给出</SPAN><SPAN 
lang=EN-US>100000H-10FFEFH</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">之间的地址的时候,系统将真正访问这块内存区域;如果</SPAN><SPAN 
lang=EN-US>A20 Gate</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">被禁止,则当程序员给出</SPAN><SPAN 
lang=EN-US>100000H-10FFEFH</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">之间的地址的时候,系统仍然使用</SPAN><SPAN 
lang=EN-US>8086/8088</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的方式。绝大多数</SPAN><SPAN 
lang=EN-US>IBM PC</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">兼容机默认的</SPAN><SPAN 
lang=EN-US>A20 Gate</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是被禁止的。由于在当时没有更好的方法来解决这个问题,所以IBM使用了键盘控制器来操作A20 
Gate,但这只是一种黑客行为,毕竟A20 Gate和键盘操作没有任何关系。在许多新型PC上存在着一种通过芯片来直接控制A20 
Gate的BIOS功能。从性能上,这种方法比通过键盘控制器来控制A20 Gate要稍微高一点。</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><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><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"></SPAN></FONT>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><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><SPAN 
lang=EN-US>80286</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">以及更高系列的</SPAN><SPAN 
lang=EN-US>PC</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中,即使</SPAN><SPAN 
lang=EN-US>A20 Gate</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">被打开,在实模式下所能够访问的内存最大也只能为</SPAN><SPAN 
lang=EN-US>10FFEFH</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,尽管它们的地址总线所能够访问的能力都大大超过这个限制。为了能够访问</SPAN><SPAN 
lang=EN-US>10FFEFH</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">以上的内存,则必须进入保护模式。(其实所谓的实模式,就是</SPAN><SPAN 
lang=EN-US>8086/8088</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的模式,这种模式存在的唯一理由就是为了让旧的程序能够继续正常的运行在新的</SPAN><SPAN 
lang=EN-US>PC</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">体系上)</SPAN></FONT><SPAN 
lang=EN-US style="FONT-SIZE: 14pt; mso-bidi-font-size: 12.0pt"></P>
<H3 
style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 0cm; mso-char-indent-count: 0; mso-char-indent-size: 0cm">&nbsp;</H3>
<H3 
style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 0cm; mso-char-indent-count: 0; mso-char-indent-size: 0cm">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -