Skip to content
Snippets Groups Projects
Commit 3979185e authored by Josef Utbult's avatar Josef Utbult
Browse files

bare4_2

parent 65f5e2a9
No related branches found
No related tags found
No related merge requests found
......@@ -36,8 +36,8 @@ use address::*;
// Here we have low level access to a bit in a register
#[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 _)
}
// Here we have low level access to a bit in a register
......@@ -102,12 +102,13 @@ const APP: () = {
//
// What was the error message and explain why.
//
// ** your answer here **
// error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
// I guess this is because you cant make sure that the adress is valid.
//
// 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 )
//
// ** your answer here **
// Because you can get undefined behaviour
//
// 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