<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="mobile-topbar"><buttonclass="sidebar-menu-toggle">☰</button><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="sidebar-elems"><divclass="block"><ul><liclass="version">Version 0.1.0</li><li><aid="all-types"href="all.html">All Items</a></li></div></ul><section><divclass="block"><ul><li><ahref="#modules">Modules</a></li><li><ahref="#macros">Macros</a></li><li><ahref="#functions">Functions</a></li></ul></div></section><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="22"height="22"alt="Pick another theme!"src="../brush.svg"></button><divid="theme-choices"role="menu"></div></div><formclass="search-form"><divclass="search-container"><span></span><inputclass="search-input"name="search"autocomplete="off"spellcheck="false"placeholder="Click or press ‘S’ to search, ‘?’ for more options…"type="search"><buttontype="button"id="help-button"title="help">?</button><aid="settings-menu"href="../settings.html"title="settings"><imgwidth="22"height="22"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-84">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>
<li><ahref="mm/index.html"title="mm"><code>mm</code></a>: Address map using SV39</li>
<li><ahref="sync/index.html"title="sync"><code>sync</code></a>: Wrap a static data structure inside it so that we are able to access it without any <code>unsafe</code>.</li>
<li><ahref="fs/index.html"title="fs"><code>fs</code></a>: Separate user from file system with some structures</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/processor/fn.run_tasks.html"title="task::run_tasks()"><code>task::run_tasks()</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><spantitle="Restricted Visibility"> 🔒</span></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><spantitle="Restricted Visibility"> 🔒</span></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><spantitle="Restricted Visibility"> 🔒</span></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="drivers/index.html"title="os::drivers mod">drivers</a><spantitle="Restricted Visibility"> 🔒</span></div><divclass="item-right docblock-short"></div></div><divclass="item-row"><divclass="item-left module-item"><aclass="mod"href="fs/index.html"title="os::fs mod">fs</a></div><divclass="item-right docblock-short"><p>File system in os</p>