@@ -62,6 +62,7 @@ mod vga;
6262use core:: {
6363 convert:: { TryFrom , TryInto } ,
6464 fmt:: Write ,
65+ ptr:: { addr_of, addr_of_mut} ,
6566 sync:: atomic:: { AtomicBool , AtomicU32 , Ordering } ,
6667} ;
6768
@@ -333,10 +334,10 @@ static API_CALLS: common::Api = common::Api {
333334const SECONDS_BETWEEN_UNIX_AND_NEOTRON_EPOCH : i64 = 946684800 ;
334335
335336extern "C" {
336- static mut _flash_os_start: u32 ;
337- static mut _flash_os_len: u32 ;
338- static mut _ram_os_start: u32 ;
339- static mut _ram_os_len: u32 ;
337+ static _flash_os_start: u32 ;
338+ static _flash_os_len: u32 ;
339+ static _ram_os_start: u32 ;
340+ static _ram_os_len: u32 ;
340341}
341342
342343/// What we paint Core 0's stack with
@@ -710,11 +711,10 @@ fn paint_stacks() {
710711 static mut _stack_start: usize ;
711712 }
712713 unsafe {
713- let stack_len =
714- ( & _stack_start as * const usize as usize ) - ( & __sheap as * const usize as usize ) ;
714+ let stack_len = ( addr_of ! ( _stack_start) as usize ) - ( addr_of ! ( __sheap) as usize ) ;
715715 // But not the top 64 words, because we're using the stack right now!
716716 let stack = core:: slice:: from_raw_parts_mut (
717- & mut __sheap as * mut usize ,
717+ addr_of_mut ! ( __sheap) ,
718718 ( stack_len / core:: mem:: size_of :: < usize > ( ) ) - 256 ,
719719 ) ;
720720 info ! ( "Painting Core 1 stack: {:?}" , stack. as_ptr_range( ) ) ;
@@ -744,10 +744,9 @@ fn check_stacks() {
744744 static mut __sheap: usize ;
745745 static mut _stack_start: usize ;
746746 }
747- let stack_len =
748- unsafe { ( & _stack_start as * const usize as usize ) - ( & __sheap as * const usize as usize ) } ;
747+ let stack_len = unsafe { ( addr_of ! ( _stack_start) as usize ) - ( addr_of ! ( __sheap) as usize ) } ;
749748 check_stack (
750- unsafe { & __sheap as * const usize } ,
749+ unsafe { addr_of ! ( __sheap) } ,
751750 stack_len,
752751 CORE0_STACK_PAINT_WORD ,
753752 ) ;
@@ -1896,8 +1895,8 @@ pub extern "C" fn memory_get_region(region: u8) -> FfiOption<common::MemoryRegio
18961895 0 => {
18971896 // Application Region
18981897 FfiOption :: Some ( MemoryRegion {
1899- start : unsafe { & mut _ram_os_start as * mut u32 } as * mut u8 ,
1900- length : unsafe { & mut _ram_os_len as * const u32 } as usize ,
1898+ start : unsafe { addr_of ! ( _ram_os_start) } as * mut u8 ,
1899+ length : unsafe { addr_of ! ( _ram_os_len) } as usize ,
19011900 kind : common:: MemoryKind :: Ram . into ( ) ,
19021901 } )
19031902 }
0 commit comments