diff --git a/examples/.bare4.rs.swp b/examples/.bare4.rs.swp index 64198082dbcbcae4f408ab2afce55b6db5ab4f55..61ee4b1433b1f23c9614525fa4cd5f8b47ea02f2 100644 Binary files a/examples/.bare4.rs.swp and b/examples/.bare4.rs.swp differ diff --git a/examples/bare4.rs b/examples/bare4.rs index a954cea412f79a6f6e1581ea5f506d5bda64e4bf..4262927c0ec43aa9ba7464846d0a321e78768d15 100644 --- a/examples/bare4.rs +++ b/examples/bare4.rs @@ -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)] @@ -83,10 +83,13 @@ fn main() { // 2. comment out line 30 and uncomment line 31 (essentially omitting the `unsafe`) // what was the error message and explain why, // ** your answer here ** +// call to unsafe function recvier unsafe function or blok // // 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 ** +// it is reading a operation from a perifial. perifials ar critical resorses and writ operations +// kan cas race condition in combination with read. // // commit your answers (bare4_2) //