<?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>编译点滴 &#187; MIPS</title>
	<atom:link href="http://www.lingcc.com/tag/mips/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lingcc.com</link>
	<description>编译器、虚拟机、程序设计语言、体系结构、软件调试、操作系统等等</description>
	<lastBuildDate>Sat, 04 Feb 2012 06:56:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>你好，LLVM 3.0</title>
		<link>http://www.lingcc.com/2011/12/08/11882/</link>
		<comments>http://www.lingcc.com/2011/12/08/11882/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 05:39:40 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[LLVM]]></category>
		<category><![CDATA[编译技术]]></category>
		<category><![CDATA[clang]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[中间表示]]></category>
		<category><![CDATA[寄存器分配]]></category>
		<category><![CDATA[异常处理]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=11882</guid>
		<description><![CDATA[估计很多朋友都关注到了，LLVM 终于发布了3.0版本，这个版本有哪些新的变化呢？我们先从三个大的特性看起。 Table of Contents 1 重写的类型系统 2 新的异常处理机制 3 新的贪心寄存器分配策略 4 其他新变化 5 参考 1 重写的类型系统 中间表示是产品级编译器的核心。编译器的许多程序分析和变换都在中间表示上进行（IR）。 如GCC的GIMPLE，Open64的WHIRL，LLVM的LLVMIR，C#的CIL，Java的bytecode. 中间表示的类型系统，是很多分析和变换赖以存在的基础。LLVM带有类型的低层次中间表示是其一大特色。 因此，中间表示的变更，必须由大牛操刀才行。LLVM blog上关于LLVM 3.0的类型系统介绍就是由Chris Lattner亲自撰写。 这次类型系统的重写，目的有如下几个: 能使用高效的指针等价检测来确定结构体类型的等价 使用推迟的类型仿射信息，例如在链接时可以通过其他目标文件得到当前目标文件中某个类型的完整信息 新类型系统能够支持更多的前端语言 新类型系统的特点： 只有结构体类型(StructType)，能进行递归定义。即结构体本身包含指向自己的指针类型。如下： struct listnode { int val; listnode* next; }; 这部分代码在LLVM的中间表示中，表示如下： %intlist = type { %intlist*, i32 } 增加一种新的ID结构体类型（identified struct）。 这种类型可以先给ID，再在之后创建具体的域。这种结构体类型提供递归支持。(結構體類型包含兩類: literal structure 和 identified structure。其表面上的差別在於 literal <a href='http://www.lingcc.com/2011/12/08/11882/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F03%2F10884%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F12%2F08%2F11882%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">安装LLVM2.7 step by step</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F28%2F10807%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F12%2F08%2F11882%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM 2.7 发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F12%2F08%2F11882%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F20%2F11361%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F12%2F08%2F11882%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM居然开始做广告了！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F03%2F04%2F11545%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F12%2F08%2F11882%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">AMD intern and full time compiler position based on OpenCL and LLVM</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/04/28/10807/' rel='bookmark' title='LLVM 2.7 发布'>LLVM 2.7 发布</a></li>
<li><a href='http://www.lingcc.com/2010/05/03/10884/' rel='bookmark' title='安装LLVM2.7 step by step'>安装LLVM2.7 step by step</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2010/06/02/10955/' rel='bookmark' title='Google的野心&#8211;Native Client+LLVM'>Google的野心&#8211;Native Client+LLVM</a></li>
<li><a href='http://www.lingcc.com/2011/06/05/11625/' rel='bookmark' title='Google 与 Clang'>Google 与 Clang</a></li>
<li><a href='http://www.lingcc.com/2010/04/29/10728/' rel='bookmark' title='前瞻-全时优化和LLVM-2'>前瞻-全时优化和LLVM-2</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>估计很多朋友都关注到了，LLVM 终于发布了3.0版本，这个版本有哪些新的变化呢？我们先从三个大的特性看起。</p>
<p><span id="more-11882"></span></p>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 重写的类型系统 </a></li>
<li><a href="#sec-2">2 新的异常处理机制 </a></li>
<li><a href="#sec-3">3 新的贪心寄存器分配策略 </a></li>
<li><a href="#sec-4">4 其他新变化 </a></li>
<li><a href="#sec-5">5 参考 </a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> 重写的类型系统</h2>
<div id="text-1" class="outline-text-2">
<p>中间表示是产品级编译器的核心。编译器的许多程序分析和变换都在中间表示上进行（IR）。<br />
如GCC的GIMPLE，Open64的WHIRL，LLVM的LLVMIR，C#的CIL，Java的bytecode.</p>
<p>中间表示的类型系统，是很多分析和变换赖以存在的基础。LLVM带有类型的低层次中间表示是其一大特色。<br />
因此，中间表示的变更，必须由大牛操刀才行。LLVM blog上关于LLVM 3.0的类型系统介绍就是由Chris Lattner亲自撰写。</p>
<p>这次类型系统的重写，目的有如下几个:</p>
<ul>
<li>能使用高效的指针等价检测来确定结构体类型的等价</li>
<li>使用推迟的类型仿射信息，例如在链接时可以通过其他目标文件得到当前目标文件中某个类型的完整信息</li>
<li>新类型系统能够支持更多的前端语言</li>
</ul>
<p>新类型系统的特点：</p>
<ul>
<li>只有结构体类型(StructType)，能进行递归定义。即结构体本身包含指向自己的指针类型。如下：</li>
</ul>
<pre class="src src-c"><span style="color: #ff0000;">struct</span> <span style="color: #6920ac;">listnode</span> {
<span style="color: #6920ac;">int</span> <span style="color: #0000cd;">val</span>;
<span style="color: #6920ac;">listnode</span>* <span style="color: #0000cd;">next</span>;
};</pre>
<p>这部分代码在LLVM的中间表示中，表示如下：<br />
<code> %intlist = type { %intlist*, i32 }</code></p>
<ul>
<li>增加一种新的ID结构体类型（identified struct）。<br />
这种类型可以先给ID，再在之后创建具体的域。这种结构体类型提供递归支持。(<strong>結構體類型包含兩類: literal structure 和 identified structure。其表面上的差別在於 literal structure 不具名，identified structure 具名 (有 ID) 。literal structure 在創建時就需要指定其域 (body)，identified structure 可以先給名字，之後再指定其域。這邊可以了解到為什麼針對 literal structure 和 identified structure 做型別比較有差異。針對 literal structure 就只能比較兩者之間的域，針對 identified structure 則是比較其名。不同名字的 identified structure 被視為是不同的型別。by chenwj</strong>)</li>
<li>ID结构体类型和名字采用一一对应的关系。类型的名字现在作为类型的一个内部属性，不再使用哈希表的存储方式。<br />
这样就避免了两个明明不同的类型输出名字相同的情况。（<strong>補充一下，這是指 asmprinter 印出類型名稱的時候。by chenwj</strong>)</li>
<li>在LLVMContext级，结构体名称唯一化。如果出现结构体名称不小心相同的情况，VMCore会检测该冲突，并自动为后一个名字增加后缀。</li>
<li>优化器能得到源程序中类型的语义信息了。<br />
为了研究的考虑，有时需要从前端直接把类型名称传到LLVM中，该支持就是为了实现这一功能。(<strong>有些使用者會利用型別名稱 (type name，ID) 把資訊從前端傳遞給之後的優化器。LLVM 不希望在去掉 (strip) LLVM IR 中型別名稱之後，使得前述作法失效。解決方法是用具名的 metadata 保留型別名稱的相關資訊，magic.types 是範例中 metadata 的名字。這樣即使原本型別名稱被去掉或是改名，使用者仍然可以透過該具名的 metadata 取回他想要的原本的型別名稱。具名的 metadata 和附屬在指令 (LLVM instruction) 的 metadata 不同，具名的 metadata 不會被優化器去掉或是非法化。by chenwj</strong>)<br />
这里要小心为了上面提到的，为避免重名而增加后缀。</li>
<li>精心设计的类型系统与2.9兼容，能让经2.9编译得到的.bc 和.ll文件中的类型信息自动升级成新的类型信息。不过LLVM 3.1版本将取消这一支持。</li>
</ul>
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> 新的异常处理机制</h2>
<div id="text-2" class="outline-text-2">
<p>作为一个支持高级语言的编译器，LLVM IR中的异常支持也要非常的给力才行，否则很多情况会hold不住。<br />
比如函数inline的时候如何保证异常处理的正确性、代码生成的时候要能够可靠的找到异常处理函数的相关信息。<br />
此外，LLVM也需要遵守其他编译器遵守的ABI规则，以实现和其他编译器生成的目标文件的二进制兼容。</p>
<p>老的LLVM异常处理机制采用intrinsic来传递异常处理信息。<br />
所谓intrinsic是编译器中间表示中常用的一种额外信息添加手段。<br />
对于普通信息，编译器会一一进行分析和处理。而intrinsic信息一般在编译器内部的分析中是不可见的。<br />
只能通过特殊的接口对其进行处理。因此那些可能涉及到异常信息变化的分析和程序变换只能做最保守动作。</p>
<p>新的异常处理机制增加數條 LLVM (原生，first-class) 指令，並新增/移除數條 LLVM Intrinsics 指令。其中最重要的是 invoke、landingpad 和resume 指令”。</p>
<ul>
<li>invoke: 因为try语句中的函数调用可能会引发异常,所以这里引入了invoke指令,专门用来对付这类调用</li>
<li>landingpad:<br />
定义了一个基本块，代码生成器可以利用这个基本块得到正确的异常处理表。<br />
他用于取代@llvm.eh.exception 和 @llvm.eh.selector intrinsic</li>
<li>resume：<br />
让当前的异常能依次沿栈向上传播。它用于取代@llvm.eh.resume intrinsic</li>
</ul>
<p>新的异常处理机制让中间表示更容易理解，让异常处理更好的在中间表示中表达。</p>
<p>陳韋任撰写了更加详细的LLVM异常处理机制，感兴趣的朋友可以参考一下：</p>
<ul>
<li><a href="http://www.hellogcc.org/archives/602">http://www.hellogcc.org/archives/602</a> （LLVM Introduction – Exception Handling 1/2）</li>
<li><a href="http://www.hellogcc.org/archives/621">http://www.hellogcc.org/archives/621</a>  （LLVM Introduction – Exception Handling 2/2）</li>
</ul>
</div>
</div>
<div id="outline-container-3" class="outline-2">
<h2 id="sec-3"><span class="section-number-2">3</span> 新的贪心寄存器分配策略</h2>
<div id="text-3" class="outline-text-2">
<p>现在LLVM 3.0有了两个寄存器分配器：基础分配器和贪心分配器。(如果有人有興趣知道 basic 和 greedy register allocator 是根據什麼演算法的話，可以參考<a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-September/043511.html" rel="nofollow">http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-September/043511.html</a> by Chenwj)</p>
<ul>
<li>基础分配器：<br />
3.0以前，LLVM一直在使用线性分配器。它很简单，修改起来比较容易。<br />
虽然高级的寄存器分配算法能获得高性能，但一般都需要复杂的数据结构，而且活跃区间的分析也很复杂。<br />
而且高级的寄存器分配算法一般无法做到在程序运行的同时能实时的修改机器码。<br />
线性扫描器会线性的访问各个变量的活跃区间，并维护一个活跃列表。<br />
通过这一机制去检测活跃区间间的干扰问题，不需要计算完整的干扰图。<br />
但这套机制使得寄存器溢出时需要对所有的活跃区间分割，重新计算活跃列表，代价很高。新的基础分配器采用优先队列的方式访问活跃区间，减小溢出的代价。基础分配器使用新的活跃事件集合器（live interval unions)取代原先的活跃列表，<br />
并利用B+树为每个物理寄存器维护一个活跃事件集合器(live interval unions)。<br />
需要分割活跃区间时，因为有了优先队列，直接从队列中找溢出代价最小的一个即可，无需重新搜索所有可溢出的寄存器。<br />
这种机制能有效降低线性分配机制的开销。</li>
<li>贪心分配器：<br />
新的基础分配器中存在的一个显著的问题：优先级队列不能很好的和寄存器着色算法配合起来。<br />
溢出的代价是通过访问该寄存器的密集程度计算的，较小的活跃区间通常溢出代价较高。<br />
但基础分配器中，较小的活跃区间又被优先分配寄存器，这就造成代价很高。贪心分配器就是用来解决这个问题。即用贪心的原则先为较大活跃区间的变量分配寄存器。<br />
这样，小活跃区间的变量再填充进来，代价就会小很多。实践证明，新的贪心分配器能获得更好的性能。<br />
而且，贪心策略还让LLVM在应对随时可能发生的机器码和活跃区间改动时更加可靠。</li>
</ul>
</div>
</div>
<div id="outline-container-4" class="outline-2">
<h2 id="sec-4"><span class="section-number-2">4</span> 其他新变化</h2>
<div id="text-4" class="outline-text-2">
<ul>
<li>Clang:增强对C++、Obj-C的支持</li>
<li>LLVM-GCC不再维护，现在可以使用clang前段或者DragonEgg</li>
<li>LLVM 中间表示支持原子访存操作。这种操作是在C++‘11和C’1x存储模型中引入的。</li>
<li>MIPS后端对MIPS32指令集、O32 ABI已经达到产品级的稳定性，而且支持丰富的MIPS子后端</li>
<li>LLVM的优化器和代码生成器支持gprof和gcov-style形式的profile信息。</li>
</ul>
</div>
</div>
<div id="outline-container-5" class="outline-2">
<h2 id="sec-5"><span class="section-number-2">5</span> 参考</h2>
<div id="text-5" class="outline-text-2">
<ul>
<li><a href="http://blog.llvm.org/2011/11/llvm-30-type-system-rewrite.html">http://blog.llvm.org/2011/11/llvm-30-type-system-rewrite.html</a></li>
<li><a href="http://blog.llvm.org/2011/11/llvm-30-exception-handling-redesign.html">http://blog.llvm.org/2011/11/llvm-30-exception-handling-redesign.html</a></li>
<li><a href="http://www.sdtimes.com/blog/post/2011/12/07/Whats-new-in-LLVM-30.aspx">http://www.sdtimes.com/blog/post/2011/12/07/Whats-new-in-LLVM-30.aspx</a></li>
<li><a href="http://blog.llvm.org/2011/09/greedy-register-allocation-in-llvm-30.html">http://blog.llvm.org/2011/09/greedy-register-allocation-in-llvm-30.html</a></li>
<li><a href="http://www.llvm.org/docs/ExceptionHandling.html">http://www.llvm.org/docs/ExceptionHandling.html</a></li>
<li></li>
</ul>
</div>
</div>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F03%2F10884%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F12%2F08%2F11882%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">安装LLVM2.7 step by step</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F28%2F10807%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F12%2F08%2F11882%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM 2.7 发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F12%2F08%2F11882%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F20%2F11361%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F12%2F08%2F11882%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM居然开始做广告了！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F03%2F04%2F11545%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F12%2F08%2F11882%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">AMD intern and full time compiler position based on OpenCL and LLVM</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/04/28/10807/' rel='bookmark' title='LLVM 2.7 发布'>LLVM 2.7 发布</a></li>
<li><a href='http://www.lingcc.com/2010/05/03/10884/' rel='bookmark' title='安装LLVM2.7 step by step'>安装LLVM2.7 step by step</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2010/06/02/10955/' rel='bookmark' title='Google的野心&#8211;Native Client+LLVM'>Google的野心&#8211;Native Client+LLVM</a></li>
<li><a href='http://www.lingcc.com/2011/06/05/11625/' rel='bookmark' title='Google 与 Clang'>Google 与 Clang</a></li>
<li><a href='http://www.lingcc.com/2010/04/29/10728/' rel='bookmark' title='前瞻-全时优化和LLVM-2'>前瞻-全时优化和LLVM-2</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2011/12/08/11882/feed/</wfw:commentRss>
		<slash:comments>38</slash:comments>
		</item>
		<item>
		<title>How start_kernel get start?</title>
		<link>http://www.lingcc.com/2011/11/26/11814/</link>
		<comments>http://www.lingcc.com/2011/11/26/11814/#comments</comments>
		<pubDate>Sat, 26 Nov 2011 07:21:35 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[CPU]]></category>
		<category><![CDATA[IT职业和生活]]></category>
		<category><![CDATA[Linux系统]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[X86]]></category>
		<category><![CDATA[grub]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pmon]]></category>
		<category><![CDATA[start_kernel]]></category>
		<category><![CDATA[x86]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=11814</guid>
		<description><![CDATA[start_kernel is the first function that kernel runs, like the main function in user space program. In this post, I will try to get a detailed understand of how start_kernel is called on X86_64 and MIPS architecture. Table of Contents 1 Before the kernel image is in the memory 1.1 On X86 1.2 On MIPS <a href='http://www.lingcc.com/2011/11/26/11814/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="JAVA虚拟机入门" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F05%2F08%2F11580%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/05/08/7999970.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">JAVA虚拟机入门</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="领带的11种打法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F29%2F9965%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/05/07/7840031.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">领带的11种打法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="说说静态单赋值（SSA,Static Single-Assignment)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F08%2F13%2F11685%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/13/22609462.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">说说静态单赋值（SSA,Static Single-Assignment)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Intel 的AVX2指令集解读" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F14%2F11639%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/14/12168251.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Intel 的AVX2指令集解读</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title=" P、NP、NP-Complete、NP-hard问题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F11%2F11804%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/11/10615873.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;"> P、NP、NP-Complete、NP-hard问题</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2011/12/05/11872/' rel='bookmark' title='Linux 内核中的.S文件'>Linux 内核中的.S文件</a></li>
<li><a href='http://www.lingcc.com/2011/06/01/11600/' rel='bookmark' title='通用微处理中的SIMD指令扩展'>通用微处理中的SIMD指令扩展</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2011/11/28/11851/' rel='bookmark' title='Illegal Instruction 错误初窥'>Illegal Instruction 错误初窥</a></li>
<li><a href='http://www.lingcc.com/2010/10/13/11318/' rel='bookmark' title='Linux内存的属性'>Linux内存的属性</a></li>
<li><a href='http://www.lingcc.com/2010/02/25/10698/' rel='bookmark' title='好大一筐梅普斯(MIPS)'>好大一筐梅普斯(MIPS)</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>start_kernel is the first function that kernel runs, like the main function in user space program.<br />
In this post, I will try to get a detailed understand of how start_kernel is called on X86_64 and MIPS architecture.<span id="more-11814"></span></p>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Before the kernel image is in the memory </a>
<ul>
<li><a href="#sec-1.1">1.1 On X86 </a></li>
<li><a href="#sec-1.2">1.2 On MIPS </a></li>
</ul>
</li>
<li><a href="#sec-2">2 Before start_kernel function </a>
<ul>
<li><a href="#sec-2.1">2.1 On X86 </a></li>
<li><a href="#sec-2.2">2.2 On MIPS </a></li>
</ul>
</li>
<li><a href="#sec-3">3 Reference </a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> Before the kernel image is in the memory</h2>
<div id="outline-container-1.1" class="outline-3">
<h3 id="sec-1.1"><span class="section-number-3">1.1</span> On X86</h3>
<div id="text-1.1" class="outline-text-3">
<ol>
<li><strong>BIOS&#8217;s job</strong>: start at address 0xFFF0, firstly performs power-on self test(POST) which will check the HW, then hardware-platform specific startup tasks,<br />
and after the HW is recognized and started correctly,<br />
BIOS will the partition boot code from the designated boot device&#8217;s MBR(Master Boot Record).</li>
<li><strong>Boot load&#8217;s job-stage 1</strong>: find and loads the rest of the boot loader (stage 1.5 and stage 2).</li>
<li><strong>Boot load&#8217;s job-stage 2</strong>: display the GRUB startup menu and chooses the operating system.<br />
load compressed kernel file( vmlinux kernel image and initrd image) to memory, pass the selected options to kernel, and invoke the kerne image in real mode</li>
</ol>
<div id="attachment_11819" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/2011/11/26/11814/bootprocess/" rel="attachment wp-att-11819"><img class="size-medium wp-image-11819  " title="boot Process" src="http://www.lingcc.com/wp-content/uploads/2011/11/bootProcess-300x107.png" alt="" width="300" height="107" /></a><p class="wp-caption-text">boot Process on X86</p></div>
</div>
</div>
<div id="outline-container-1.2" class="outline-3">
<h3 id="sec-1.2"><span class="section-number-3">1.2</span> On MIPS</h3>
<div id="text-1.2" class="outline-text-3">
<p>MIPS uses PMON as its BIOS and bootload. so PMON will do both HW check, load kernel.</p>
<ol>
<li>firstly start kernel at 0xbfc0000, and this address will map to address 0 in flash. This address is the first instruction in start.S</li>
<li>start.S does the initialization of cache. then will call the other init function in PMON</li>
<li>then other function in main.c will init the memory, hardwares, and load kernel to memory and pass options.</li>
</ol>
</div>
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> Before start_kernel function</h2>
<div id="outline-container-2.1" class="outline-3">
<h3 id="sec-2.1"><span class="section-number-3">2.1</span> On X86</h3>
<div id="text-2.1" class="outline-text-3">
<ol>
<li>computer will execute codes in arch/x86/boot/head.S</li>
<li>and then it will jump to the C code in arch/x86/boot/main.c.</li>
<li>after some work, it will call function go_to_protected_mode()</li>
<li>In go_to_protected_mode(), firstly, setup_idt() and setup_gdt() for interrupt table and global description table setup will be called.<br />
and then protected_mode_jump() is called.</li>
<li>Then start_32() is called. It will do some registers initialization, and then call decompress_kernel()</li>
<li>After decompress_kernel(), start_32() will do 32-bit mode initialization, and jump to start_kernel function.<br />
The initialization including :</p>
<ul>
<li>clear the bss segment for the protected mode kernel</li>
<li>sets up the final global description table for memory</li>
<li>build page tables, enable paging</li>
<li>initialize a stack</li>
<li>create the final interrupt descriptor table</li>
</ul>
</li>
</ol>
<div id="attachment_11818" class="wp-caption alignnone" style="width: 686px"><a href="http://www.lingcc.com/2011/11/26/11814/kernelinitpartone/" rel="attachment wp-att-11818"><img class="size-full wp-image-11818" title="kernelInitPartOne" src="http://www.lingcc.com/wp-content/uploads/2011/11/kernelInitPartOne.png" alt="" width="676" height="307" /></a><p class="wp-caption-text">Before start_kernel</p></div>
</div>
</div>
<div id="outline-container-2.2" class="outline-3">
<h3 id="sec-2.2"><span class="section-number-3">2.2</span> On MIPS</h3>
<div id="text-2.2" class="outline-text-3">
<ol>
<li>Computer will execute codes in arch/mips/boot/compressed/head.S first</li>
<li>It will jump to decompress_kernel in arch/mips/boot/compressed/decompress.c</li>
<li>Then kernel_entry function is called. It will init the global time variable jiffies, and some other memory segment initialization.</li>
<li>Then the status register, kernel entry point, current_thread_info pointer is init.<br />
The arg list will also put in register or memory</li>
<li>Then start_kernel function is called.</li>
</ol>
</div>
</div>
</div>
<div id="outline-container-3" class="outline-2">
<h2 id="sec-3"><span class="section-number-2">3</span> Reference</h2>
<div id="text-3" class="outline-text-2">
<ul>
<li><a href="http://stackoverflow.com/questions/2589845/what-are-the-first-operations-that-the-linux-kernel-executes-on-boot">http://stackoverflow.com/questions/2589845/what-are-the-first-operations-that-the-linux-kernel-executes-on-boot</a></li>
<li><a href="http://en.wikipedia.org/wiki/Linux_startup_process">http://en.wikipedia.org/wiki/Linux_startup_process</a></li>
<li><a href="http://www.ibm.com/developerworks/library/l-linuxboot/index.html">http://www.ibm.com/developerworks/library/l-linuxboot/index.html</a></li>
<li><a href="http://hi.baidu.com/freedom_asic/blog/item/e3463b399d704df63b87ce68.html">http://hi.baidu.com/freedom_asic/blog/item/e3463b399d704df63b87ce68.html</a></li>
<li><a href="http://duartes.org/gustavo/blog/post/kernel-boot-process">http://duartes.org/gustavo/blog/post/kernel-boot-process</a></li>
<li><a href="http://duartes.org/gustavo/blog/post/how-computers-boot-up">http://duartes.org/gustavo/blog/post/how-computers-boot-up</a></li>
</ul>
</div>
</div>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Intel Sandy Bridge怎么给力" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F01%2F25%2F11531%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/04/29/7109138.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Intel Sandy Bridge怎么给力</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="领带的11种打法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F29%2F9965%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/05/07/7840031.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">领带的11种打法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="令人振奋的第六感技术" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F11%2F10639%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/04/30/7114940.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">令人振奋的第六感技术</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="zz《人物》:计算机世界第一人 – 艾兰・图灵" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9964%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/04/30/7115589.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">zz《人物》:计算机世界第一人 – 艾兰・图灵</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="看图说话" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F01%2F21%2F11515%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F11%2F26%2F11814%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/04/29/7109191.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">看图说话</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2011/12/05/11872/' rel='bookmark' title='Linux 内核中的.S文件'>Linux 内核中的.S文件</a></li>
<li><a href='http://www.lingcc.com/2011/06/01/11600/' rel='bookmark' title='通用微处理中的SIMD指令扩展'>通用微处理中的SIMD指令扩展</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2011/11/28/11851/' rel='bookmark' title='Illegal Instruction 错误初窥'>Illegal Instruction 错误初窥</a></li>
<li><a href='http://www.lingcc.com/2010/10/13/11318/' rel='bookmark' title='Linux内存的属性'>Linux内存的属性</a></li>
<li><a href='http://www.lingcc.com/2010/02/25/10698/' rel='bookmark' title='好大一筐梅普斯(MIPS)'>好大一筐梅普斯(MIPS)</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2011/11/26/11814/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>龙芯中科公司招聘JAVA虚拟机开发工程师</title>
		<link>http://www.lingcc.com/2010/07/09/11055/</link>
		<comments>http://www.lingcc.com/2010/07/09/11055/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 03:34:49 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[IT职业和生活]]></category>
		<category><![CDATA[编译器相关招聘信息]]></category>
		<category><![CDATA[JAVA]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[虚拟机]]></category>
		<category><![CDATA[龙芯]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=11055</guid>
		<description><![CDATA[发信人: css5200 (css), 信区: CSArch 标 题: 北京龙芯中科技术服务有限公司招聘 发信站: 水木社区 (Fri Jul 9 11:14:05 2010), 站内 招聘职位：Java虚拟机开发工程师 工作地点：北京 专业要求：计算机或电子等相关专业 学历：本科 职责范围： Java虚拟机移植、调试与性能优化。 职位要求： 1、计算机或电子等相关专业本科及以上学历 2、英文较好，4 级以上或口语优秀者优先 3、熟悉操作系统、处理器架构基本工作原理，熟悉MIPS架构者优先 4、具有Java应用程序的开发经验 5、熟悉Jdk的工作原理，熟悉OpenJdk的代码结构，有Java虚拟机相关开发移植工作者优先 6、熟悉Linux操作系统，熟悉Linux源代码 7、较强的C/C++/Java 、汇编编程能力，有丰富编程经验 8、具有软件工程基本思想和素质，编程习惯、风格良好 9、有上述技术项目应用经验者优先 10、具有良好的沟通能力和团队合作精神，责任心强，积极主动，学习能力强 有意者发送简历至 caisongsong@loongson.cn &#8211; ※ 来源:·水木社区 http://newsmth.net·[FROM: 159.226.43.*] 相关文章： MNC need compiler expert JAVA虚拟机入门 (转载)我是如何借鉴IEEE写好科技论文的 JIT Compiler and Virtual Machine SW <a href='http://www.lingcc.com/2010/07/09/11055/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯N32系统上的Squirrelfish性能</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F19%2F11208%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC即将支持龙芯3A</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F01%2F23%2F9890%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">zzzz龙芯之火，可以燎原（下）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F02%2F25%2F10698%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">好大一筐梅普斯(MIPS)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F08%2F15%2F11127%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于龙芯公司的小道消息</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/07/20/11108/' rel='bookmark' title='MNC need compiler expert'>MNC need compiler expert</a></li>
<li><a href='http://www.lingcc.com/2011/05/08/11580/' rel='bookmark' title='JAVA虚拟机入门'>JAVA虚拟机入门</a></li>
<li><a href='http://www.lingcc.com/2009/10/13/9994/' rel='bookmark' title='(转载)我是如何借鉴IEEE写好科技论文的'>(转载)我是如何借鉴IEEE写好科技论文的</a></li>
<li><a href='http://www.lingcc.com/2011/10/09/11773/' rel='bookmark' title='JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm'>JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm</a></li>
<li><a href='http://www.lingcc.com/2010/06/28/10983/' rel='bookmark' title='龙芯N32系统上的Squirrelfish性能'>龙芯N32系统上的Squirrelfish性能</a></li>
<li><a href='http://www.lingcc.com/2010/02/26/10701/' rel='bookmark' title='大尾端和小尾端'>大尾端和小尾端</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>发信人: css5200 (css), 信区: CSArch<br />
标  题: 北京龙芯中科技术服务有限公司招聘<br />
发信站: 水木社区 (Fri Jul  9 11:14:05 2010), 站内<br />
招聘职位：Java虚拟机开发工程师<br />
工作地点：北京<br />
专业要求：计算机或电子等相关专业<br />
学历：本科<br />
职责范围：<br />
Java虚拟机移植、调试与性能优化。<br />
职位要求：<br />
1、计算机或电子等相关专业本科及以上学历<br />
2、英文较好，4 级以上或口语优秀者优先<br />
3、熟悉操作系统、处理器架构基本工作原理，熟悉MIPS架构者优先<br />
4、具有Java应用程序的开发经验<br />
5、熟悉Jdk的工作原理，熟悉OpenJdk的代码结构，有Java虚拟机相关开发移植工作者优先<br />
6、熟悉Linux操作系统，熟悉Linux源代码<br />
7、较强的C/C++/Java 、汇编编程能力，有丰富编程经验<br />
8、具有软件工程基本思想和素质，编程习惯、风格良好<br />
9、有上述技术项目应用经验者优先<br />
10、具有良好的沟通能力和团队合作精神，责任心强，积极主动，学习能力强<br />
有意者发送简历至 caisongsong@loongson.cn<br />
&#8211;<br />
※ 来源:·水木社区 http://newsmth.net·[FROM: 159.226.43.*]</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯N32系统上的Squirrelfish性能</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F19%2F11208%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC即将支持龙芯3A</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F01%2F23%2F9890%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">zzzz龙芯之火，可以燎原（下）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F02%2F25%2F10698%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">好大一筐梅普斯(MIPS)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F08%2F15%2F11127%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于龙芯公司的小道消息</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/07/20/11108/' rel='bookmark' title='MNC need compiler expert'>MNC need compiler expert</a></li>
<li><a href='http://www.lingcc.com/2011/05/08/11580/' rel='bookmark' title='JAVA虚拟机入门'>JAVA虚拟机入门</a></li>
<li><a href='http://www.lingcc.com/2009/10/13/9994/' rel='bookmark' title='(转载)我是如何借鉴IEEE写好科技论文的'>(转载)我是如何借鉴IEEE写好科技论文的</a></li>
<li><a href='http://www.lingcc.com/2011/10/09/11773/' rel='bookmark' title='JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm'>JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm</a></li>
<li><a href='http://www.lingcc.com/2010/06/28/10983/' rel='bookmark' title='龙芯N32系统上的Squirrelfish性能'>龙芯N32系统上的Squirrelfish性能</a></li>
<li><a href='http://www.lingcc.com/2010/02/26/10701/' rel='bookmark' title='大尾端和小尾端'>大尾端和小尾端</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/07/09/11055/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>龙芯N32系统上的Squirrelfish性能</title>
		<link>http://www.lingcc.com/2010/06/28/10983/</link>
		<comments>http://www.lingcc.com/2010/06/28/10983/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 08:58:37 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[IT职业和生活]]></category>
		<category><![CDATA[main]]></category>
		<category><![CDATA[chromium]]></category>
		<category><![CDATA[JIT]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[N32]]></category>
		<category><![CDATA[Squirrelfish]]></category>
		<category><![CDATA[sunspider]]></category>
		<category><![CDATA[WebKit]]></category>
		<category><![CDATA[webkit-龙]]></category>
		<category><![CDATA[开源]]></category>
		<category><![CDATA[龙芯]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10983</guid>
		<description><![CDATA[缘起：写这篇文章因为报名参加了龙芯开源软件大赛，项目是《Webkit-龙》,把webkit移植到龙芯N32系统上，起初是想做chromium的移植。但在起步的过程中，发现一是Google的V8引擎，对mips的支持基本处于不可用状态，而且chromium为了追求性能，使用的方式太过灵巧，如Native client(Google的野心–Native Client+LLVM),凭自己的一己之力，靠业余时间，很难完成，只好先做webkit了。 Squirrelfish 是Webkit的Javascript引擎。针对龙芯平台(MIPS)已经有了JIT支持，但仅仅对O32系统才有，本博曾经介绍过相关内容（WebKit和Firefox的JavaScript性能对比）。 切入正题，N32系统下，龙芯平台上，Sunspider性能测试结果如下： ============================================ RESULTS (means and 95% confidence intervals) -------------------------------------------- Total: 9125.6ms +/- 0.1% -------------------------------------------- 3d: 1058.6ms +/- 0.2% cube: 326.9ms +/- 0.1% morph: 380.9ms +/- 0.6% raytrace: 350.8ms +/- 0.1% access: 1441.2ms +/- 0.1% binary-trees: 108.4ms +/- 0.3% fannkuch: 829.2ms +/- 0.2% nbody: 249.0ms +/- 0.0% nsieve: 254.6ms +/- 0.4% <a href='http://www.lingcc.com/2010/06/28/10983/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">webkit-龙小组成立</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯中科公司招聘JAVA虚拟机开发工程师</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F01%2F23%2F9890%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">zzzz龙芯之火，可以燎原（下）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F02%2F25%2F10698%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">好大一筐梅普斯(MIPS)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F19%2F11208%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC即将支持龙芯3A</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/22/10668/' rel='bookmark' title='WebKit和Firefox的JavaScript性能对比'>WebKit和Firefox的JavaScript性能对比</a></li>
<li><a href='http://www.lingcc.com/2010/07/10/11060/' rel='bookmark' title='webkit-龙小组成立'>webkit-龙小组成立</a></li>
<li><a href='http://www.lingcc.com/2011/10/09/11773/' rel='bookmark' title='JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm'>JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2009/12/24/10451/' rel='bookmark' title='拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)'>拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)</a></li>
<li><a href='http://www.lingcc.com/2010/09/03/11176/' rel='bookmark' title='移植软件到64位系统'>移植软件到64位系统</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>缘起：写这篇文章因为报名参加了龙芯开源软件大赛，项目是《Webkit-龙》,把webkit移植到龙芯N32系统上，起初是想做chromium的移植。但在起步的过程中，发现一是Google的V8引擎，对mips的支持基本处于不可用状态，而且chromium为了追求性能，使用的方式太过灵巧，如Native client(<a title="Permalink to  Google的野心–Native Client+LLVM" rel="bookmark" href="http://www.lingcc.com/2010/06/02/10955/">Google的野心–Native  Client+LLVM</a>),凭自己的一己之力，靠业余时间，很难完成，只好先做webkit了。</p>
<p><a href="http://trac.webkit.org/wiki/SquirrelFish" target="_blank">Squirrelfish</a> 是Webkit的Javascript引擎。针对龙芯平台(MIPS)已经有了JIT支持，但仅仅对O32系统才有，本博曾经介绍过相关内容（<a href="http://www.lingcc.com/2010/01/22/10668/" target="_blank">WebKit和Firefox的JavaScript性能对比</a>）。<span id="more-10983"></span></p>
<p>切入正题，N32系统下，龙芯平台上，Sunspider性能测试结果如下：<br />
<code><br />
============================================<br />
RESULTS (means and 95% confidence intervals)<br />
--------------------------------------------<br />
Total:                  9125.6ms +/- 0.1%<br />
--------------------------------------------<br />
3d:                   1058.6ms +/- 0.2%<br />
cube:                326.9ms +/- 0.1%<br />
morph:               380.9ms +/- 0.6%<br />
raytrace:            350.8ms +/- 0.1%<br />
access:               1441.2ms +/- 0.1%<br />
binary-trees:        108.4ms +/- 0.3%<br />
fannkuch:            829.2ms +/- 0.2%<br />
nbody:               249.0ms +/- 0.0%<br />
nsieve:              254.6ms +/- 0.4%<br />
bitops:               1088.6ms +/- 0.2%<br />
3bit-bits-in-byte:   196.2ms +/- 0.3%<br />
bits-in-byte:        250.1ms +/- 0.2%<br />
bitwise-and:         224.9ms +/- 0.3%<br />
nsieve-bits:         417.4ms +/- 0.3%<br />
controlflow:           138.2ms +/- 0.2%<br />
recursive:           138.2ms +/- 0.2%<br />
crypto:                621.5ms +/- 0.1%<br />
aes:                 323.0ms +/- 0.1%<br />
md5:                 145.3ms +/- 0.2%<br />
sha1:                153.2ms +/- 0.3%<br />
date:                  523.6ms +/- 0.6%<br />
format-tofte:        302.4ms +/- 0.6%<br />
format-xparb:        221.2ms +/- 1.3%<br />
math:                  931.3ms +/- 0.1%<br />
cordic:              356.0ms +/- 0.2%<br />
partial-sums:        324.5ms +/- 0.1%<br />
spectral-norm:       250.8ms +/- 0.2%<br />
regexp:               1681.6ms +/- 0.1%<br />
dna:                1681.6ms +/- 0.1%<br />
string:               1641.0ms +/- 0.2%<br />
base64:              232.9ms +/- 0.2%<br />
fasta:               261.9ms +/- 0.2%<br />
tagcloud:            394.9ms +/- 0.2%<br />
unpack-code:         525.2ms +/- 0.2%<br />
validate-input:      226.1ms +/- 0.7%</code></p>
<p>与O32系统的性能相比：9125ms vs 6355ms，慢了一半。一个原因是N32现在没有JIT支持。</p>
<p>正确性方面，使用webkit的 Javascript测试集测试。有7个例子出错：<br />
<code><br />
ecma/Date/15.9.5.14.js<br />
ecma/Date/15.9.5.28-1.js<br />
ecma/Date/15.9.5.29-1.js<br />
ecma/Date/15.9.5.31-1.js<br />
ecma/Date/15.9.5.34-1.js<br />
ecma/Date/15.9.5.35-1.js<br />
ecma/Math/15.8.2.17.js</code></p>
<p>WebKit-龙项目方面：</p>
<ul>
<li>主要优化JavaScript引擎，</li>
<li>现在WebKit虽然能编译，但运行还会报错：</li>
</ul>
<p><code>Can't find built framework at "/root/WebKit/WebKitBuild/Release/lib/libQtWebKit.so".</code></p>
<ul>
<li>这个项目刚刚启动，欢迎加入</li>
</ul>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">webkit-龙小组成立</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯中科公司招聘JAVA虚拟机开发工程师</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F01%2F23%2F9890%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">zzzz龙芯之火，可以燎原（下）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F02%2F25%2F10698%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">好大一筐梅普斯(MIPS)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F19%2F11208%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC即将支持龙芯3A</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/22/10668/' rel='bookmark' title='WebKit和Firefox的JavaScript性能对比'>WebKit和Firefox的JavaScript性能对比</a></li>
<li><a href='http://www.lingcc.com/2010/07/10/11060/' rel='bookmark' title='webkit-龙小组成立'>webkit-龙小组成立</a></li>
<li><a href='http://www.lingcc.com/2011/10/09/11773/' rel='bookmark' title='JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm'>JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2009/12/24/10451/' rel='bookmark' title='拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)'>拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)</a></li>
<li><a href='http://www.lingcc.com/2010/09/03/11176/' rel='bookmark' title='移植软件到64位系统'>移植软件到64位系统</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/06/28/10983/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>前瞻-拿起SIMD的武器II</title>
		<link>http://www.lingcc.com/2010/05/12/10931/</link>
		<comments>http://www.lingcc.com/2010/05/12/10931/#comments</comments>
		<pubDate>Wed, 12 May 2010 14:17:39 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[后端优化与处理器]]></category>
		<category><![CDATA[编译技术]]></category>
		<category><![CDATA[3dnow]]></category>
		<category><![CDATA[avx]]></category>
		<category><![CDATA[Backend 编译器后端]]></category>
		<category><![CDATA[builtin]]></category>
		<category><![CDATA[CPU]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[mmx]]></category>
		<category><![CDATA[MPI]]></category>
		<category><![CDATA[SIMD]]></category>
		<category><![CDATA[sse]]></category>
		<category><![CDATA[sse2]]></category>
		<category><![CDATA[sse3]]></category>
		<category><![CDATA[vectorization]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[多媒体处理]]></category>
		<category><![CDATA[并行]]></category>
		<category><![CDATA[性能]]></category>
		<category><![CDATA[成功]]></category>
		<category><![CDATA[整点]]></category>
		<category><![CDATA[编程技术]]></category>
		<category><![CDATA[编译器]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10931</guid>
		<description><![CDATA[上篇文章《前瞻-主流处理器中的数据并行支持(SIMD)&#62;和《前瞻-拿起SIMD的武器I》分别介绍了当今主流CPU中的SIMD扩展 ，以及前人是如何利用SIMD来做优化的，本文&#60;前瞻-拿起SIMD的武器II&#62;将探讨如何使用CPU的向量指令为程序做优化 如何实现？ 编程环境 在现在CPU设计中都加入SIMD扩展并不是解决应用性能问题的好方法。如果没有很好的利用途径，再强大的SIMD扩展指令集都是徒劳。接下来，我们从编译器技术和编程方法论上探讨如何使用SIMD指令来实现应用加速。 编译器的局限 尽管现在SIMD扩展在大部分处理器中都已具备，但目前编译器仍难生成基于SIMD指令的高效代码序列，因为从以控制流为主体的C语言中自动抽象并行化很难。仅仅有几个商业编译器能自动产生SIMD并行，但往往需要很高的代价，结构也很不令人满意。这一块依然是研究开发的热点。SWAR(SIMD within a register)是曾经比较典型的比那一起。一开始作为一个兼容面向多种处理器，之后又转化为一个能识别简单高层并行语言SWARC(一个为使用SIMD指令而生的数据并行C语言).但是，因为SIMD指令的限制，数据并行语言的成功取决于应用领域中高效的并行方法和能很好描述这种应用的语言。SWARC在语言设计阶段，缺乏对特定并行方法的假设使得它使用范围很有限。 也有人针对图像处理任务，提出了一种对C语言的并行扩展和对应的SIMD编译器，并用它实现SIMD加速。作者使用这种语言实现了图像滤波器，并使用SIMD编译器在奔腾处理器上得到了图像滤波器的高效代码序列。通过与最新C编译器中编译得到的代码对比，SIMD编译器得到的代码有4x的加速.也有人专门就如何降低用户学习新编程语言的复杂性进行研究，并提出了一个编程语言原型和相应的编译器。自动向量化的工作也有人在继续奋斗。有人提供了在编译C代码时自动使用SIMD指令代替的技术，使用它让跨平台的源代码使用SIMD指令。这种技术基于经典的代码树结构，并在其上收集数据流图信息以便生成SIMD指令，对目前的主流处理器，这样实现还行，但是很多新的SIMD结构都在趋于提供较高层的并行了。 在某些应用中，通过使用编译器内部的函数来插入一组SIMD指令实现数据在寄存器中的重排，可以实现更高度的并行。这种编译器内部函数都对应一个或多个特定的SIMD指令，通过插入这些函数，程序员告诉编译器需要选择哪个SIMD指令，编译器则负责寄存器分配和指令调度。最近有人描述了SIMD指令如何从常规代码中产生，如何决定SIMD操作的书讯，并每个SIMD指令组。在该提议中，独立的存储访问都组织称SIMD操作，SIMD数据流图根据访存的数据依赖构建，接着SIMD操作的顺序复制到数据六图中。这种机制并不依赖特定的体系结构，在SSE实现该提议，对于某些应用核心，加速比达到35%。 另外也有人研究了使用SIMD并行操作和使用串行操作的能耗问题。通过比较多个benchmark，作者的结论是：使用SIMD指令能节省72%的能耗，提升76%的性能。 编程方法论 虽然没有编译器令人满意的支持，但SIMD依然是有效的提升性能的方法，接下来介绍三种使用SIMD扩展的途径。 汇编语言：这是最高效的使用方式，因为这种编程方式能直接从硬件平台获得性能。但很容易出错，而且可移植性不强。 共享库：这些库通常处理器生产商提供的，但这些库只能覆盖特等的函数，而且只能用在特定的处理器上。比如，Intel的汇编库就提供了很多常用信号处理，向量计算和图像处理的汇编函数库供C函数调用,但通常，这种方式会造成库中的可用函数和目标应用需要的不匹配。 向量化编译器：最理想的情况下，高级语言编译器能自动识别代码中的并行部分，并生成相应的SIMD指令串。但是虽然现在有很多自动SIMD向量化的提议，但成功的很少。值得一提的是Intel C++ Compiler中的intrinsic支持，把括MMX，SSE，SSE2的SIMD指令支持，C++ SIMD向量类，还有一个自动的向量化工具能自动从循环中得到SIMD并行。它为Microsoft Windows和Linux操作系统环境带来明显性能提升。ICC的二进制文件，在Windows环境下能与Visual C++二进制兼容，在Linux能与GCC相应版本的二进制兼容。现在通过intrinsic库和C++来编程要比汇编语言容易的多，因为不再需要维护寄存器，可以方便的开发较大的软件，但因为编译器要完成寄存器分配和指令调度，所以相对于汇编，性能可能会有下降，但并不绝对。 GNU Gcc 4.2也支持了包括AtliVec,SSE2和3DNow！在内的一些多媒体扩展。 数据对齐 对齐就是把数据和代码放在主存中能让硬件更高效访问的地址的技术，也就是存储地址的一种属性。一个地址是X对齐的，如果它的地址能表示为Xn+0的形式。其中X是2的某次幂，n为任意整数。一个存储向量数据的内存块，若其边界是非对齐的，那访问它的开销将会非常大，因为需要使用数据重排机制。这种机制通常需要产生很多额外的存储访问。为了避免这种过高代价，已经有了一些技术，如循环分割，动态/静态对齐检测。很多CPU，如基于Alpha, IA-64, IA-32,MIPS和SuperH的结构，都禁止访问非对齐数据，如果程序请求访问了非对齐的数据，则抛出异常。 数据对齐是开发自动使用SIMD扩展必须要解决的基础问题之一。掌控对齐会大大增加自动向量化的难度，并限制其应用范围。为了能对向量数据高效存储，存储访问必须正确对齐。 选择合适的SIMD扩展 SIMD扩展在现在的PC中几乎都有，为啥不用呢？但，再者之前，得先回答几个问题： 现在的代码能从MMX，SSE,SSE2或SSE3中获益吗？ 代码是整点运算还是浮点？ 需要什么样的编程技术？ 如何组织数据类型，如何对齐？ 另外，为了能从SIMD扩展中获得最大收益，下面几点一定要好好评估： 计算敏感的程序段 足够给程序性能产生影响的程序段 几乎没有数据依赖控制流图的程序段 需要浮点运算的程序段 使用少量指令就能编写的计算代码段 需要额外调整才能高效利用cache结构的代码段 一款商业软件Intel VTune能较好到检测出可以并行的程序段。协助程序员优化性能。 总的来说，一个能做SIMD优化的程序段，应该是循环体较小，循环操作一个数组，该数组由8、16或者32位对齐整数，单精度32位浮点，或双精度64位浮点组成。再加上使用尽可能少的数据类型，更长的向量数据，并且小心的控制内存访问。能做到这些，SIMD扩展就能为你的程序带来不小的性能提升了：） 个人总计： 至此，对目前最低级的并行&#8211;单指令多数据并行。算是有了点认识。SIMD几乎所有的主流CPU上都有，从Alpha的MVI，IBM PowerPC上的AltiVec和SPE，HP PA-RISC 多媒体加速扩展(MAX), Intel的MMX，iwMMX，SSE，SSE2，SSE3，SSSE3；AMD的3DNow!, ARC的ARC视频处理子系统，SPARC的VIS， Sun的MAJC， <a href='http://www.lingcc.com/2010/05/12/10931/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F02%2F11605%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F12%2F10931%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">SIMD硬件的发展</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F01%2F11600%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F12%2F10931%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">通用微处理中的SIMD指令扩展</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F09%2F14%2F11718%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F12%2F10931%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Some notes about IBM  XL C Compiler</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F10%2F10928%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F12%2F10931%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">前瞻-拿起SIMD的武器I</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F20%2F10372%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F12%2F10931%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Expected unqualified-id before﻿ 查错</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/05/04/10878/' rel='bookmark' title='前瞻-主流处理器中的数据并行支持(SIMD)'>前瞻-主流处理器中的数据并行支持(SIMD)</a></li>
<li><a href='http://www.lingcc.com/2010/01/21/10663/' rel='bookmark' title='小例子&#8211;回眸一笑百媚生'>小例子&#8211;回眸一笑百媚生</a></li>
<li><a href='http://www.lingcc.com/2010/05/10/10928/' rel='bookmark' title='前瞻-拿起SIMD的武器I'>前瞻-拿起SIMD的武器I</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2010/04/14/10736/' rel='bookmark' title='探秘CPU性能测试：Spec CPU2000之整点篇'>探秘CPU性能测试：Spec CPU2000之整点篇</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<h4><span style="font-weight: normal;">上篇文章</span><a href="http://www.lingcc.com/2010/05/04/10878/" target="_blank"><span style="font-weight: normal;">《</span></a><a href="http://www.lingcc.com/2010/05/04/10878/" target="_blank"><span style="font-weight: normal;">前瞻-主流处理器中的数据并行支持(SIMD)</span></a><span style="font-weight: normal;">&gt;和《</span><a href="http://www.lingcc.com/2010/05/10/10928/" target="_blank"><span style="font-weight: normal;">前瞻-拿起SIMD的武器I</span></a><span style="font-weight: normal;">》分别介绍了当今主流CPU中的SIMD扩展 ，以及前人是如何利用SIMD来做优化的，本文&lt;前</span><span style="font-weight: normal;">瞻-拿起SIMD的武器II</span><span style="font-weight: normal;">&gt;将探讨如何使用CPU的向量指令为程序做优化</span></h4>
<h3>如何实现？</h3>
<h4><a name="_3698829783465135"></a>编程环境</h4>
<p>在现在CPU设计中都加入SIMD扩展并不是解决应用性能问题的好方法。如果没有很好的利用途径，再强大的SIMD扩展指令集都是徒劳。接下来，我们从编译器技术和编程方法论上探讨如何使用SIMD指令来实现应用加速。<span id="more-10931"></span></p>
<h4><a name="_42636573218531726"></a>编译器的局限</h4>
<p>尽管现在SIMD扩展在大部分处理器中都已具备，但目前编译器仍难生成基于SIMD指令的高效代码序列，因为从以控制流为主体的C语言中自动抽象并行化很难。仅仅有几个商业编译器能自动产生SIMD并行，但往往需要很高的代价，结构也很不令人满意。这一块依然是研究开发的热点。SWAR(SIMD within a register)是曾经比较典型的比那一起。一开始作为一个兼容面向多种处理器，之后又转化为一个能识别简单高层并行语言SWARC(一个为使用SIMD指令而生的数据并行C语言).但是，因为SIMD指令的限制，数据并行语言的成功取决于应用领域中高效的并行方法和能很好描述这种应用的语言。SWARC在语言设计阶段，缺乏对特定并行方法的假设使得它使用范围很有限。<br />
也有人针对图像处理任务，提出了一种对C语言的并行扩展和对应的SIMD编译器，并用它实现SIMD加速。作者使用这种语言实现了图像滤波器，并使用SIMD编译器在奔腾处理器上得到了图像滤波器的高效代码序列。通过与最新C编译器中编译得到的代码对比，SIMD编译器得到的代码有4x的加速.也有人专门就如何降低用户学习新编程语言的复杂性进行研究，并提出了一个编程语言原型和相应的编译器。自动向量化的工作也有人在继续奋斗。有人提供了在编译C代码时自动使用SIMD指令代替的技术，使用它让跨平台的源代码使用SIMD指令。这种技术基于经典的代码树结构，并在其上收集数据流图信息以便生成SIMD指令，对目前的主流处理器，这样实现还行，但是很多新的SIMD结构都在趋于提供较高层的并行了。<br />
在某些应用中，通过使用编译器内部的函数来插入一组SIMD指令实现数据在寄存器中的重排，可以实现更高度的并行。这种编译器内部函数都对应一个或多个特定的SIMD指令，通过插入这些函数，程序员告诉编译器需要选择哪个SIMD指令，编译器则负责寄存器分配和指令调度。最近有人描述了SIMD指令如何从常规代码中产生，如何决定SIMD操作的书讯，并每个SIMD指令组。在该提议中，独立的存储访问都组织称SIMD操作，SIMD数据流图根据访存的数据依赖构建，接着SIMD操作的顺序复制到数据六图中。这种机制并不依赖特定的体系结构，在SSE实现该提议，对于某些应用核心，加速比达到35%。<br />
另外也有人研究了使用SIMD并行操作和使用串行操作的能耗问题。通过比较多个benchmark，作者的结论是：使用SIMD指令能节省72%的能耗，提升76%的性能。</p>
<h4>编程方法论</h4>
<p>虽然没有编译器令人满意的支持，但SIMD依然是有效的提升性能的方法，接下来介绍三种使用SIMD扩展的途径。</p>
<ol>
<li><a name="__7473931998985098"></a>汇编语言：这是最高效的使用方式，因为这种编程方式能直接从硬件平台获得性能。但很容易出错，而且可移植性不强。</li>
<li>共享库：这些库通常处理器生产商提供的，但这些库只能覆盖特等的函数，而且只能用在特定的处理器上。比如，Intel的汇编库就提供了很多常用信号处理，向量计算和图像处理的汇编函数库供C函数调用,但通常，这种方式会造成库中的可用函数和目标应用需要的不匹配。</li>
<li>向量化编译器：最理想的情况下，高级语言编译器能自动识别代码中的并行部分，并生成相应的SIMD指令串。但是虽然现在有很多自动SIMD向量化的提议，但成功的很少。值得一提的是Intel C++ Compiler中的intrinsic支持，把括MMX，SSE，SSE2的SIMD指令支持，C++ SIMD向量类，还有一个自动的向量化工具能自动从循环中得到SIMD并行。它为Microsoft Windows和Linux操作系统环境带来明显性能提升。ICC的二进制文件，在Windows环境下能与Visual C++二进制兼容，在Linux能与GCC相应版本的二进制兼容。现在通过intrinsic库和C++来编程要比汇编语言容易的多，因为不再需要维护寄存器，可以方便的开发较大的软件，但因为编译器要完成寄存器分配和指令调度，所以相对于汇编，性能可能会有下降，但并不绝对。 GNU Gcc 4.2也支持了包括AtliVec,SSE2和3DNow！在内的一些多媒体扩展。</li>
</ol>
<h4><a name="_8764728304827076"></a>数据对齐</h4>
<p>对齐就是把数据和代码放在主存中能让硬件更高效访问的地址的技术，也就是存储地址的一种属性。一个地址是X对齐的，如果它的地址能表示为Xn+0的形式。其中X是2的某次幂，n为任意整数。一个存储向量数据的内存块，若其边界是非对齐的，那访问它的开销将会非常大，因为需要使用数据重排机制。这种机制通常需要产生很多额外的存储访问。为了避免这种过高代价，已经有了一些技术，如循环分割，动态/静态对齐检测。很多CPU，如基于Alpha, IA-64, IA-32,MIPS和SuperH的结构，都禁止访问非对齐数据，如果程序请求访问了非对齐的数据，则抛出异常。</p>
<p>数据对齐是开发自动使用SIMD扩展必须要解决的基础问题之一。掌控对齐会大大增加自动向量化的难度，并限制其应用范围。为了能对向量数据高效存储，存储访问必须正确对齐。</p>
<h4>选择合适的SIMD扩展</h4>
<p>SIMD扩展在现在的PC中几乎都有，为啥不用呢？但，再者之前，得先回答几个问题：</p>
<ol>
<li>现在的代码能从MMX，SSE,SSE2或SSE3中获益吗？</li>
<li>代码是整点运算还是浮点？</li>
<li>需要什么样的编程技术？</li>
<li>如何组织数据类型，如何对齐？</li>
</ol>
<p>另外，为了能从SIMD扩展中获得最大收益，下面几点一定要好好评估：</p>
<ol>
<li>计算敏感的程序段</li>
<li>足够给程序性能产生影响的程序段</li>
<li>几乎没有数据依赖控制流图的程序段</li>
<li>需要浮点运算的程序段</li>
<li>使用少量指令就能编写的计算代码段</li>
<li>需要额外调整才能高效利用cache结构的代码段</li>
</ol>
<p>一款商业软件Intel VTune能较好到检测出可以并行的程序段。协助程序员优化性能。</p>
<p>总的来说，一个能做SIMD优化的程序段，应该是循环体较小，循环操作一个数组，该数组由8、16或者32位对齐整数，单精度32位浮点，或双精度64位浮点组成。再加上使用尽可能少的数据类型，更长的向量数据，并且小心的控制内存访问。能做到这些，SIMD扩展就能为你的程序带来不小的性能提升了：）</p>
<p>个人总计：</p>
<p>至此，对目前最低级的并行&#8211;单指令多数据并行。算是有了点认识。SIMD几乎所有的主流CPU上都有，从Alpha的MVI，IBM PowerPC上的AltiVec和SPE，HP PA-RISC 多媒体加速扩展(MAX), Intel的MMX，iwMMX，SSE，SSE2，SSE3，SSSE3；AMD的3DNow!, ARC的ARC视频处理子系统，SPARC的VIS， Sun的MAJC， ARM的NEON， MIPS的MDMX和MIPS-3D， Cell的SPU， Philips的Xetal 到GPU上SIMD的普遍使用，从64位到128位，256位的数据并行。SIMD的硬件支持越来约强大。</p>
<p>另一方面，高品质的多媒体处理需求，也使得我们的计算机应用中数据处理越来越庞大。但唯独编译器很难为SIMD加速做贡献。SIMD的并行需要很弱的数据依赖，数据流的统一。而这种统一很难靠编译器来提取。高效的方式还得靠人工来做。人工来做，就意味着人要了解他要优化的这个算法，哪里数据计算比较多，哪里跳转，控制语句比较多。能不能使用SIMD优化，如何使用SIMD优化。</p>
<p>SIMD的硬件支持因为各个CPU厂商的设计目标不同，而且还有知识产权的问题。这样SIMD标准很难统一起来。针对每一个特定的CPU型号，都要做特定的SIMD优化，这也给软件的可移植性带来了挑战。</p>
<p>编译器能提取数据依赖吗？编译器能为程序员做点什么？编译器能在多大程度上协助程序员的工作？主流编译器已经有了对MMX，SSE，SSE2的intrinsic支持，编程在稍微损失性能的条件下编程更加容易了。Intel的VTune能帮助我们更好的发现并行机会。但很明显，这些还不够。幸好，GCC也引入了<a href="http://gcc.gnu.org/wiki/Graphite" target="_blank">Graphite</a>，或许在不久的将来，会有一些机会吧。现在影响SIMD，最多的不是找到一系列指令串来操作数据，而是如何高效的把数据组织成一个向量数据，在计算完成以后，高效的把这些数据都拿出来。</p>
<p>未来，我们还有很多值得期待，还有许多可以努力！</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F02%2F11605%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F12%2F10931%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">SIMD硬件的发展</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F06%2F01%2F11600%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F12%2F10931%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">通用微处理中的SIMD指令扩展</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F09%2F14%2F11718%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F12%2F10931%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Some notes about IBM  XL C Compiler</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F10%2F10928%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F12%2F10931%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">前瞻-拿起SIMD的武器I</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F20%2F10372%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F12%2F10931%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Expected unqualified-id before﻿ 查错</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/05/04/10878/' rel='bookmark' title='前瞻-主流处理器中的数据并行支持(SIMD)'>前瞻-主流处理器中的数据并行支持(SIMD)</a></li>
<li><a href='http://www.lingcc.com/2010/01/21/10663/' rel='bookmark' title='小例子&#8211;回眸一笑百媚生'>小例子&#8211;回眸一笑百媚生</a></li>
<li><a href='http://www.lingcc.com/2010/05/10/10928/' rel='bookmark' title='前瞻-拿起SIMD的武器I'>前瞻-拿起SIMD的武器I</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2010/04/14/10736/' rel='bookmark' title='探秘CPU性能测试：Spec CPU2000之整点篇'>探秘CPU性能测试：Spec CPU2000之整点篇</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/05/12/10931/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>前瞻-LLVM大事记(2004-2010)</title>
		<link>http://www.lingcc.com/2010/04/30/10822/</link>
		<comments>http://www.lingcc.com/2010/04/30/10822/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 12:04:03 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[LLVM]]></category>
		<category><![CDATA[编译前沿]]></category>
		<category><![CDATA[编译技术]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Chris Lattener]]></category>
		<category><![CDATA[clang]]></category>
		<category><![CDATA[compiler infrastructure]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[JIT]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[ld]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[MPI]]></category>
		<category><![CDATA[N64]]></category>
		<category><![CDATA[Open64]]></category>
		<category><![CDATA[openmp]]></category>
		<category><![CDATA[spec]]></category>
		<category><![CDATA[SPEC2000]]></category>
		<category><![CDATA[SSA]]></category>
		<category><![CDATA[x86]]></category>
		<category><![CDATA[中间表示]]></category>
		<category><![CDATA[全时优化]]></category>
		<category><![CDATA[后端]]></category>
		<category><![CDATA[性能]]></category>
		<category><![CDATA[整点]]></category>
		<category><![CDATA[编译器]]></category>
		<category><![CDATA[编译器开发]]></category>
		<category><![CDATA[编译器性能]]></category>
		<category><![CDATA[编译器架构]]></category>
		<category><![CDATA[过程间优化]]></category>
		<category><![CDATA[过程间分析和优化 Inter procedural Analysis]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10822</guid>
		<description><![CDATA[因为之前的两篇博文前瞻-全时优化和LLVM-1和前瞻-全时优化和LLVM-2都是基于Chris Lattner 2004年发表在CGO的文章写的。所以需要介绍一下LLVM从2004到2010这六年的变化，LLVM的开发社区很活跃。 从2004年三月到2010年4月，LLVM共发布了1.2-1.9，2.0-2.7，16个版本，至少每年发布两个版本。详细的历史发布版本和release都能从这里找到。 1.2增加了调试信息支持， 1.3增加精确垃圾收集功能， 1.4增加PowerPC JIT支持，增加通用的编译驱动器和连接器； 1.5增加针对Alpha,IA-64和SPARC-V8的代码生成器，新的指令选择机制； 1.6指令选择能从机器模型中生成，指令调度支持，支持子目标机代码生成器； 1.7向量支持，新的GCC4.0 C/C++前端，Objective C/C++支持，汇编内联支持； 1.8DWARF调试支持,循环优化改进； 1.9新的X86-64后端，连接时优化能和本机连接器交互； 2.0中间表示更新(整型完全无符号化，任意长度位的整型支持),代码生成器更新(软浮点支持),X86,ARM,PowerPC代码生成改进； 2.1.gcc-4.2前端，Fortran，Ada和OpenMP支持，MIPS后端支持； 2.2 Clang启动，CellSPU后端支持，精确垃圾收集代码重构； 2.3, 不再支持gcc4.0前端，vmkit启动(用LLVM实现JVM和CLI)，多返回值支持，llvmc重构，连接时优化起结构重写 2.4，增加优化，并缩短O0编译时间，PIC16微处理器支持 2.5，启动Pure,LLVM D Compiler,Roadsend PHP;XCore后端支持 2.6，启动compiler-rt,KLEE,machine code toolkit,开优化时调试信息行号支持，新MSP430，SystemZ和Blackin后端支持，Gold连接器插件支持 2.7，启动LLVM新logo，MicroBlaze后端支持。 以上就是从04年到10年LLVM每次发行新版本中给出的最要新特性.可以看出，几乎和普通的编译器没有什么两样。所做的无非在增加新前端，编译更多的语言，支持新后端，可以在更多的处理器上运行。增加中间优化，调bug。 LLVM近几年的发展路线已经越来越像一个标准的，前端+后端+优化的编译器。运行时的优化也大部分集中在JIT上，反馈制导优化也没有涉及。 Chris Lattener最近几年发表的文章： “Making Context-sensitive Points-to Analysis with Heap Cloning Practical For The Real World” PLDI 2007, San Diego, CA, June 2007。 “Macroscopic Data <a href='http://www.lingcc.com/2010/04/30/10822/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F20%2F11361%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM居然开始做广告了！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F03%2F10884%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">安装LLVM2.7 step by step</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F28%2F10807%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM 2.7 发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F15%2F10978%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64业内外人士对LLVM和Open64的观点</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/04/29/10728/' rel='bookmark' title='前瞻-全时优化和LLVM-2'>前瞻-全时优化和LLVM-2</a></li>
<li><a href='http://www.lingcc.com/2010/04/14/10736/' rel='bookmark' title='探秘CPU性能测试：Spec CPU2000之整点篇'>探秘CPU性能测试：Spec CPU2000之整点篇</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2010/04/07/10721/' rel='bookmark' title='前瞻-全时优化和LLVM-1'>前瞻-全时优化和LLVM-1</a></li>
<li><a href='http://www.lingcc.com/2009/12/28/10469/' rel='bookmark' title='Open64课程-结语'>Open64课程-结语</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>因为之前的两篇博文<a title="Permanent Link: 前瞻-全时优化和LLVM-1" rel="bookmark" href="http://www.lingcc.com/2010/04/07/10721/">前瞻-全时优化和LLVM-1<abbr title="YARPP  中的 5.867000 是指当前文章和关联文章之间的匹配程度。当您以管理员的身份登录时才能查阅，游客等其他权限是不能查阅的。"></abbr></a>和<a href="http://www.lingcc.com/2010/04/29/10728/" target="_blank">前瞻-全时优化和LLVM-2</a>都是基于Chris Lattner 2004年发表在CGO的文章写的。所以需要介绍一下LLVM从2004到2010这六年的变化，LLVM的开发社区很活跃。</p>
<p>从2004年三月到2010年4月，LLVM共发布了1.2-1.9，2.0-2.7，16个版本，至少每年发布两个版本。详细的历史发布版本和release都能从<a href="http://llvm.org/releases/" target="_blank">这里</a>找到。</p>
<p><span id="more-10822"></span></p>
<ul>
<li>1.2增加了调试信息支持，</li>
<li>1.3增加精确垃圾收集功能，</li>
<li>1.4增加PowerPC JIT支持，增加通用的编译驱动器和连接器；</li>
<li>1.5增加针对Alpha,IA-64和SPARC-V8的代码生成器，新的指令选择机制；</li>
<li>1.6指令选择能从机器模型中生成，指令调度支持，支持子目标机代码生成器；</li>
<li>1.7向量支持，新的GCC4.0 C/C++前端，Objective C/C++支持，汇编内联支持；</li>
<li>1.8DWARF调试支持,循环优化改进；</li>
<li>1.9新的X86-64后端，连接时优化能和本机连接器交互；</li>
<li>2.0中间表示更新(整型完全无符号化，任意长度位的整型支持),代码生成器更新(软浮点支持),X86,ARM,PowerPC代码生成改进；</li>
<li>2.1.gcc-4.2前端，Fortran，Ada和OpenMP支持，MIPS后端支持；</li>
<li>2.2 Clang启动，CellSPU后端支持，精确垃圾收集代码重构；</li>
<li>2.3, 不再支持gcc4.0前端，vmkit启动(用LLVM实现JVM和CLI)，多返回值支持，llvmc重构，连接时优化起结构重写</li>
<li>2.4，增加优化，并缩短O0编译时间，PIC16微处理器支持</li>
<li>2.5，启动Pure,LLVM D Compiler,Roadsend PHP;XCore后端支持</li>
<li>2.6，启动compiler-rt,KLEE,machine code toolkit,开优化时调试信息行号支持，新MSP430，SystemZ和Blackin后端支持，Gold连接器插件支持</li>
<li>2.7，启动LLVM新logo，MicroBlaze后端支持。</li>
</ul>
<p>以上就是从04年到10年LLVM每次发行新版本中给出的最要新特性.可以看出，几乎和普通的编译器没有什么两样。所做的无非在增加新前端，编译更多的语言，支持新后端，可以在更多的处理器上运行。增加中间优化，调bug。</p>
<p>LLVM近几年的发展路线已经越来越像一个标准的，前端+后端+优化的编译器。运行时的优化也大部分集中在JIT上，反馈制导优化也没有涉及。</p>
<p>Chris Lattener最近几年发表的文章：</p>
<ol>
<li>“<strong><a href="http://llvm.org/pubs/2007-06-10-PLDI-DSA.html">Making  Context-sensitive  Points-to Analysis with Heap Cloning Practical For The Real World</a></strong>”<br />
<a href="http://ties.ucsd.edu/PLDI/">PLDI 2007</a>, San Diego, CA, June  2007。</li>
<li>“<a href="http://llvm.org/pubs/2005-05-04-LattnerPHDThesis.html"><strong>Macroscopic  Data Structure Analysis and Optimization</strong></a>”<br />
<em>Ph.D. Thesis</em>, <a href="http://www.cs.uiuc.edu/">Computer Science  Dept.</a>, University of Illinois at Urbana-Champaign, May 2005.</li>
<li>“<a href="http://llvm.org/pubs/2005-05-21-PLDI-PoolAlloc.html"><strong>Automatic  Pool  Allocation: Improving Performance by Controlling Data  Structure Layout in the Heap</strong></a>”<br />
<a href="http://research.ihost.com/pldi2005/">PLDI 2005</a>, Chicago, IL, June 2005.<br />
<strong>PLDI&#8217;05 Best paper award.</strong></li>
<li>“<a href="http://llvm.org/pubs/2005-06-12-MSP-PointerComp.html"><strong>Transparent   Pointer Compression for Linked Data Structures</strong></a>”<br />
MSP  2005,  Chicago, IL, June 2005.</li>
</ol>
<p>基本也没有太多触及LLVM整体架构的。</p>
<p>另外，Chris Lattener在近几年的几个邀请报告上也简明扼要的讲解了LLVM的架构。</p>
<ol>
<li>“<a href="http://llvm.org/devmtg/2009-10/">State of Clang</a>”  (shared     talk) and several other pieces of the meeting, such as the  introduction,      open discussion forum, etc.<br />
<em>LLVM Developer Meeting</em>, Cupertino, CA, Oct 2009.</li>
<li>“<a href="http://llvm.org/pubs/2008-10-04-ACAT-LLVM-Intro.html">Introduction  	to the LLVM Compiler System</a>”<br />
Plenary Talk, <em><a href="http://acat2008.cern.ch/">ACAT 2008</a>:  Advanced 	Computing and Analysis Techniques in Physics Research</em>, Erice, Sicily, Italy, November 2008.</li>
<li>“<a href="http://llvm.org/pubs/2008-05-17-BSDCan-LLVMIntro.html">LLVM  and 	Clang: Next Generation Compiler Technology</a>”<br />
<em><a href="http://www.bsdcan.org/2008/">BSDCan 2008</a></em>, Ottawa,  Canada, May 16-17, 2008.</li>
<li>“<a href="http://conferences.oreillynet.com/cs/os2007/view/e_sess/12824">The 		LLVM Compiler System</a>”<br />
<em>2007 O&#8217;Reilly Open Source Convention</em>, Portland, OR, July 2007.</li>
<li>“<a href="http://llvm.org/pubs/2007-07-25-LLVM-2.0-and-Beyond.html">LLVM  	2.0 and Beyond!</a>”<br />
<em>Google Tech Talk</em>, Mountain View, CA, July 25, 2007.</li>
<li>“<a href="http://llvm.org/devmtg/2007-05/">LLVM in OpenGL and for  Dynamic  	Languages</a>” (and several others)<br />
<em>LLVM Developer Meeting</em>, Cupertino, CA, May 2007.</li>
<li>“<a href="http://llvm.org/pubs/2007-03-12-BossaLLVMIntro.html">The  LLVM 	Compiler System</a>”<br />
<em>2007 Bossa Conference on Open Source, Mobile Internet and Multimedia</em>, 	Recife, Brazil, March 2007.</li>
<li>“<a href="http://llvm.org/pubs/2006-04-25-GelatoLLVMIntro.html">Introduction  	to the LLVM Compiler Infrastructure</a>”<br />
<em>2006 Itanium Conference and Expo</em>, San Jose, California, April  2006.</li>
</ol>
<p>对比一下Chris最近几年在不同的文献中，对LLVM的架构描述也是很有意思的。</p>
<div id="attachment_10826" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-02.jpg"><img class="size-medium wp-image-10826" title="LLVM from Chris M.S. Thesis  2002" src="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-02-300x66.jpg" alt="" width="300" height="66" /></a><p class="wp-caption-text">llvm-02 from Chris M.S. Thesis  2002</p></div>
<div id="attachment_10731" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-arch1.jpg"><img class="size-medium wp-image-10731" title="llvm-arch" src="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-arch1-300x65.jpg" alt="" width="300" height="65" /></a><p class="wp-caption-text">LLVM CGO2004</p></div>
<div id="attachment_10828" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-06-1.jpg"><img class="size-medium wp-image-10828" title="llvm-06-1" src="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-06-1-300x118.jpg" alt="" width="300" height="118" /></a><p class="wp-caption-text">LLVM 06 Link-Time Optimization</p></div>
<div id="attachment_10829" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-06-2.jpg"><img class="size-medium wp-image-10829" title="llvm-06-2" src="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-06-2-300x123.jpg" alt="" width="300" height="123" /></a><p class="wp-caption-text">LLVM 06 Code Generator</p></div>
<div id="attachment_10830" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-08.jpg"><img class="size-medium wp-image-10830" title="llvm-08" src="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-08-300x118.jpg" alt="" width="300" height="118" /></a><p class="wp-caption-text">LLVM 08</p></div>
<p>LLVM始终坚持的是LLVM代码在代码生成器，解释执行之间的透明性。重点突破的一直是过程间优化。但架构却基本上摒弃了全时优化，开始走经典的静态分析路线。和GCC、Open64相比，在目的上也没有差别了。<br />
LLVM的性能方面，相比于GCC还逊色不少，和Open64就更没法比了.很遗憾，我没有找到将这三个编译器作性能对比的文章.已有的Open64的数据都是非常老的，没什么可比性。而且编译优化这个东西，差距很大。关键是看有没有人做，投入多大经历做，太老的数据没有什么对比意义。</p>
<p>但LLVM和GCC最新版的对比有， LLVM2.7和GCC 4.5的性能对比(图来自<a href="http://vmakarov.fedorapeople.org/spec/" target="_blank">http://vmakarov.fedorapeople.org/spec/</a>）：</p>
<ul>
<li>SPEC 2000 整点(-O2)</li>
</ul>
<p><a href="http://www.lingcc.com/wp-content/uploads/2010/04/GLI2Score32.png"><img class="alignnone size-medium wp-image-10859" title="GLI2Score32" src="http://www.lingcc.com/wp-content/uploads/2010/04/GLI2Score32-300x154.png" alt="" width="300" height="154" /></a></p>
<ul>
<li>SPEC2000浮点(-O2）</li>
</ul>
<p><a href="http://www.lingcc.com/wp-content/uploads/2010/04/GLF2Score32.png"><img class="alignnone size-medium wp-image-10861" title="GLF2Score32" src="http://www.lingcc.com/wp-content/uploads/2010/04/GLF2Score32-300x154.png" alt="" width="300" height="154" /></a></p>
<ul>
<li>SPEC 2000 整点（-O3）</li>
</ul>
<p><a href="http://www.lingcc.com/wp-content/uploads/2010/04/GLI3Score32.png"><img class="alignnone size-medium wp-image-10860" title="GLI3Score32" src="http://www.lingcc.com/wp-content/uploads/2010/04/GLI3Score32-300x154.png" alt="" width="300" height="154" /></a></p>
<ul>
<li>SPEC 2000 浮点(-O3)</li>
</ul>
<p><a href="http://www.lingcc.com/wp-content/uploads/2010/04/GLF3Score32.png"><img class="alignnone size-medium wp-image-10862" title="GLF3Score32" src="http://www.lingcc.com/wp-content/uploads/2010/04/GLF3Score32-300x154.png" alt="" width="300" height="154" /></a></p>
<p>O2和O3优化下，GCC的性能平均都比LLVM 2.7要好大概2%-3%左右。浮点GCC的优势比整点要大.上面数据仅供参考：）</p>
<p>此外上面的网页中也对编译时间做了对比。LLVM比GCC要快30%左右。</p>
<p>以上数据测试平台：2.93Ghz Intel Core I7 with 8GB memory under Fedora Core10. X86 32位系统.</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F20%2F11361%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM居然开始做广告了！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F03%2F10884%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">安装LLVM2.7 step by step</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F28%2F10807%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM 2.7 发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F15%2F10978%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64业内外人士对LLVM和Open64的观点</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/04/29/10728/' rel='bookmark' title='前瞻-全时优化和LLVM-2'>前瞻-全时优化和LLVM-2</a></li>
<li><a href='http://www.lingcc.com/2010/04/14/10736/' rel='bookmark' title='探秘CPU性能测试：Spec CPU2000之整点篇'>探秘CPU性能测试：Spec CPU2000之整点篇</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2010/04/07/10721/' rel='bookmark' title='前瞻-全时优化和LLVM-1'>前瞻-全时优化和LLVM-1</a></li>
<li><a href='http://www.lingcc.com/2009/12/28/10469/' rel='bookmark' title='Open64课程-结语'>Open64课程-结语</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/04/30/10822/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>走进顶尖大学的计算机科学</title>
		<link>http://www.lingcc.com/2010/04/23/10772/</link>
		<comments>http://www.lingcc.com/2010/04/23/10772/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 02:55:07 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[编译技术]]></category>
		<category><![CDATA[american university]]></category>
		<category><![CDATA[berkely]]></category>
		<category><![CDATA[cmu]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[ld]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[mit]]></category>
		<category><![CDATA[SSA]]></category>
		<category><![CDATA[stanford]]></category>
		<category><![CDATA[top university]]></category>
		<category><![CDATA[USE]]></category>
		<category><![CDATA[并行]]></category>
		<category><![CDATA[并行计算]]></category>
		<category><![CDATA[数据库]]></category>
		<category><![CDATA[科学计算]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10772</guid>
		<description><![CDATA[2010年美国高校计算机系排行榜出炉&#8211;《U.S. News》公布了新一期美国大学计算机系实力排名。前四：卡内基-梅隆大学(CMU)、麻省理工学院(MIT)、斯坦福大学(Stanford U)和加州大学伯克利分校(UC Berkely). 卡内基-梅隆大学(CMU) CMU的实力排序：编程语言、人工智能、计算机系统、计算理论。李开复、沈向洋、洪小文、黄学东、徐峰雄这些微软牛人清一色来自CMU。CMU的CS在算法、计算机网络、分布式系统、并行处理、程序语言、机器人、自然语言处理和软件工程等领域都有不俗的表现。包括Computer Science Department、Human-Computer Interaction Inst(人机交互相关)、Institute for Software Research(软件工程相关研究)、Lane Ctr for Computational Biology(生物计算相关研究)、Language Technologies Institute(自然语言处理)、Machine Learning Department(统计机器学习)、Robotics Institute、Entertainment Technology Cente(计算机娱乐相关技术，貌似很有意思哈)。CMU的编译研究：Programming Language Research(貌似比较老的网页) 麻省理工学院(MIT) MIT的实力排序：人工智能、计算理论、计算机系统、编程语言。GNU，WWW标准组织，One laptop per Child就最早发源自MIT。MIT的牛人们为计算机科学方面的控制论、人工智能、计算机语言、机器学习、机器人、公钥加密上都起到了奠基作用。别忘了《算法导论》就来自MIT。MIT在CS方向的实验室最大的就是CSAIL了：Computer Science and Artificial Intelligence Laboratory (CSAIL，有50多个组，研究方向有三，人工智能，系统结构和计算机理论)。其中系统结构方面包括：计算机结构、安全、数据库、网络、并行、程序分析、编译等等方向。 斯坦福大学(Stanford U) 斯坦福的实力排序：编程语言，人工智能，计算机系统，计算理论。相对于前四名的其他大学，斯坦福的这几个方面排名相对靠后，可谁让人家身在硅谷，又出了很多大公司呢。斯坦福的CS研究方向:人工只能，机器人，计算理论，科学计算，计算机系统等。(抱歉搜到的资料太少).不过大名鼎鼎的《计算机系统结构&#8211;量化研究方法》的第一作者就是斯坦福大学的校长。MIPS也最早起源于斯坦福，还有曾经的Sun。 加州大学伯克利分校(UC Berkely) UC Berkely的实力排序：计算机系统、编程语言、计算理论、人工智能。研究方向都差不多，包括人工智能，计算机体系结构与工程，图形学，人机交互，计算机操作系统和网络，编程系统，科学计算，计算机安全和计算理论。UC Berkely在CS上的实验室有：Center for Hybrid and Embedded Software Systems (CHESS，异构平台上的实时软件技术研究) 、Center for Intelligent <a href='http://www.lingcc.com/2010/04/23/10772/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="YY一下量子计算机的编译器" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F12%2F23%2F11431%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F23%2F10772%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/04/29/7110270.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">YY一下量子计算机的编译器</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="zz《人物》:计算机世界第一人 – 艾兰・图灵" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9964%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F23%2F10772%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/04/30/7115589.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">zz《人物》:计算机世界第一人 – 艾兰・图灵</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="说说高通量计算机" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F21%2F11375%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F23%2F10772%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">说说高通量计算机</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="走进Debian和Gentoo中的系统初始化过程" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F19%2F10892%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F23%2F10772%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">走进Debian和Gentoo中的系统初始化过程</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="体系结构这五年--《计算机体系结构-量化研究方法》第5版的新变化" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F01%2F11927%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F23%2F10772%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">体系结构这五年--《计算机体系结构-量化研究方法》第5版的新变化</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/05/04/10878/' rel='bookmark' title='前瞻-主流处理器中的数据并行支持(SIMD)'>前瞻-主流处理器中的数据并行支持(SIMD)</a></li>
<li><a href='http://www.lingcc.com/2010/01/09/10623/' rel='bookmark' title='反汇编器和汇编器'>反汇编器和汇编器</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2010/02/03/10675/' rel='bookmark' title='计算机系统结构方向的顶尖会议'>计算机系统结构方向的顶尖会议</a></li>
<li><a href='http://www.lingcc.com/2010/04/14/10736/' rel='bookmark' title='探秘CPU性能测试：Spec CPU2000之整点篇'>探秘CPU性能测试：Spec CPU2000之整点篇</a></li>
<li><a href='http://www.lingcc.com/2009/12/22/10404/' rel='bookmark' title='有写编译器的冲动？这些资料很重要'>有写编译器的冲动？这些资料很重要</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tektalk.org/2010/04/20/2010%E7%BE%8E%E5%9B%BD%E9%AB%98%E6%A0%A1%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%B3%BB%E6%8E%92%E8%A1%8C%E6%A6%9C%E5%87%BA%E7%82%89/" target="_blank">2010年美国高校计算机系排行榜出炉</a>&#8211;《U.S. News》公布了新一期美国大学计算机系实力排名。前四：卡内基-梅隆大学(CMU)、麻省理工学院(MIT)、斯坦福大学(Stanford U)和加州大学伯克利分校(UC Berkely).</p>
<p><a title="前四名具体排名" href="http://www.lingcc.com/wp-content/uploads/2010/04/20100421-002317-pic1.png"></a></p>
<p><div id="attachment_10775" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/wp-content/uploads/2010/04/20100421-002317-pic11.png"><img class="size-medium wp-image-10775" title="前四名具体排名" src="http://www.lingcc.com/wp-content/uploads/2010/04/20100421-002317-pic11-300x87.png" alt="" width="300" height="87" /></a><p class="wp-caption-text">前四名具体排名</p></div><br />
<span id="more-10772"></span><br />
<div id="attachment_10774" class="wp-caption alignnone" style="width: 257px"><a href="http://www.lingcc.com/wp-content/uploads/2010/04/20100421-003207-pic1.png"><img class="size-medium wp-image-10774" title="前20名" src="http://www.lingcc.com/wp-content/uploads/2010/04/20100421-003207-pic1-247x300.png" alt="前20名" width="247" height="300" /></a><p class="wp-caption-text">前20名</p></div></p>
<h4>卡内基-梅隆大学(CMU)</h4>
<p>CMU的实力排序：编程语言、人工智能、计算机系统、计算理论。李开复、沈向洋、洪小文、黄学东、徐峰雄这些微软牛人清一色来自CMU。CMU的CS在算法、计算机网络、分布式系统、并行处理、程序语言、机器人、自然语言处理和软件工程等领域都有不俗的表现。包括<a href="http://www.csd.cs.cmu.edu/" target="_blank">Computer  Science Department</a>、<a href="http://www.hcii.cmu.edu/" target="_blank">Human-Computer  Interaction Inst(人机交互相关)</a>、<a href="http://www.isri.cmu.edu/" target="_blank">Institute  for Software Research(软件工程相关研究</a>)、<a href="http://lane.compbio.cmu.edu/" target="_blank">Lane  Ctr for Computational Biology(生物计算相关研究)</a>、<a href="http://www.lti.cs.cmu.edu/" target="_blank">Language  Technologies Institute(自然语言处理)</a>、<a href="http://www.ml.cmu.edu/" target="_blank">Machine  Learning Department(统计机器学习)</a>、Robotics  Institute、<a href="http://www.etc.cmu.edu" target="_blank">Entertainment  Technology Cente(计算机娱乐相关技术，貌似很有意思哈)</a>。CMU的编译研究：<a href="http://www.cs.cmu.edu/~mleone/language-research.html" target="_blank">Programming Language Research</a>(貌似比较老的网页)</p>
<h4>麻省理工学院(MIT)</h4>
<p>MIT的实力排序：人工智能、计算理论、计算机系统、编程语言。GNU，WWW标准组织，One laptop per Child就最早发源自MIT。MIT的牛人们为计算机科学方面的控制论、人工智能、计算机语言、机器学习、机器人、公钥加密上都起到了奠基作用。别忘了《算法导论》就来自MIT。MIT在CS方向的实验室最大的就是CSAIL了：<a href="http://www.csail.mit.edu/">Computer Science  and Artificial Intelligence Laboratory</a> (CSAIL，有50多个组，研究方向有三，人工智能，系统结构和计算机理论)。其中系统结构方面包括：计算机结构、安全、数据库、网络、并行、程序分析、编译等等方向。</p>
<h4>斯坦福大学(Stanford U)</h4>
<p>斯坦福的实力排序：编程语言，人工智能，计算机系统，计算理论。相对于前四名的其他大学，斯坦福的这几个方面排名相对靠后，可谁让人家身在硅谷，又出了很多大公司呢。斯坦福的CS研究方向:人工只能，机器人，计算理论，科学计算，计算机系统等。(抱歉搜到的资料太少).不过大名鼎鼎的《计算机系统结构&#8211;量化研究方法》的第一作者就是斯坦福大学的校长。MIPS也最早起源于斯坦福，还有曾经的Sun。</p>
<h4>加州大学伯克利分校(UC Berkely)</h4>
<p>UC Berkely的实力排序：计算机系统、编程语言、计算理论、人工智能。研究方向都差不多，包括人工智能，计算机体系结构与工程，图形学，人机交互，计算机操作系统和网络，编程系统，科学计算，计算机安全和计算理论。UC Berkely在CS上的实验室有：<a href="http://chess.eecs.berkeley.edu/">Center for Hybrid and Embedded  Software Systems (CHESS，异构平台上的实时软件技术研究) </a> 、<a href="http://www.eecs.berkeley.edu/CIS/">Center for Intelligent  Systems (CIS，研究计算机交互，人工智能，图形学等)</a>、<a href="http://parlab.eecs.berkeley.edu/" target="_blank">Parallel Computing Laboratory (ParLab，并行计算研究，本博翻译的并行计算前景系列文章来自此实验室。)</a>、<a href="http://www-video.eecs.berkeley.edu/">Video and Image Processing  Lab (VIP Lab，视频图像处理)</a>、<a href="http://webs.cs.berkeley.edu/">Wireless Embedded Systems (WEBS，物联网，无线传感网)</a>。</p>
<h4>总结：</h4>
<p>计算机牛，也就是那几个方向牛：编程语言，计算理论，计算机系统和人工智能。Google了一圈，大家都这么说。都说的挺玄乎，可苦了我这种努力想对比几大高校的人。对比来对比去，也没对比出什么好东西。不过好歹，咱也神游了一把名校，长了见识。尤其是MIT，真是牛！</p>
<p>参考：</p>
<p>http://www.cs.cmu.edu/</p>
<p>http://en.wikipedia.org/wiki/Carnegie_Mellon_School_of_Computer_Science</p>
<p>http://www.eecs.mit.edu/</p>
<p>http://en.wikipedia.org/wiki/Massachusetts_Institute_of_Technology</p>
<p>http://www.csail.mit.edu/</p>
<p>http://www-cs.stanford.edu/</p>
<p>http://en.wikipedia.org/wiki/MIPS_architecture</p>
<p>http://www.cs.berkeley.edu/</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="YY一下量子计算机的编译器" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F12%2F23%2F11431%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F23%2F10772%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/04/29/7110270.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">YY一下量子计算机的编译器</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="zz《人物》:计算机世界第一人 – 艾兰・图灵" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F28%2F9964%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F23%2F10772%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/04/30/7115589.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">zz《人物》:计算机世界第一人 – 艾兰・图灵</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="说说高通量计算机" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F21%2F11375%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F23%2F10772%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">说说高通量计算机</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="走进Debian和Gentoo中的系统初始化过程" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F19%2F10892%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F23%2F10772%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">走进Debian和Gentoo中的系统初始化过程</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="体系结构这五年--《计算机体系结构-量化研究方法》第5版的新变化" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F01%2F11927%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F23%2F10772%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">体系结构这五年--《计算机体系结构-量化研究方法》第5版的新变化</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/05/04/10878/' rel='bookmark' title='前瞻-主流处理器中的数据并行支持(SIMD)'>前瞻-主流处理器中的数据并行支持(SIMD)</a></li>
<li><a href='http://www.lingcc.com/2010/01/09/10623/' rel='bookmark' title='反汇编器和汇编器'>反汇编器和汇编器</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2010/02/03/10675/' rel='bookmark' title='计算机系统结构方向的顶尖会议'>计算机系统结构方向的顶尖会议</a></li>
<li><a href='http://www.lingcc.com/2010/04/14/10736/' rel='bookmark' title='探秘CPU性能测试：Spec CPU2000之整点篇'>探秘CPU性能测试：Spec CPU2000之整点篇</a></li>
<li><a href='http://www.lingcc.com/2009/12/22/10404/' rel='bookmark' title='有写编译器的冲动？这些资料很重要'>有写编译器的冲动？这些资料很重要</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/04/23/10772/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>为龙芯电脑安装操作系统常见问题</title>
		<link>http://www.lingcc.com/2010/03/25/10717/</link>
		<comments>http://www.lingcc.com/2010/03/25/10717/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 13:20:49 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[编译技术]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[fdisk]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[N32]]></category>
		<category><![CDATA[N64]]></category>
		<category><![CDATA[O32]]></category>
		<category><![CDATA[pmon]]></category>
		<category><![CDATA[rescue]]></category>
		<category><![CDATA[成功]]></category>
		<category><![CDATA[操作系统 Operating system]]></category>
		<category><![CDATA[链接]]></category>
		<category><![CDATA[龙芯]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10717</guid>
		<description><![CDATA[本博在实际工作中，曾经安装过不少龙芯电脑的系统，可谓稍有经验，这里略微介绍一些常见问题。 内核通用吗？一般龙芯2F使用MIPSIII的指令级，内核格式都为64位的文件。所以不管时O32系统还是N32系统，只要硬件相同都是通用的，不过别忘了连同/lib/modules 和/lib/firmware一起使用：） 龙芯到底有多少种系统？很多，按照ABI分为3类：O32，N32，N64.O32是出厂时自带的系统，一般龙芯盒子中的华镭，龙芯本中的loonux、红旗和龙芯一体机中的共创都是O32系统。这类系统基本都是在debian的基础上做做山寨化。当然也有英文版的debian系统，这个比较干净一些。对于O32的系统，源的问题最头疼，因为各个公司画地为牢，大家都努力维护自己的源，又都缺人手，所以都不完美，试了几个都不太好，装着装着就会出依赖问题，除非一直跟着升级，不然一次apt-get dist-upgrade，那简直是噩梦。N32的系统，zhllg基于Gentoo的已经有了，龙芯论坛里就能找到下载链接。因为Gentoo是自己直接编译，问题相对少些。debian的还没有。N64的系统，有憨牛LFS的，没有试过。至于为啥会有这么多系统，得问问MIPS，因为有不少改进，就产生了不少问题。请参考本博&#60;好大一筐梅普斯&#62;.N32系统据说比O32快20%-30%。因为龙芯本身是64位处理器，所以64位系统也没问题. 龙芯系统好装吗？好装！虽然咱们做的系统很山寨，但咱们的易用性很牛。官方提供了很多中安装和还原方式，硬盘，U盘和网络样样都行，很简单。只要下载一个rescue的内核，就能启动一个迷你的linux系统，有些小命令可以跑，接着再找你想要的系统，下载，解压到龙芯电脑的硬盘上即可。方便快捷，想装N32 就去下gentoo系统，想装O32就去下debian. Android都能装了。北京龙芯俱乐部的FTP里有各种OS，找最新的下就行了。文后有链接地址：） 为啥我的U盘识别不了？呵呵，问题不大，如果你已经确定按照相关步骤执行，并且U盘确实已经插进USB口，还有问题的话，那就换个U盘。因为PMON可能对部分U盘不识别，而且最好把U盘格式化成ext3格式的.pmon的时候可以执行devls，看看有没有usb设备。 装龙芯系统要几步？基本是三四步的样子，load内核，g+内核启动参数启动系统，再解压新系统。龙梦出厂的很多电脑都自带了还原功能，如果你还没有把它折腾坏的话，那就用还原吧。 fdisk对龙芯电脑上的硬盘做了分区，无法启动了咋办？这是我遇到的一个问题。龙芯电脑上本地的系统中对不用的几个分区用fdisk操作，之后重启，发现直接找不到wd0.很可能是硬盘分区表没有写对。这时候最好的方式是想办法再正确的执行一次fdisk。我的解决方法是，找了一个正常系统的内核，启动之，给内核的参数中指定根目录，系统成功启动，再执行了一次fdisk，做了几个小修改，保存，再重启就没问题了。至于为啥换个内核，指定根目录就能启动了，呵呵我也不太清除。 N32的Gentoo系统下载的是带x版本的，但是启动时报错：Warning:unable to open an initial console，然后就卡住了，怎么办？这是因为linux系统中有文件没办法做到压缩包中，需要手动mknod创建。执行下列命令就ok了。 mknod -m 600 dev/console c 5 1 mknod -m 666 dev/null c 1 3 cp -a dev/{console,null} lib/udev/devices/ 请参考一下网址： ftp://www.bjlx.org.cn/  （北京龙芯的ftp，所有的系统都能在这里下载到) http://bbs.lemote.com/redirect.php?tid=25756&#38;goto=lastpost （Gentoo N32系统讨论贴) http://bbs.lemote.com/viewthread.php?tid=4237&#38;extra=page%3D2 (憨牛N64系统讨论贴) http://dev.lemote.com/drupal/book/export/html/62  （操作系统安装方法) 相关文章： WebKit和Firefox的JavaScript性能对比 拥有Nanojit龙芯后端的firefox发布(10年1月14日更新) GCC初窥 用crossdev装龙芯的n32 gnu交叉工具链 使用crossdev安装龙芯的O32 gnu交叉工具链 小例子&#8211;回眸一笑百媚生<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F05%2F10894%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F25%2F10717%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯电脑常见问题</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F19%2F11208%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F25%2F10717%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC即将支持龙芯3A</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F08%2F15%2F11127%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F25%2F10717%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于龙芯公司的小道消息</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F25%2F10717%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯N32系统上的Squirrelfish性能</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F25%2F10717%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯中科公司招聘JAVA虚拟机开发工程师</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/22/10668/' rel='bookmark' title='WebKit和Firefox的JavaScript性能对比'>WebKit和Firefox的JavaScript性能对比</a></li>
<li><a href='http://www.lingcc.com/2009/12/24/10451/' rel='bookmark' title='拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)'>拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/21/10663/' rel='bookmark' title='小例子&#8211;回眸一笑百媚生'>小例子&#8211;回眸一笑百媚生</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>本博在实际工作中，曾经安装过不少龙芯电脑的系统，可谓稍有经验，这里略微介绍一些常见问题。</p>
<ol>
<li>内核通用吗？一般龙芯2F使用MIPSIII的指令级，内核格式都为64位的文件。所以不管时O32系统还是N32系统，只要硬件相同都是通用的，不过别忘了连同/lib/modules 和/lib/firmware一起使用：）</li>
<li>龙芯到底有多少种系统？很多，按照ABI分为3类：O32，N32，N64.O32是出厂时自带的系统，一般龙芯盒子中的华镭，龙芯本中的loonux、红旗和龙芯一体机中的共创都是O32系统。这类系统基本都是在debian的基础上做做山寨化。当然也有英文版的debian系统，这个比较干净一些。对于O32的系统，源的问题最头疼，因为各个公司画地为牢，大家都努力维护自己的源，又都缺人手，所以都不完美，试了几个都不太好，装着装着就会出依赖问题，除非一直跟着升级，不然一次apt-get dist-upgrade，那简直是噩梦。N32的系统，zhllg基于Gentoo的已经有了，龙芯论坛里就能找到下载链接。因为Gentoo是自己直接编译，问题相对少些。debian的还没有。N64的系统，有憨牛LFS的，没有试过。至于为啥会有这么多系统，得问问MIPS，因为有不少改进，就产生了不少问题。请参考本博<a href="../../../02/25/10698/" target="_blank">&lt;好大一筐梅普斯&gt;</a>.N32系统据说比O32快20%-30%。因为龙芯本身是64位处理器，所以64位系统也没问题.</li>
<p><span id="more-10717"></span></p>
<li>龙芯系统好装吗？好装！虽然咱们做的系统很山寨，但咱们的易用性很牛。官方提供了很多中安装和还原方式，硬盘，U盘和网络样样都行，很简单。只要下载一个rescue的内核，就能启动一个迷你的linux系统，有些小命令可以跑，接着再找你想要的系统，下载，解压到龙芯电脑的硬盘上即可。方便快捷，想装N32 就去下gentoo系统，想装O32就去下debian. Android都能装了。北京龙芯俱乐部的FTP里有各种OS，找最新的下就行了。文后有链接地址：）</li>
<li>为啥我的U盘识别不了？呵呵，问题不大，如果你已经确定按照相关步骤执行，并且U盘确实已经插进USB口，还有问题的话，那就换个U盘。因为PMON可能对部分U盘不识别，而且最好把U盘格式化成ext3格式的.pmon的时候可以执行devls，看看有没有usb设备。</li>
<li>装龙芯系统要几步？基本是三四步的样子，load内核，g+内核启动参数启动系统，再解压新系统。龙梦出厂的很多电脑都自带了还原功能，如果你还没有把它折腾坏的话，那就用还原吧。</li>
<li>fdisk对龙芯电脑上的硬盘做了分区，无法启动了咋办？这是我遇到的一个问题。龙芯电脑上本地的系统中对不用的几个分区用fdisk操作，之后重启，发现直接找不到wd0.很可能是硬盘分区表没有写对。这时候最好的方式是想办法再正确的执行一次fdisk。我的解决方法是，找了一个正常系统的内核，启动之，给内核的参数中指定根目录，系统成功启动，再执行了一次fdisk，做了几个小修改，保存，再重启就没问题了。至于为啥换个内核，指定根目录就能启动了，呵呵我也不太清除。</li>
<li>N32的Gentoo系统下载的是带x版本的，但是启动时报错：Warning:unable to open an initial console，然后就卡住了，怎么办？这是因为linux系统中有文件没办法做到压缩包中，需要手动mknod创建。执行下列命令就ok了。</li>
<p><strong>mknod -m 600 dev/console c 5 1<br />
mknod -m 666 dev/null c 1 3<br />
cp -a dev/{console,null} lib/udev/devices/</strong></ol>
<div><strong>请参考一下网址：</strong></div>
<div><strong>ftp://www.bjlx.org.cn/  （北京龙芯的ftp，所有的系统都能在这里下载到)</strong></div>
<div><strong>http://bbs.lemote.com/redirect.php?tid=25756&amp;goto=lastpost （Gentoo N32系统讨论贴)</strong></div>
<div><strong>http://bbs.lemote.com/viewthread.php?tid=4237&amp;extra=page%3D2 (憨牛N64系统讨论贴)</strong></div>
<div><strong>http://dev.lemote.com/drupal/book/export/html/62  （操作系统安装方法)</strong></div>
<div><strong><br />
</strong></div>
<div><strong><br />
</strong></div>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F05%2F10894%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F25%2F10717%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯电脑常见问题</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F19%2F11208%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F25%2F10717%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC即将支持龙芯3A</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F08%2F15%2F11127%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F25%2F10717%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于龙芯公司的小道消息</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F25%2F10717%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯N32系统上的Squirrelfish性能</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F03%2F25%2F10717%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯中科公司招聘JAVA虚拟机开发工程师</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/22/10668/' rel='bookmark' title='WebKit和Firefox的JavaScript性能对比'>WebKit和Firefox的JavaScript性能对比</a></li>
<li><a href='http://www.lingcc.com/2009/12/24/10451/' rel='bookmark' title='拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)'>拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/21/10663/' rel='bookmark' title='小例子&#8211;回眸一笑百媚生'>小例子&#8211;回眸一笑百媚生</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/03/25/10717/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

