From e44d009b842d03d80e098cb5915cb9de2ec9cd26 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 29 Dec 2023 18:26:23 +0800 Subject: [PATCH 01/14] kernel: mem: add function for verifying mappings Add a function to ensure mappings are unique across the whole system. This takes a very long time and can crash if the watchdog timer isn't paused. Signed-off-by: Sean Cross --- kernel/src/mem.rs | 135 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 102 insertions(+), 33 deletions(-) diff --git a/kernel/src/mem.rs b/kernel/src/mem.rs index 5c38f90fe..3c80e834f 100644 --- a/kernel/src/mem.rs +++ b/kernel/src/mem.rs @@ -254,51 +254,19 @@ impl MemoryManager { // println!("Allocating page for PID {}", pid); unsafe { let end_point = self.ram_size / PAGE_SIZE; - let starting_point = self.last_ram_page; + let starting_point = self.last_ram_page.max(end_point); for (allocation, index) in MEMORY_ALLOCATIONS[starting_point..end_point] .iter_mut() .zip(starting_point..) .chain(MEMORY_ALLOCATIONS[..starting_point].iter_mut().zip(0..)) { - // println!( - // " Checking {:08x}...", - // index * PAGE_SIZE + self.ram_start as usize - // ); if allocation.is_none() { *allocation = Some(pid); self.last_ram_page = index + 1; - // if self.last_ram_page >= end_point { - // self.last_ram_page = 0; - // } let page = index * PAGE_SIZE + self.ram_start; return Ok(page); } } - // for (index, allocation) in MEMORY_ALLOCATIONS - // [self.last_ram_page..((self.ram_size as usize) / PAGE_SIZE)] - // .iter_mut() - // .enumerate() - // { - // println!(" 1. Checking {:08x}...", (self.last_ram_page + index) * PAGE_SIZE + self.ram_start as usize); - // if allocation.is_none() { - // *allocation = Some(pid); - // self.last_ram_page = self.last_ram_page + index + 1; - // let page = (self.last_ram_page + index) * PAGE_SIZE + self.ram_start; - // return Ok(page); - // } - // } - // for (index, allocation) in MEMORY_ALLOCATIONS[..self.last_ram_page] - // .iter_mut() - // .enumerate() - // { - // println!(" 2. Checking {:08x}...", index * PAGE_SIZE + self.ram_start as usize); - // if allocation.is_none() { - // *allocation = Some(pid); - // self.last_ram_page = index + 1; - // let page = index * PAGE_SIZE + self.ram_start; - // return Ok(page); - // } - // } } Err(xous_kernel::Error::OutOfMemory) } @@ -873,6 +841,107 @@ impl MemoryManager { Ok(()) } + + #[cfg(all(baremetal, target_arch = "riscv32"))] + pub fn check_for_duplicates(&self) { + use crate::services::SystemServices; + + SystemServices::with(|system_services| { + let current_pid = system_services.current_pid(); + + // Actiavte the debugging process and iterate through it, + // noting down each active thread. + for phys in (self.ram_start..self.ram_start + self.ram_size).step_by(PAGE_SIZE) { + let mut owner = None; + for pid in 1..crate::services::MAX_PROCESS_COUNT { + let pid = PID::new(pid as u8).unwrap(); + let Ok(process) = system_services.get_process(pid) else { + continue; + }; + let Ok(_) = process.activate() else { + continue; + }; + match MemoryMapping::current().phys_to_virt(phys) { + Err(e) => { + println!("!!! ERROR {:?} !!!", e); + continue; + } + Ok(None) => continue, + Ok(Some(virt)) => { + let allocation_offset = (phys - self.ram_start) / PAGE_SIZE; + let existing_owner = unsafe { MEMORY_ALLOCATIONS[allocation_offset] }; + if existing_owner != Some(pid) { + let is_lent = { + if let Some(existing_owner) = existing_owner { + system_services + .get_process(existing_owner) + .unwrap() + .activate() + .unwrap(); + let is_lent = if let Ok(Some(owned_address)) = + MemoryMapping::current().phys_to_virt(phys) + { + crate::arch::mem::page_is_lent(owned_address as *mut u8) + } else { + false + }; + system_services + .get_process(pid) + .unwrap() + .activate() + .unwrap(); + is_lent + } else { + false + } + }; + println!( + "!!! 0x{:08x} is owned by {} ({}) but is mapped to {} ({}) -- {}", + phys, + existing_owner.map(|v| v.get() as isize).unwrap_or(-1), + existing_owner + .map(|v| system_services + .process_name(v) + .unwrap_or("")) + .unwrap_or(""), + pid.get(), + system_services.process_name(pid).unwrap_or(""), + if is_lent { "page is lent" } else { "duplicate!" }, + ); + } + if !crate::arch::mem::page_is_lent(virt as *mut u8) { + if owner.is_none() { + owner = Some((pid, virt)); + } else { + println!( + "!!! DUPLICATE !!! Page {:08x} owned by both {} ({}) @ {:08x} and {} ({}) @ {:08x}", + phys, + owner.map(|v| v.0.get() as isize).unwrap_or(-1), + owner + .map(|v| system_services + .process_name(v.0) + .unwrap_or("")) + .unwrap_or(""), + owner.map(|v| v.1).unwrap_or(0), + pid.get(), + system_services.process_name(pid).unwrap_or(""), + virt, + ); + } + } + } + } + } + } + + // Restore the previous PID + system_services + .get_process(current_pid) + .unwrap() + .activate() + .unwrap(); + }) + } } pub unsafe fn bzero(mut start: *mut T, end: *mut T) From b95d442e2024bd913b764c00af783ce59ec89482 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 29 Dec 2023 18:30:37 +0800 Subject: [PATCH 02/14] kernel: debug: add "check memory" command This command ensures memory is all owned by the correct process and is unique in its ownership. It takes a long time to run, so ensure the watchdog timer is disabled. Signed-off-by: Sean Cross --- kernel/src/debug/shell.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kernel/src/debug/shell.rs b/kernel/src/debug/shell.rs index 181654f0c..b33e9cf75 100644 --- a/kernel/src/debug/shell.rs +++ b/kernel/src/debug/shell.rs @@ -100,6 +100,14 @@ fn handle_character(b: u8) { }); }); } + #[cfg(all(baremetal, target_arch = "riscv32"))] + b'k' => { + println!("Checking RAM for duplicate pages (this will take a few minutes)"); + crate::mem::MemoryManager::with(|mm| { + mm.check_for_duplicates(); + }); + println!("Check complete"); + } b'm' => { println!("Printing memory page tables"); crate::services::SystemServices::with(|system_services| { @@ -228,6 +236,8 @@ fn print_help() { println!("--- + -----------------------"); println!(" h | print this message"); println!(" i | print irq handlers"); + #[cfg(all(baremetal, target_arch = "riscv32"))] + println!(" k | check RAM to make sure pages are unique"); println!(" m | print MMU page tables of all processes"); println!(" p | print all processes"); println!(" P | print all processes and threads"); From 6b5b4a5d2168603eee0afabb621acdf638df3e0e Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 29 Dec 2023 18:32:17 +0800 Subject: [PATCH 03/14] kernel: services: don't crash when a process quits When enumerating processes, the `find_process()` process didn't consult whether a process was actually free. This resulted in a crash, particularly when attaching a debugger to a crashed process. Signed-off-by: Sean Cross --- kernel/src/services.rs | 44 +++++++++++++----------------------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/kernel/src/services.rs b/kernel/src/services.rs index 10b941958..c3fed4c23 100644 --- a/kernel/src/services.rs +++ b/kernel/src/services.rs @@ -509,47 +509,29 @@ impl SystemServices { pub fn get_process(&self, pid: PID) -> Result<&Process, xous_kernel::Error> { // PID0 doesn't exist -- process IDs are offset by 1. let pid_idx = pid.get() as usize - 1; - if cfg!(baremetal) && self.processes[pid_idx].mapping.get_pid() != pid { - klog!( - "Process doesn't match ({} vs {})", - self.processes[pid_idx].mapping.get_pid(), - pid - ); - return Err(xous_kernel::Error::ProcessNotFound); + if cfg!(baremetal) && self.processes[pid_idx].mapping.get_pid() != Some(pid) { + Err(xous_kernel::Error::ProcessNotFound) + } else if self.processes[pid_idx].state == ProcessState::Free { + Err(xous_kernel::Error::ProcessNotFound) + } else { + Ok(&self.processes[pid_idx]) } - Ok(&self.processes[pid_idx]) } pub fn get_process_mut(&mut self, pid: PID) -> Result<&mut Process, xous_kernel::Error> { // PID0 doesn't exist -- process IDs are offset by 1. let pid_idx = pid.get() as usize - 1; - - // if self.processes[pid_idx].mapping.get_pid() != pid { - // println!( - // "Process doesn't match ({} vs {})", - // self.processes[pid_idx].mapping.get_pid(), - // pid - // ); - // return Err(xous_kernel::Error::ProcessNotFound); - // } - Ok(&mut self.processes[pid_idx]) + if cfg!(baremetal) && self.processes[pid_idx].mapping.get_pid() != Some(pid) { + Err(xous_kernel::Error::ProcessNotFound) + } else if self.processes[pid_idx].state == ProcessState::Free { + Err(xous_kernel::Error::ProcessNotFound) + } else { + Ok(&mut self.processes[pid_idx]) + } } pub fn current_pid(&self) -> PID { arch::process::current_pid() - // PID0 doesn't exist -- process IDs are offset by 1. - // assert_eq!( - // self.processes[pid as usize - 1].mapping, - // MemoryMapping::current(), - // "process memory map doesn't match -- current_pid: {}", - // pid - // ); - // assert_eq!( - // pid, self.pid, - // "current pid {} doesn't match arch pid: {}", - // self.pid, pid - // ); - // pid } /// Create a stack frame in the specified process and jump to it. From e0c62e5480af4079b236cf73184562dfc0e0e18b Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 29 Dec 2023 18:33:40 +0800 Subject: [PATCH 04/14] loader: don't reserve the "susres" page The "susres" page should be owned by the "susres" server and not the kernel. Avoid mapping this page to the kernel to prevent it from getting double-mapped. Signed-off-by: Sean Cross --- loader/src/consts.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/src/consts.rs b/loader/src/consts.rs index 847241af6..f96e46244 100644 --- a/loader/src/consts.rs +++ b/loader/src/consts.rs @@ -13,4 +13,4 @@ pub const KERNEL_STACK_TOP: usize = 0xfff8_0000; pub const KERNEL_LOAD_OFFSET: usize = 0xffd0_0000; pub const KERNEL_STACK_PAGE_COUNT: usize = 1; pub const KERNEL_ARGUMENT_OFFSET: usize = 0xffc0_0000; -pub const GUARD_MEMORY_BYTES: usize = 2 * crate::PAGE_SIZE; +pub const GUARD_MEMORY_BYTES: usize = 3 * crate::PAGE_SIZE; From 88020c99e0b1c67afab7943d15a77e252c939eab Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 29 Dec 2023 18:35:07 +0800 Subject: [PATCH 05/14] loader: add pid to `map_page()` call Add the pid as the page owner to `map_page()` calls. This ensures pages are owned by their respective processes, and removes a lot of `change_owner()` calls that immediately follow page mapping. It also allows for superpages to be owned by their respective processes. Signed-off-by: Sean Cross --- loader/src/bootconfig.rs | 29 ++++++++++++--- loader/src/minielf.rs | 20 +++++------ loader/src/phase2.rs | 24 ++++++++----- loader/src/platform/atsama5d27/boot.rs | 50 ++++++++++++++++++++++---- loader/src/platform/atsama5d27/load.rs | 13 +++---- 5 files changed, 100 insertions(+), 36 deletions(-) diff --git a/loader/src/bootconfig.rs b/loader/src/bootconfig.rs index 5a14c89e8..b3585e16a 100644 --- a/loader/src/bootconfig.rs +++ b/loader/src/bootconfig.rs @@ -148,21 +148,42 @@ impl BootConfig { /// # Panics /// /// * If you try to map a page twice - pub fn map_page(&mut self, root: &mut PageTable, phys: usize, virt: usize, flags: usize) { + pub fn map_page( + &mut self, + root: &mut PageTable, + phys: usize, + virt: usize, + flags: usize, + owner: XousPid, + ) { if VDBG { println!( " map pa {:x} -> va {:x} (satp {:x})", phys, virt, root as *mut PageTable as u32 ); } + assert!( + !(phys == 0 && flags & FLG_VALID != 0), + "cannot map zero page" + ); + if flags & FLG_VALID != 0 { + self.change_owner(owner, phys); + } match WORD_SIZE { - 4 => self.map_page_32(root, phys, virt, flags), + 4 => self.map_page_32(root, phys, virt, flags, owner), 8 => panic!("map_page doesn't work on 64-bit devices"), _ => panic!("unrecognized word size: {}", WORD_SIZE), } } - pub fn map_page_32(&mut self, root: &mut PageTable, phys: usize, virt: usize, flags: usize) { + pub fn map_page_32( + &mut self, + root: &mut PageTable, + phys: usize, + virt: usize, + flags: usize, + owner: XousPid, + ) { let ppn1 = (phys >> 22) & ((1 << 12) - 1); let ppn0 = (phys >> 12) & ((1 << 10) - 1); let ppo = (phys) & ((1 << 12) - 1); @@ -225,8 +246,8 @@ impl BootConfig { addr.get(), PAGE_TABLE_OFFSET + vpn1 * PAGE_SIZE, FLG_R | FLG_W | FLG_VALID, + owner, ); - self.change_owner(1 as XousPid, addr.get()); if VDBG { println!("<<< Done mapping new address"); } diff --git a/loader/src/minielf.rs b/loader/src/minielf.rs index 25332940e..d61ebc9b6 100644 --- a/loader/src/minielf.rs +++ b/loader/src/minielf.rs @@ -129,12 +129,12 @@ impl MiniElf { let tt_address = allocator.alloc() as usize; let tt = unsafe { &mut *(tt_address as *mut PageTable) }; - allocator.change_owner(pid as XousPid, tt_address); allocator.map_page( tt, tt_address, PAGE_TABLE_ROOT_OFFSET, FLG_R | FLG_W | FLG_VALID, + pid as XousPid, ); (tt, tt_address) @@ -156,6 +156,7 @@ impl MiniElf { tt_address + offset, PAGE_TABLE_ROOT_OFFSET + offset, FLG_R | FLG_W | FLG_VALID, + pid as XousPid, ); } @@ -173,8 +174,8 @@ impl MiniElf { thread_address, CONTEXT_OFFSET, FLG_R | FLG_W | FLG_VALID, + pid, ); - allocator.change_owner(pid as XousPid, thread_address as usize); // Allocate stack pages. println!(" Stack"); @@ -187,8 +188,8 @@ impl MiniElf { sp_page, (stack_addr - PAGE_SIZE * i) & !(PAGE_SIZE - 1), FLG_U | FLG_R | FLG_W | FLG_VALID, + pid, ); - allocator.change_owner(pid as XousPid, sp_page); } else { // Reserve every other stack page other than the 1st page. allocator.map_page( @@ -196,6 +197,7 @@ impl MiniElf { 0, (stack_addr - PAGE_SIZE * i) & !(PAGE_SIZE - 1), FLG_U | FLG_R | FLG_W, + pid, ); } } @@ -242,8 +244,7 @@ impl MiniElf { if VDBG { println!("1 {:08x} -> {:08x}", top as usize, this_page); } - allocator.map_page(tt, top as usize, this_page, flag_defaults); - allocator.change_owner(pid as XousPid, top as usize); + allocator.map_page(tt, top as usize, this_page, flag_defaults, pid as XousPid); allocated_bytes += PAGE_SIZE; top -= PAGE_SIZE; this_page += PAGE_SIZE; @@ -291,8 +292,7 @@ impl MiniElf { if VDBG { println!("2 {:08x} -> {:08x}", top as usize, this_page); } - allocator.map_page(tt, top as usize, this_page, flag_defaults); - allocator.change_owner(pid as XousPid, top as usize); + allocator.map_page(tt, top as usize, this_page, flag_defaults, pid as XousPid); allocated_bytes += PAGE_SIZE; top -= PAGE_SIZE; this_page += PAGE_SIZE; @@ -305,8 +305,7 @@ impl MiniElf { if VDBG { println!("3 {:08x} -> {:08x}", top as usize, this_page); } - allocator.map_page(tt, top as usize, this_page, flag_defaults); - allocator.change_owner(pid as XousPid, top as usize); + allocator.map_page(tt, top as usize, this_page, flag_defaults, pid as XousPid); allocated_bytes += PAGE_SIZE; top -= PAGE_SIZE; } @@ -362,9 +361,8 @@ impl MiniElf { while pages_to_map > 0 { let map_phys_addr = (image_phys_base + section_map_phys_offset) & !(PAGE_SIZE - 1); - allocator.map_page(tt, map_phys_addr, virt_page, flag_defaults); + allocator.map_page(tt, map_phys_addr, virt_page, flag_defaults, pid as XousPid); last_mapped_xip = virt_page; - allocator.change_owner(pid as XousPid, top as usize); section_map_phys_offset += PAGE_SIZE; virt_page += PAGE_SIZE; diff --git a/loader/src/phase2.rs b/loader/src/phase2.rs index 2b1e03e18..baf3ba02c 100644 --- a/loader/src/phase2.rs +++ b/loader/src/phase2.rs @@ -97,8 +97,8 @@ pub fn phase_2(cfg: &mut BootConfig) { addr + krn_struct_start, addr + KERNEL_ARGUMENT_OFFSET, FLG_R | FLG_W | FLG_VALID, + 1 as XousPid, ); - cfg.change_owner(1 as XousPid, (addr + krn_struct_start) as usize); } // Copy the kernel's "MMU Page 1023" into every process. @@ -240,8 +240,8 @@ impl ProgramDescription { satp_address, PAGE_TABLE_ROOT_OFFSET, FLG_R | FLG_W | FLG_VALID, + pid as XousPid, ); - allocator.change_owner(pid as XousPid, satp_address as usize); // Allocate context for this process let thread_address = allocator.alloc() as usize; @@ -250,8 +250,8 @@ impl ProgramDescription { thread_address, CONTEXT_OFFSET, FLG_R | FLG_W | FLG_VALID, + pid as XousPid, ); - allocator.change_owner(pid as XousPid, thread_address as usize); // Allocate stack pages. for i in 0..if is_kernel { @@ -266,8 +266,8 @@ impl ProgramDescription { sp_page, (stack_addr - PAGE_SIZE * i) & !(PAGE_SIZE - 1), flag_defaults, + pid as XousPid, ); - allocator.change_owner(pid as XousPid, sp_page); } else { // Reserve every page other than the 1st stack page allocator.map_page( @@ -275,6 +275,7 @@ impl ProgramDescription { 0, (stack_addr - PAGE_SIZE * i) & !(PAGE_SIZE - 1), flag_defaults & !FLG_VALID, + pid as XousPid, ); } @@ -286,8 +287,8 @@ impl ProgramDescription { sp_page, (EXCEPTION_STACK_TOP - 16 - PAGE_SIZE * i) & !(PAGE_SIZE - 1), flag_defaults, + pid as XousPid, ); - allocator.change_owner(pid as XousPid, sp_page); } } @@ -318,8 +319,8 @@ impl ProgramDescription { load_offset + offset + rounded_data_bss, self.text_offset as usize + offset, flag_defaults | FLG_X | FLG_VALID, + pid as XousPid, ); - allocator.change_owner(pid as XousPid, load_offset + offset + rounded_data_bss); } // Map the process data section into RAM. @@ -337,16 +338,21 @@ impl ProgramDescription { load_offset + offset, self.data_offset as usize + offset, flag_defaults, + pid as XousPid, ); - allocator.change_owner(pid as XousPid, load_offset as usize + offset); } // Allocate pages for .bss, if necessary // Our "earlyprintk" equivalent if cfg!(feature = "earlyprintk") && is_kernel { - allocator.map_page(satp, 0xF000_2000, 0xffcf_0000, FLG_R | FLG_W | FLG_VALID); - allocator.change_owner(pid as XousPid, 0xF000_2000); + allocator.map_page( + satp, + 0xF000_2000, + 0xffcf_0000, + FLG_R | FLG_W | FLG_VALID, + pid as XousPid, + ); } let process = &mut allocator.processes[pid_idx]; diff --git a/loader/src/platform/atsama5d27/boot.rs b/loader/src/platform/atsama5d27/boot.rs index 8a5ab6501..dc89aea92 100644 --- a/loader/src/platform/atsama5d27/boot.rs +++ b/loader/src/platform/atsama5d27/boot.rs @@ -166,7 +166,15 @@ impl BootConfig { phys: usize, virt: usize, flags: usize, + pid: XousPid, ) { + assert!( + !(phys == 0 && flags & FLG_VALID != 0), + "cannot map zero page" + ); + if flags & FLG_VALID != 0 { + self.change_owner(owner, phys); + } match WORD_SIZE { 4 => self.map_page_32(translation_table, phys, virt, flags), 8 => panic!("map_page doesn't work on 64-bit devices"), @@ -180,6 +188,7 @@ impl BootConfig { phys: usize, virt: usize, flags: usize, + pid: XousPid, ) { dprintln!( "PageTable: {:p} {:08x}", @@ -320,8 +329,8 @@ impl BootConfig { addr.get(), page_virt_addr, FLG_R | FLG_W | FLG_VALID, + pid, ); - self.change_owner(1 as XousPid, addr.get()); dprintln!("<<< Done mapping new address"); } } @@ -348,6 +357,7 @@ pub fn map_structs_to_kernel(cfg: &mut BootConfig, table_addr: usize, krn_struct LOADER_CODE_ADDRESS, LOADER_CODE_ADDRESS, FLG_R | FLG_X | FLG_VALID, + 1 as XousPid, ); // Map the last stack page (4K) to the kernel to make it visible from the trampoline code @@ -358,6 +368,7 @@ pub fn map_structs_to_kernel(cfg: &mut BootConfig, table_addr: usize, krn_struct 0x200ff000, 0x200ff000, FLG_R | FLG_X | FLG_VALID, + 1 as XousPid, ); // Identity map the page that contains kernel arguments @@ -367,6 +378,7 @@ pub fn map_structs_to_kernel(cfg: &mut BootConfig, table_addr: usize, krn_struct 0x20100000, 0x20100000, FLG_R | FLG_X | FLG_VALID, + 1 as XousPid, ); for addr in (0..cfg.init_size - GUARD_MEMORY_BYTES).step_by(PAGE_SIZE) { @@ -375,8 +387,8 @@ pub fn map_structs_to_kernel(cfg: &mut BootConfig, table_addr: usize, krn_struct addr + krn_struct_start, addr + KERNEL_ARGUMENT_OFFSET, FLG_R | FLG_W | FLG_VALID, + 1 as XousPid, ); - cfg.change_owner(1 as XousPid, addr + krn_struct_start); } } @@ -412,7 +424,13 @@ pub fn map_kernel_to_processes( translation_table as usize, virt, phys ); - cfg.map_page(translation_table, phys, virt, FLG_VALID | FLG_R | FLG_X); + cfg.map_page( + translation_table, + phys, + virt, + FLG_VALID | FLG_R | FLG_X, + 1 as XousPid, + ); } println!("Mapping kernel (PID1) data to process PID{}", process.asid); println!("Offset: {:08x}, size: {:08x}", kdata_offset, kdata_size); @@ -424,7 +442,13 @@ pub fn map_kernel_to_processes( translation_table as usize, virt, phys ); - cfg.map_page(translation_table, phys, virt, FLG_VALID | FLG_R | FLG_W); + cfg.map_page( + translation_table, + phys, + virt, + FLG_VALID | FLG_R | FLG_W, + 1 as XousPid, + ); } println!( @@ -440,7 +464,13 @@ pub fn map_kernel_to_processes( "MAP ({:08x}): {:08x} -> {:08x}", translation_table as usize, virt, phys ); - cfg.map_page(translation_table, phys, virt, FLG_VALID | FLG_R | FLG_W); + cfg.map_page( + translation_table, + phys, + virt, + FLG_VALID | FLG_R | FLG_W, + 1 as XousPid, + ); } println!("Mapping irq stack page to the process PID{}", process.asid); @@ -450,7 +480,13 @@ pub fn map_kernel_to_processes( "MAP ({:08x}): {:08x} -> {:08x}", translation_table as usize, virt, phys ); - cfg.map_page(translation_table, phys, virt, FLG_VALID | FLG_R | FLG_W); + cfg.map_page( + translation_table, + phys, + virt, + FLG_VALID | FLG_R | FLG_W, + 1 as XousPid, + ); // TODO: For now, make the UART visible for all the processes. // Later on we may reuse the mapping made by the kernel. @@ -467,6 +503,7 @@ pub fn map_kernel_to_processes( phys, virt, FLG_VALID | FLG_R | FLG_W | FLG_X, + 1 as XousPid, ); } @@ -477,6 +514,7 @@ pub fn map_kernel_to_processes( addr + krn_struct_start, addr + KERNEL_ARGUMENT_OFFSET, FLG_R | FLG_W | FLG_VALID, + 1 as XousPid, ); cfg.change_owner(1 as XousPid, addr + krn_struct_start); } diff --git a/loader/src/platform/atsama5d27/load.rs b/loader/src/platform/atsama5d27/load.rs index c407c24f3..a28a1f319 100644 --- a/loader/src/platform/atsama5d27/load.rs +++ b/loader/src/platform/atsama5d27/load.rs @@ -97,8 +97,8 @@ impl ProgramDescription { tt_address + offset, PAGE_TABLE_ROOT_OFFSET + offset, FLG_R | FLG_W | FLG_VALID, + pid as XousPid, ); - allocator.change_owner(pid as XousPid, tt_address); } // Allocate context for this process @@ -112,8 +112,8 @@ impl ProgramDescription { thread_address, CONTEXT_OFFSET, FLG_R | FLG_W | FLG_VALID, + pid as XousPid, ); - allocator.change_owner(pid as XousPid, thread_address); // Allocate stack pages. let total_stack_pages = if is_kernel { @@ -137,8 +137,8 @@ impl ProgramDescription { sp_page, (stack_addr - PAGE_SIZE * i) & !(PAGE_SIZE - 1), flag_defaults, + pid as XousPid, ); - allocator.change_owner(pid as XousPid, sp_page); } else { // Reserve every page other than the 1st stack page allocator.map_page( @@ -146,6 +146,7 @@ impl ProgramDescription { 0, (stack_addr - PAGE_SIZE * i) & !(PAGE_SIZE - 1), flag_defaults & !FLG_VALID, + pid as XousPid, ); } @@ -162,8 +163,8 @@ impl ProgramDescription { sp_page, (EXCEPTION_STACK_TOP - 16 - PAGE_SIZE * i) & !(PAGE_SIZE - 1), flag_defaults, + pid as XousPid, ); - allocator.change_owner(pid as XousPid, sp_page); } } @@ -183,8 +184,8 @@ impl ProgramDescription { sp_page, (IRQ_STACK_TOP - 16 - PAGE_SIZE * i) & !(PAGE_SIZE - 1), flag_defaults, + pid as XousPid, ); - allocator.change_owner(pid as XousPid, sp_page); } } @@ -216,8 +217,8 @@ impl ProgramDescription { load_offset + offset + rounded_data_bss, self.text_offset as usize + offset, flag_defaults | FLG_X | FLG_VALID, + pid as XousPid, ); - allocator.change_owner(pid as XousPid, load_offset + offset + rounded_data_bss); } // Map the process data section into RAM. From beeca26823e58007f146ee311d5b11d1a2409749 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 29 Dec 2023 18:36:31 +0800 Subject: [PATCH 06/14] emulation: ec: add new riscv suffixes for csr/fence The riscv foundation changed the descriptor of riscv cores. We must now add "_zicsr_zifencei" to the "rv32i" designation in order to ensure we have access to CSRs and the "FENCE.I" instruction. Signed-off-by: Sean Cross --- emulation/ec/betrusted-ec.repl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emulation/ec/betrusted-ec.repl b/emulation/ec/betrusted-ec.repl index e1918ef07..5ac00d7ec 100644 --- a/emulation/ec/betrusted-ec.repl +++ b/emulation/ec/betrusted-ec.repl @@ -1,5 +1,5 @@ cpu: CPU.VexRiscv @ sysbus - cpuType: "rv32i" + cpuType: "rv32i_zicsr_zifencei" PerformanceInMips: 6 uart: UART.LiteX_UART @ { From b12c08e99813d6c49f8e3aad78d685bbc050d4c7 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 29 Dec 2023 18:37:37 +0800 Subject: [PATCH 07/14] emulation: soc: add _zicsr_zifencei to rv32imac Add "_zicsr_zifencei" to "rv32imac" when describing the CPU core. This is required by newer versions of the spec, and will eventually be a requirement of Renode. Signed-off-by: Sean Cross --- emulation/soc/betrusted-soc.repl | 2 +- svd2repl/src/generate.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/emulation/soc/betrusted-soc.repl b/emulation/soc/betrusted-soc.repl index c6569e33b..f982a4e12 100644 --- a/emulation/soc/betrusted-soc.repl +++ b/emulation/soc/betrusted-soc.repl @@ -1,7 +1,7 @@ // Renode Platform file generated by svd2repl // This file is automatically generated cpu: CPU.Betrusted.AesVexRiscv @ sysbus - cpuType: "rv32imac" + cpuType: "rv32imac_zicsr_zifencei" privilegeArchitecture: PrivilegeArchitecture.Priv1_10 PerformanceInMips: 120 // Platform Peripherals diff --git a/svd2repl/src/generate.rs b/svd2repl/src/generate.rs index ec8fea788..27f230cb2 100644 --- a/svd2repl/src/generate.rs +++ b/svd2repl/src/generate.rs @@ -491,7 +491,7 @@ fn print_header(out: &mut U) -> std::io::Result<()> { let s = r####"// Renode Platform file generated by svd2repl // This file is automatically generated cpu: CPU.Betrusted.AesVexRiscv @ sysbus - cpuType: "rv32imac" + cpuType: "rv32imac_zicsr_zifencei" privilegeArchitecture: PrivilegeArchitecture.Priv1_10 PerformanceInMips: 120 "####; From 9a1191c0d237093d99993097af9d0c137a85df1a Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 29 Dec 2023 18:38:30 +0800 Subject: [PATCH 08/14] emulation: ComConnector: remove IInterestingType Apparently SPI connectors are no longer interesting. Remove this designator as it no longer exists. Signed-off-by: Sean Cross --- emulation/peripherals/ComConnector.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emulation/peripherals/ComConnector.cs b/emulation/peripherals/ComConnector.cs index 6d3ba11ed..021bd4a9f 100644 --- a/emulation/peripherals/ComConnector.cs +++ b/emulation/peripherals/ComConnector.cs @@ -13,13 +13,13 @@ using Antmicro.Renode.Utilities; namespace Antmicro.Renode.Peripherals.SPI.Betrusted { - public interface IComPeripheral : IPeripheral, IInterestingType + public interface IComPeripheral : IPeripheral { ushort Transmit(ushort data); bool HasData(); void FinishTransmission(); } - public interface IComController : IPeripheral, IInterestingType, IGPIOReceiver + public interface IComController : IPeripheral, IGPIOReceiver { ushort Transmit(ushort data); void FinishTransmission(); From 061abb05dba7b50e059bd444b9c9e84b14d6b9ff Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 29 Dec 2023 19:01:19 +0800 Subject: [PATCH 09/14] xous-log: stdout: insert `\r` when printing `\n` When printing messages to stdout or stderr, insert `\r` whenever we encounter `\n`. Signed-off-by: Sean Cross --- services/xous-log/src/main.rs | 36 ++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/services/xous-log/src/main.rs b/services/xous-log/src/main.rs index 8f24b3ffa..007982582 100644 --- a/services/xous-log/src/main.rs +++ b/services/xous-log/src/main.rs @@ -12,32 +12,36 @@ use num_traits::FromPrimitive; use platform::implementation; /// A page-aligned stack allocation for connection requests (used by USB resolver) -#[cfg(feature="usb")] +#[cfg(feature = "usb")] #[repr(C, align(4096))] struct ConnectRequest { name: [u8; 64], len: u32, _padding: [u8; 4096 - 4 - 64], } -#[cfg(feature="usb")] +#[cfg(feature = "usb")] impl Default for ConnectRequest { fn default() -> Self { - ConnectRequest { name: [0u8; 64], len: 0, _padding: [0u8; 4096 - 4 - 64] } + ConnectRequest { + name: [0u8; 64], + len: 0, + _padding: [0u8; 4096 - 4 - 64], + } } } -#[cfg(feature="usb")] +#[cfg(feature = "usb")] #[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone)] pub struct UsbString { - pub s: xous_ipc::String::<4000>, + pub s: xous_ipc::String<4000>, pub sent: Option, } -#[cfg(feature="usb")] +#[cfg(feature = "usb")] fn usb_send_str(conn: xous::CID, s: &str) { let serializer = UsbString { s: xous_ipc::String::<4000>::from_str(s), - sent: None + sent: None, }; let buf = xous_ipc::Buffer::into_buf(serializer).expect("usb error"); // failures to send are silent & ignored; also, this API doesn't block. @@ -49,10 +53,10 @@ fn reader_thread(arg: usize) { writeln!(output, "LOG: Xous Logging Server starting up...").ok(); let server_addr = xous::create_server_with_address(b"xous-log-server ").expect("create server"); writeln!(output, "LOG: Server listening on address {:?}", server_addr).ok(); - #[cfg(feature="usb")] + #[cfg(feature = "usb")] let mut usb_serial: Option = None; // use a stack-allocated string to ensure no heap thrashing results from String manipulations - #[cfg(feature="usb")] + #[cfg(feature = "usb")] let mut usb_str = xous_ipc::String::<4000>::new(); println!("LOG: my PID is {}", xous::process::id()); @@ -118,9 +122,10 @@ fn reader_thread(arg: usize) { write!(output, ":{}", line.get()).ok(); } writeln!(output, ")").ok(); - #[cfg(feature="usb")] + #[cfg(feature = "usb")] if let Some(conn) = usb_serial { - if usb_str.len() > 0 { // test length so we aren't constantly copying 4096 bytes of 0's clearing an already cleared structure. + if usb_str.len() > 0 { + // test length so we aren't constantly copying 4096 bytes of 0's clearing an already cleared structure. usb_str.clear(); } // duplicate the above code because doing repeated calls to the USB stack is inefficient @@ -165,10 +170,15 @@ fn reader_thread(arg: usize) { buffer_length, ) }; - output.write_all(buffer).unwrap(); + for c in buffer { + if *c == b'\n' { + output.putc(b'\r'); + } + output.putc(*c); + } // TODO: If the buffer is mutable, set `length` to 0. - #[cfg(feature="usb")] + #[cfg(feature = "usb")] if let Some(conn) = usb_serial { // safety: this routine will just blow up if you try to pass non utf-8 to it, // so it's not very safe. On the other hand, it's fast and shame on you for sending From c9407a2d474131f3d84b822d3b4e28aaac18a476 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 4 Jan 2024 18:30:48 +0800 Subject: [PATCH 10/14] harmonize hosted mode to latest kernel API for get_pid() --- kernel/src/arch/hosted/mem.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/src/arch/hosted/mem.rs b/kernel/src/arch/hosted/mem.rs index f13ac3ace..72e91510b 100644 --- a/kernel/src/arch/hosted/mem.rs +++ b/kernel/src/arch/hosted/mem.rs @@ -26,7 +26,7 @@ impl MemoryMapping { } /// Get the "PID" (actually, ASID) from the current mapping - pub fn get_pid(self) -> PID { + pub fn get_pid(self) -> Option { unimplemented!() } From f88cca4401db4e276fa50897aa0c9fd54daa2884 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 4 Jan 2024 18:31:16 +0800 Subject: [PATCH 11/14] cleanup hosted mode implementation for xous-log --- .../xous-log/src/platform/hosted/implementation.rs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/services/xous-log/src/platform/hosted/implementation.rs b/services/xous-log/src/platform/hosted/implementation.rs index 8e8f507b6..d52c4c45e 100644 --- a/services/xous-log/src/platform/hosted/implementation.rs +++ b/services/xous-log/src/platform/hosted/implementation.rs @@ -71,20 +71,6 @@ impl OutputWriter { pub fn putc(&self, c: u8) { self.tx.send(ControlMessage::Byte(c)).unwrap(); } - - /// Write a buffer to the output and return the number of - /// bytes written. This is mostly compatible with `std::io::Write`, - /// except it is infallible. - pub fn write(&mut self, buf: &[u8]) -> usize { - for c in buf { - self.putc(*c); - } - buf.len() - } - - pub fn write_all(&mut self, buf: &[u8]) -> core::result::Result { - Ok(self.write(buf)) - } } impl Write for OutputWriter { From 5f25e2b992e3b1bbb342cd6056ea8e20f15cafef Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 4 Jan 2024 18:31:36 +0800 Subject: [PATCH 12/14] add rand_xorshift to the project --- Cargo.lock | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index a4b24bbed..5371a7cd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3805,6 +3805,15 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core 0.6.3", +] + [[package]] name = "random-number" version = "0.1.7" @@ -4483,6 +4492,7 @@ dependencies = [ "png", "rand 0.8.5", "rand_chacha 0.3.1", + "rand_xorshift", "random-pick", "ring", "rkyv", From 0d80912f0a7afd3a8011ce7a751fe287f4b0ca2d Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 4 Jan 2024 19:13:20 +0800 Subject: [PATCH 13/14] fix warning in 1.75.0; breaking change with earlier rust versions This is unfortunate, and calling this out in a single commit because this is a dubious decision to achieve warning-free code for such a minor thing. --- services/modals/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/modals/src/lib.rs b/services/modals/src/lib.rs index b41e59e0a..2c7d972a7 100644 --- a/services/modals/src/lib.rs +++ b/services/modals/src/lib.rs @@ -94,7 +94,8 @@ impl<'a> AlertModalBuilder<'a> { final_placeholders = Some(pl) } 0 => (), - _ => panic!("somehow len of placeholders was neither zero or >= 1...?"), + // Note: if you are getting an error on compilation, this line below is required for Rust < 1.75.0 + // _ => panic!("somehow len of placeholders was neither zero or >= 1...?"), } let mut spec = ManagedPromptWithTextResponse { From 8ec08c9c7622133570d8266ca5890400179f2db0 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 4 Jan 2024 19:15:28 +0800 Subject: [PATCH 14/14] fix rust v1.75.0 warnings that are probably benign a lot of re-import warnings have cropped up. While I appreciate their studiousness on this, the problem is that removing some of these exports in the API crate could mean that future users who want access to some API features that aren't used in this configuration are now unaccessible. I think it's not a huge problem at the moment, just spam-cleaning the warnings because there are too many to deal with carefully at the moment. --- RELEASE-v0.9.md | 3 +++ kernel/src/services.rs | 1 + libs/mass-storage/packing/packing/src/lib.rs | 1 + .../packing/packing/src/primitive_packing/mod.rs | 2 ++ libs/mass-storage/usbd_scsi/src/scsi/enums/mod.rs | 2 ++ loader/curve25519-dalek-loader/src/field.rs | 1 + locales/src/lib.rs | 1 - services/net/src/api.rs | 1 + services/pddb/src/backend.rs | 1 - services/root-keys/src/api.rs | 1 - services/root-keys/src/lib.rs | 1 + services/usb-device-xous/src/mappings.rs | 2 +- .../src/platform/precursor/implementation.rs | 14 -------------- utralib/src/lib.rs | 1 + 14 files changed, 14 insertions(+), 18 deletions(-) diff --git a/RELEASE-v0.9.md b/RELEASE-v0.9.md index 942161b19..eb8fe9c1c 100644 --- a/RELEASE-v0.9.md +++ b/RELEASE-v0.9.md @@ -441,6 +441,9 @@ perform the Xous firmware upgrade. This requires running manual update commands, - Fix an issue where uninitialized memory is being returned from the kernel due to a pointer assumed to be pointing to `usize` actually pointing to `u8`, thus having its length incorrectly divided by the size of a `usize` ## New in 0.9.16 +- Incorporate more stability fixes and formatting changes from @xobs +- Clean up warning and breakages due to Rust 1.75.0. Note that cleaning up one warning forces the code to be + backward-incompatible with earlier versions of Rust. 😖 ## Roadmap - Lots of testing and bug fixes diff --git a/kernel/src/services.rs b/kernel/src/services.rs index c3fed4c23..9c1a91ac3 100644 --- a/kernel/src/services.rs +++ b/kernel/src/services.rs @@ -4,6 +4,7 @@ use crate::arch; use crate::arch::mem::MemoryMapping; pub use crate::arch::process::Process as ArchProcess; +#[cfg(not(any(windows, unix)))] pub use crate::arch::process::Thread; use crate::platform; use xous_kernel::arch::ProcessStartup; diff --git a/libs/mass-storage/packing/packing/src/lib.rs b/libs/mass-storage/packing/packing/src/lib.rs index 851d94828..853a054e7 100644 --- a/libs/mass-storage/packing/packing/src/lib.rs +++ b/libs/mass-storage/packing/packing/src/lib.rs @@ -5,6 +5,7 @@ // SPDX-LIcense-Identifier: Apache 2.0 #![no_std] +#![allow(unused_imports)] pub use typenum::{ Unsigned, U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, diff --git a/libs/mass-storage/packing/packing/src/primitive_packing/mod.rs b/libs/mass-storage/packing/packing/src/primitive_packing/mod.rs index 17f295a98..03b4eb458 100644 --- a/libs/mass-storage/packing/packing/src/primitive_packing/mod.rs +++ b/libs/mass-storage/packing/packing/src/primitive_packing/mod.rs @@ -4,6 +4,8 @@ // SPDX-License-Identifier: MIT // SPDX-LIcense-Identifier: Apache 2.0 +#![allow(unused_imports)] + mod bool_pack; pub use bool_pack::*; diff --git a/libs/mass-storage/usbd_scsi/src/scsi/enums/mod.rs b/libs/mass-storage/usbd_scsi/src/scsi/enums/mod.rs index 782be1f10..ac1d3fe87 100644 --- a/libs/mass-storage/usbd_scsi/src/scsi/enums/mod.rs +++ b/libs/mass-storage/usbd_scsi/src/scsi/enums/mod.rs @@ -4,6 +4,8 @@ // SPDX-License-Identifier: MIT // SPDX-LIcense-Identifier: Apache 2.0 +#![allow(unused_imports)] + mod op_code; pub use op_code::*; diff --git a/loader/curve25519-dalek-loader/src/field.rs b/loader/curve25519-dalek-loader/src/field.rs index 16d5d03f9..0d1a07254 100644 --- a/loader/curve25519-dalek-loader/src/field.rs +++ b/loader/curve25519-dalek-loader/src/field.rs @@ -69,6 +69,7 @@ pub use backend::serial::u32::field::*; pub type FieldElement = backend::serial::u32::field::FieldElement2625; #[cfg(feature = "u32e_backend")] +#[allow(unused_imports)] // this may be used by some other configs, so don't un-export it. pub use backend::serial::u32e::field::*; /// A `FieldElement` represents an element of the field /// \\( \mathbb Z / (2\^{255} - 19)\\). diff --git a/locales/src/lib.rs b/locales/src/lib.rs index 3cc6efd6e..dbe781b9d 100644 --- a/locales/src/lib.rs +++ b/locales/src/lib.rs @@ -4,4 +4,3 @@ pub mod locale; pub use locale::LANG; pub mod generated; -pub use generated::*; diff --git a/services/net/src/api.rs b/services/net/src/api.rs index 041420d64..b1c28d91f 100644 --- a/services/net/src/api.rs +++ b/services/net/src/api.rs @@ -19,6 +19,7 @@ use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}; use xous_semver::SemVer; // republish this so we can decode the icmpv4 error codes +#[allow(unused_imports)] pub use smoltcp::wire::Icmpv4DstUnreachable; // note: this name cannot be changed, because it is baked into `libstd` diff --git a/services/pddb/src/backend.rs b/services/pddb/src/backend.rs index bbe162c3b..eb34ad978 100644 --- a/services/pddb/src/backend.rs +++ b/services/pddb/src/backend.rs @@ -11,7 +11,6 @@ pub use fastspace::*; mod types; pub use types::*; mod bcrypt; -pub use bcrypt::*; // local to the backend mod murmur3; diff --git a/services/root-keys/src/api.rs b/services/root-keys/src/api.rs index e6e45667b..6baf4a7f0 100644 --- a/services/root-keys/src/api.rs +++ b/services/root-keys/src/api.rs @@ -144,7 +144,6 @@ pub enum RootkeyResult { } /// AES operation definitions -pub use cipher::{BlockCipher, consts::U16}; use keyboard::KeyMap; use zeroize::Zeroize; diff --git a/services/root-keys/src/lib.rs b/services/root-keys/src/lib.rs index 1c6e07987..140830237 100644 --- a/services/root-keys/src/lib.rs +++ b/services/root-keys/src/lib.rs @@ -14,6 +14,7 @@ use std::convert::TryInto; pub use cipher::{BlockSizeUser, BlockClosure, ParBlocksSizeUser, BlockBackend, BlockEncrypt, BlockDecrypt, consts::U16, inout::InOut, generic_array::GenericArray, + BlockCipher }; pub(crate) type BatchBlocks = GenericArray; diff --git a/services/usb-device-xous/src/mappings.rs b/services/usb-device-xous/src/mappings.rs index c68b9a18b..1b1a1d076 100644 --- a/services/usb-device-xous/src/mappings.rs +++ b/services/usb-device-xous/src/mappings.rs @@ -1,4 +1,4 @@ -#![allow(dead_code)] +#![allow(unused_imports)] pub use xous_usb_hid::page::Keyboard as UsbKeyCode; #[cfg(any(feature="precursor", feature="renode"))] diff --git a/services/xous-log/src/platform/precursor/implementation.rs b/services/xous-log/src/platform/precursor/implementation.rs index 9570d70b9..f77b7bb4f 100644 --- a/services/xous-log/src/platform/precursor/implementation.rs +++ b/services/xous-log/src/platform/precursor/implementation.rs @@ -105,20 +105,6 @@ impl OutputWriter { // uart_csr.wfo(utra::uart::EV_PENDING_RX, 1); } } - - /// Write a buffer to the output and return the number of - /// bytes written. This is mostly compatible with `std::io::Write`, - /// except it is infallible. - pub fn write(&mut self, buf: &[u8]) -> usize { - for c in buf { - self.putc(*c); - } - buf.len() - } - - pub fn write_all(&mut self, buf: &[u8]) -> core::result::Result { - Ok(self.write(buf)) - } } impl Write for OutputWriter { diff --git a/utralib/src/lib.rs b/utralib/src/lib.rs index 94f7bfa82..b9208d1fb 100644 --- a/utralib/src/lib.rs +++ b/utralib/src/lib.rs @@ -1,3 +1,4 @@ #![cfg_attr(any(target_os = "none", not(feature = "std")), no_std)] pub mod generated; +#[cfg(not(any(windows, unix)))] pub use generated::*;