Skip to content
Snippets Groups Projects
Commit ee56513f authored by DevDoggo's avatar DevDoggo
Browse files

Done

parent 5fd97f80
No related branches found
No related tags found
No related merge requests found
......@@ -27,8 +27,8 @@ use address::*;
#[inline(always)]
fn read_u32(addr: u32) -> u32 {
unsafe { core::ptr::read_volatile(addr as *const _) }
//core::ptr::read_volatile(addr as *const _)
// unsafe { core::ptr::read_volatile(addr as *const _) }
core::ptr::read_volatile(addr as *const _)
}
#[inline(always)]
......@@ -101,10 +101,15 @@ fn main() {
// 2. comment out line 30 and uncomment line 31 (essentially omitting the `unsafe`)
// what was the error message and explain why,
//
// >> Call to unsafe function requires unsafe function or block
// ** your answer here **
//
// digging a bit deeper, why do you think `read_volatile` is declared `unsafe`
// (https://doc.rust-lang.org/core/ptr/fn.read_volatile.html, for some food for thought )
//
// >> While volatile will not be re-ordered by the compiler,
// this still doesn't prevent something to start changing the value
// as the program may try to read (since read may not be an atomic operation)
// ** your answer here **
//
// commit your answers (bare4_2)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment