Title: Class 14: Entering Ring Naught
Date: 2014-03-18
Category: Classes
Tags: operating systems, kernel, kernel programming
Author: David Evans

   <div class="todo">
<b>Form your team for [PS4](|filename|../../pages/ps/ps4/ps4.md), and get started kernel hacking!</b> 
   </div>

Thursday's class will include an opportunity to ask the IronKernel
developers anything you want about the kernel code, so you are strongly
encouraged to get started on PS4 before that and look for things that
you have questions about in the code.

<center>
<iframe src="http://www.slideshare.net/slideshow/embed_code/32456437" width="476" height="400" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe><br>
[Videos](https://www.youtube.com/watch?v=ZAQuudeBImk&list=PLvpsxlEF9cP0SCptCL3bNR8M2lZrQRi0G)
</center>

## Readings

For a great story on how to get started kernel hacking in Rust, see
Julia Evans' [_Writing an OS in Rust in tiny steps (Steps
1-5)_](http://jvns.ca/blog/2014/03/12/the-rust-os-story/).  There is
also a video of her talk at the [March Rust
Meetup](https://air.mozilla.org/rust-meetup-march-2014/).  (Despite
Julia's obviously good taste in names, languages, and operating systems,
so far as I know we are not related.)

If you missed this earlier: [Gary Kildall and the 40th Anniversary of the Birth of the PC Operating System](http://www.computerhistory.org/atchm/gary-kildall-40th-anniversary-of-the-birth-of-the-pc-operating-system/) (David Laws, Computer History Museum).

## Turing Award

<center>
<iframe width="640" height="360" src="//www.youtube-nocookie.com/embed/ZAQuudeBImk?list=PLvpsxlEF9cP0SCptCL3bNR8M2lZrQRi0G" frameborder="0" allowfullscreen></iframe>
</center>

Leslie Lamport won the 2013 Turing Award!

[ACM Turing Award Goes to Pioneer Who Advanced Reliability and Consistency of Computing Systems](http://cacm.acm.org/news/173049-acm-turing-award-goes-to-pioneer-who-advanced-reliability-and-consistency-of-computing-systems/fulltext), ACM, 18 March 2014.  
[Leslie Lamport Receives Turing Award](http://research.microsoft.com/en-us/news/features/lamport-031814.aspx), Microsoft Research, 18 March 2014.

We will explore Lamport's work on mutual exclusion next week, including
this paper: [_A New Solution to Djikstra's Concurrent Programming
Problem_](http://research.microsoft.com/en-us/um/people/lamport/pubs/bakery.pdf),
Communications of the ACM, August 1974.  (Lamport also created
[LaTeX](http://latex-project.org/), which most tasteful technical
publications use for typesetting.)

## Exam 2

Exam 2 will be next week, out on March 25 and due before class on March
27 (or later).  It will be similar in format and content to Exam 1
(except mostly focusing on course material since Exam 1), but will also
include some specific questions about the kernel code.

## Memory Protection

<center>
<iframe width="640" height="360" src="//www.youtube-nocookie.com/embed/kv0P1wm2_kY?list=PLvpsxlEF9cP0SCptCL3bNR8M2lZrQRi0G" frameborder="0" allowfullscreen></iframe>
</center>

What are the advantages/disadvantages of hardware-based memory isolation
over software-based memory isolation? (This was a question on exam 1;
you should be able to answer it much better now if it appears again on exam 2.)

<div class="gap">

</div>

What is `fn fail_bounds_check(...)`?
<div class="gap">

</div>

## Popping the Kernel!

<center>
<iframe width="640" height="360" src="//www.youtube-nocookie.com/embed/2iXcqFhcIbA?list=PLvpsxlEF9cP0SCptCL3bNR8M2lZrQRi0G" frameborder="0" allowfullscreen></iframe>
</center>

Why is `println("Hello")` not possible in your first kernel-level program?
<div class="gap">

</div>

Why do we need `#[no_std]` to implement a kernel in Rust?
<div class="gap">

</div>

Is it possible to implement a kernel in Java?
<div class="gap">

</div>

# Introducing IronKernel

<center>
<iframe width="640" height="360" src="//www.youtube-nocookie.com/embed/B8OBuY4cSBk?list=PLvpsxlEF9cP0SCptCL3bNR8M2lZrQRi0G" frameborder="0" allowfullscreen></iframe>
</center>

Why is the assembler used to build IronKernel called `arm-none-eabi-as`?
<div class="gap">

</div>

<center>
<iframe width="640" height="360" src="//www.youtube-nocookie.com/embed/PQi7nnj1LKY?list=PLvpsxlEF9cP0SCptCL3bNR8M2lZrQRi0G" frameborder="0" allowfullscreen></iframe>
</center>

What do you expect to happen when you write to a random address in a user-level program running in Linux?
<div class="gap">

</div>

What do you expect to happen when you write to a random address in the kernel?
<div class="gap">

</div>


```rust
*((addr + (i * 4)) as * mut u32) = val
```

<div id="disqus_thread"></div>

<script type="text/javascript">
        /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
        var disqus_shortname = 'rust-class'; // required: replace example with your forum shortname
	var disqus_url = 'http://www.rust-class.org/class-14-entering-ring-naught.html';

        /* * * DON'T EDIT BELOW THIS LINE * * */
        (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
