nst usize) -&gt; usize {
#     let res: usize;
#     unsafe {
#     asm!(&quot;mov ($1), $0&quot;:&quot;=r&quot;(res): &quot;r&quot;(ptr));
#     }
# 
#     res
# }
</code></pre></pre>
<p>Now we get a segmentation fault. Not surprising really, but how does the CPU
know that we're not allowed to dereference this memory?</p>
<ul>
<li>Does the CPU ask the OS if this process is allowed to access this memory location every time we dereference something?</li>
<li>Won't that be very slow? </li>
<li>How does the CP