<noscript><linkrel="stylesheet"href="../noscript.css"></noscript><linkrel="alternate icon"type="image/png"href="../favicon-16x16.png"><linkrel="alternate icon"type="image/png"href="../favicon-32x32.png"><linkrel="icon"type="image/svg+xml"href="../favicon.svg"></head><bodyclass="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="sidebar"><divclass="sidebar-menu"role="button">☰</div><aclass="sidebar-logo"href="../os/index.html"><divclass="logo-container"><imgclass="rust-logo"src="../rust-logo.svg"alt="logo"></div>
</a><h2class="location"><ahref="#">Crate os</a></h2><divclass="block version"><divclass="narrow-helper"></div><p>Version 0.1.0</p></div><divclass="sidebar-elems"><aid="all-types"href="all.html"><p>See all os's items</p></a><divclass="block items"><ul><li><ahref="#modules">Modules</a></li><li><ahref="#macros">Macros</a></li><li><ahref="#functions">Functions</a></li></ul></div><divid="sidebar-vars"data-name="os"data-ty="mod"data-relpath=""></div><scriptdefersrc="sidebar-items.js"></script></div></nav><main><divclass="width-limiter"><divclass="sub-container"><aclass="sub-logo-container"href="../os/index.html"><imgclass="rust-logo"src="../rust-logo.svg"alt="logo"></a><navclass="sub"><divclass="theme-picker hidden"><buttonid="theme-picker"aria-label="Pick another theme!"aria-haspopup="menu"title="themes"><imgwidth="18"height="18"alt="Pick another theme!"src="../brush.svg"></button><divid="theme-choices"role="menu"></div></div><formclass="search-form"><divclass="search-container"><div>
<inputclass="search-input"name="search"autocomplete="off"spellcheck="false"placeholder="Click or press ‘S’ to search, ‘?’ for more options…"type="search"></div><buttontype="button"id="help-button"title="help">?</button><aid="settings-menu"href="../settings.html"title="settings"><imgwidth="18"height="18"alt="Change settings"src="../wheel.svg"></a></div></form></nav></div><sectionid="main-content"class="content"><divclass="main-heading">
<h1class="fqn"><spanclass="in-band">Crate <aclass="mod"href="#">os</a><buttonid="copy-path"onclick="copy_path(this)"title="Copy item path to clipboard"><imgsrc="../clipboard.svg"width="19"height="18"alt="Copy item path"></button></span></h1><spanclass="out-of-band"><aclass="srclink"href="../src/os/main.rs.html#1-79"title="goto source code">source</a> · <aid="toggle-all-docs"href="javascript:void(0)"title="collapse all docs">[<spanclass="inner">−</span>]</a></span></div><detailsclass="rustdoc-toggle top-doc"open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>The main module and entrypoint</p>
<p>Various facilities of the kernels are implemented as submodules. The most
important ones are:</p>
<ul>
<li><ahref="trap/index.html"title="trap"><code>trap</code></a>: Handles all cases of switching from userspace to the kernel</li>
<li><ahref="syscall/index.html"title="syscall"><code>syscall</code></a>: System call handling and implementation</li>
</ul>
<p>The operating system also starts in this module. Kernel code starts
executing from <code>entry.asm</code>, after which <ahref="fn.rust_main.html"title="rust_main()"><code>rust_main()</code></a> is called to
initialize various pieces of functionality. (See its source code for
details.)</p>
<p>We then call <ahref="task/fn.run_first_task.html"title="task::run_first_task()"><code>task::run_first_task()</code></a> and for the first time go to
<divclass="item-table"><divclass="item-row"><divclass="item-left module-item"><aclass="mod"href="board/index.html"title="os::board mod">board</a></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="mod"href="config/index.html"title="os::config mod">config</a></div><divclass="item-right docblock-short"><p>Constants used in rCore</p>
</div></div><divclass="item-row"><divclass="item-left module-item"><aclass="mod"href="console/index.html"title="os::console mod">console</a></div><divclass="item-right docblock-short"><p>SBI console driver, for text output</p>
</div></div><divclass="item-row"><divclass="item-left module-item"><aclass="mod"href="loader/index.html"title="os::loader mod">loader</a></div><divclass="item-right docblock-short"><p>Loading user applications into memory</p>