<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>x86 &#8211; 寂静花园</title>
	<atom:link href="https://www.addesp.com/archives/tag/x86/feed" rel="self" type="application/rss+xml" />
	<link>https://www.addesp.com</link>
	<description>寂静中交织着热情</description>
	<lastBuildDate>Mon, 09 Aug 2021 15:30:02 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.2</generator>
	<item>
		<title>32 位的操作系统也能使用超过4G的内存-PAE 技术简介</title>
		<link>https://www.addesp.com/archives/242</link>
					<comments>https://www.addesp.com/archives/242#respond</comments>
		
		<dc:creator><![CDATA[ADD-SP]]></dc:creator>
		<pubDate>Wed, 01 Apr 2020 16:03:14 +0000</pubDate>
				<category><![CDATA[随笔]]></category>
		<category><![CDATA[x86]]></category>
		<guid isPermaLink="false">http://69a274df.addesp.com/?p=242</guid>

					<description><![CDATA[概述 阅读本文章前请确认对X86下的分页机制有最基本的了解，否则将难以理解本文中提到的内容。本文介绍的内容均位 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">概述</h2>



<p class="wp-block-paragraph">阅读本文章前请确认对X86下的分页机制有最基本的了解，否则将难以理解本文中提到的内容。<br>本文介绍的内容均位X86架构下的PAE技术，而不是ARM架构下的LPAE技术，虽然两者从本质来说是一样的。</p>



<p class="wp-block-paragraph">介绍下列内容：</p>



<ul class="wp-block-list"><li>PAE 技术因何问世</li><li>PAE 技术可以干什么</li><li>PAE 技术实现原理</li><li>为什么我们所用的 32 位操作系统只能使用 4GB 的内存</li></ul>



<h2 class="wp-block-heading">PAE 技术因何问世</h2>



<p class="wp-block-paragraph">PAE（Physical&nbsp;Address&nbsp;Extension，中文译名：物理地址扩展）技术最初是为了弥补32位地址在服务上不够用的情况。因为32位的地址最多只能支持4GB的内存，而这对于很多服务器来说是远远不够的，而那时64位的CPU和操作系统还没有普及，这个技术临时缓解了一下这类问题。</p>



<h2 class="wp-block-heading">PAE 技术可以干什么</h2>



<p class="wp-block-paragraph">PAE技术可以使得多个进程使用的总内存大于 4GB，但是单个进程的所使用的内存上限依然只有 4GB。</p>



<h2 class="wp-block-heading">PAE 技术实现原理</h2>



<ul class="wp-block-list"><li>地址线由 32 根增加到 36 根，寻址空间自然也就从 4GB 增加到了 64GB。</li><li>改动了分页机构使其可以适应36根地址线的寻址空间。</li></ul>



<p class="wp-block-paragraph">本文主要介绍分页机构的改动。</p>



<h3 class="wp-block-heading">未启动 PAE 下的分页机制</h3>



<h4 class="wp-block-heading">4K 分页</h4>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="576" height="414" src="https://www.addesp.com/wp-content/uploads/2020/09/0-9.webp" alt="" class="wp-image-243"/><figcaption><em>未启动 PAE 下的 4K 分页</em></figcaption></figure>



<ol class="wp-block-list"><li>从 <strong>CR3</strong> 寄存器中取出<strong>页目录</strong>的基址。</li><li>取出<strong>线性地址</strong>中的 22 位~31 位共 10 位作为<strong>页目录项</strong>在<strong>页目录</strong>中的索引，由此找到<strong>页目录项</strong>。</li><li>根据<strong>页目录项</strong>中的内中找到对应的<strong>页表</strong>的基址。</li><li>取出<strong>线性地址</strong>中的 12 位~21 位共 10 位作为<strong>页表项</strong>在<strong>页表</strong>中的索引，由此找到<strong>页表项</strong>。</li><li>取出<strong>线性地址</strong>中的 0 位~11 位共 12 位作为<strong>页内偏移</strong>，从<strong>页表项</strong>中取出<strong>页基址</strong>，两者相加则到<strong>物理地址</strong>。</li></ol>



<h4 class="wp-block-heading">4M分页</h4>



<figure class="wp-block-image size-large"><img decoding="async" width="567" height="405" src="https://www.addesp.com/wp-content/uploads/2020/09/1-7.webp" alt="" class="wp-image-244"/><figcaption><em>未启动&nbsp;PAE下的&nbsp;4M&nbsp;分页</em></figcaption></figure>



<ol class="wp-block-list"><li>从 <strong>CR3 </strong>寄存器中取出<strong>页表</strong>的基址。</li><li>取出<strong>线性地址</strong>中的 22 位~31 位共 10 位作为<strong>页表项</strong>在<strong>页表</strong>中的索引，由此找到<strong>页表项</strong>。</li><li>取出<strong>线性地址</strong>中的 0 位~21 位共 22 位作为<strong>页内偏移</strong>，从<strong>页表项</strong>中取出<strong>页基址</strong>，两者相加则到<strong>物理地址</strong>。</li></ol>



<h3 class="wp-block-heading">启动&nbsp;PAE&nbsp;下的分页机制</h3>



<h4 class="wp-block-heading"><>4K&nbsp;分页</h4>



<figure class="wp-block-image size-large"><img decoding="async" width="621" height="396" src="https://www.addesp.com/wp-content/uploads/2020/09/2-7.webp" alt="" class="wp-image-245"/><figcaption><em>启动&nbsp;PAE下的&nbsp;4K分页</em></figcaption></figure>



<ol class="wp-block-list"><li>从 <strong>CR3 </strong>寄存器中取出<strong>页目录指针表</strong>的基址。</li><li>取出<strong>线性地址</strong>的 30 位~31 位共 2 位作为<strong>页目录指针</strong>在<strong>页目录指针表</strong>中的索引，由此找到<strong>页目录指针</strong>。</li><li>根据<strong>页目录指针</strong>获得对应的<strong>页目录</strong>的基址</li><li>取出<strong>线性地址</strong>中的 21 位~29 位共 9 位作为<strong>页目录项</strong>在<strong>页目录</strong>中的索引，由此找到<strong>页目录项</strong>。</li><li>根据<strong>页目录项</strong>找到对应<strong>页表</strong>的基址。</li><li>取出<strong>线性地址</strong>中的 12 位~20 位共 9 位作为<strong>页表项</strong>在<strong>页表</strong>中索引，由此找到<strong>页表项</strong>。</li><li>取出<strong>线性地址</strong>中的 0 位~11 位共 12 位作为<strong>页内偏移</strong>，从<strong>页表项</strong>中取出<strong>页基</strong>址，两者相加则到<strong>物理地址</strong>。</li></ol>



<h4 class="wp-block-heading">4M&nbsp;分页</h4>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="612" height="378" src="https://www.addesp.com/wp-content/uploads/2020/09/3-5.webp" alt="" class="wp-image-246"/><figcaption><em>启动 &nbsp;PAE 下的&nbsp;4M&nbsp;分页</em></figcaption></figure>



<ol class="wp-block-list"><li>从 <strong>CR3 </strong>寄存器中取出<strong>页表指针表</strong>的基址。</li><li>取出<strong>线性地址</strong>的 30 位~ 31 位共 2 位作为<strong>页表指针</strong>在<strong>页表指针表</strong>中的索引，由此找到<strong>页表指针</strong>。</li><li>根据<strong>页表指针</strong>找到对应的<strong>页表</strong>的基址。</li><li>取出<strong>线性地址</strong>中的 21 位~29 位共 9 位作为<strong>页表项</strong>在<strong>页表</strong>中的索引，由此找到<strong>页表项</strong>。</li><li>取出<strong>线性地址</strong>中的 0 位~21 位共 22 位作为<strong>页内偏移</strong>，从<strong>页表项</strong>中取出<strong>页基址</strong>，两者相加则到<strong>物理地址</strong>。</li></ol>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.addesp.com/archives/242/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
