From 50062e5b28af0a9f39af273f4b18d433ed30c876 Mon Sep 17 00:00:00 2001 From: John Hodge <tpg@mutabah.net> Date: Sat, 2 Feb 2019 16:00:59 +0800 Subject: [PATCH] All - Nightly fixes --- Kernel/Core/arch/amd64/sync.rs | 2 +- Kernel/Core/arch/amd64/threads.rs | 2 +- Kernel/Core/async/event.rs | 8 +++--- Kernel/Core/lib/mem/aref.rs | 2 +- Kernel/Core/lib/mod.rs | 2 +- Kernel/Core/main.rs | 3 +- Kernel/Core/metadevs/storage.rs | 6 ++-- Kernel/Core/metadevs/video/geom.rs | 4 +-- Kernel/Core/metadevs/video/mod.rs | 4 ++- Kernel/Core/sync/event_channel.rs | 2 +- Kernel/Core/threads/mod.rs | 8 +++--- Kernel/Core/threads/thread.rs | 10 +++---- Kernel/Core/unwind.rs | 2 +- Kernel/Makefile | 2 +- Kernel/Modules/gui/input/mod.rs | 4 +-- Kernel/Modules/gui/kernel_log.rs | 4 +-- Kernel/Modules/gui/windows/mod.rs | 38 ++++++++++++++++++-------- Kernel/Modules/gui/windows/window.rs | 2 +- Kernel/Modules/nic_rtl8139/lib.rs | 1 - Kernel/Modules/syscalls/lib.rs | 1 - Kernel/Modules/usb_ohci/lib.rs | 1 - Kernel/Modules/virtio/devices/video.rs | 4 +++ Kernel/Modules/virtio/lib.rs | 1 - Kernel/Modules/virtio/queue.rs | 2 +- Usermode/Makefile | 2 +- 25 files changed, 67 insertions(+), 50 deletions(-) diff --git a/Kernel/Core/arch/amd64/sync.rs b/Kernel/Core/arch/amd64/sync.rs index f2ddc138..9d21b25f 100644 --- a/Kernel/Core/arch/amd64/sync.rs +++ b/Kernel/Core/arch/amd64/sync.rs @@ -39,7 +39,7 @@ impl<T> Spinlock<T> /// Create a new spinning lock pub const fn new(val: T) -> Spinlock<T> { Spinlock { - lock: ::core::sync::atomic::ATOMIC_BOOL_INIT, //AtomicBool::new(false), + lock: AtomicBool::new(false), value: ::core::cell::UnsafeCell::new(val), } } diff --git a/Kernel/Core/arch/amd64/threads.rs b/Kernel/Core/arch/amd64/threads.rs index 715a91ff..2ca508e7 100644 --- a/Kernel/Core/arch/amd64/threads.rs +++ b/Kernel/Core/arch/amd64/threads.rs @@ -30,7 +30,7 @@ extern "C" { fn task_switch(oldrsp: &mut u64, newrsp: &u64, tlsbase: u64, cr3: u64); } -pub static S_IRQS_ENABLED: ::core::sync::atomic::AtomicBool = ::core::sync::atomic::ATOMIC_BOOL_INIT; +pub static S_IRQS_ENABLED: ::core::sync::atomic::AtomicBool = ::core::sync::atomic::AtomicBool::new(false); static mut S_IDLE_THREAD: *mut ::threads::Thread = 0 as *mut _; #[repr(C)] diff --git a/Kernel/Core/async/event.rs b/Kernel/Core/async/event.rs index 4fbb959a..54faeca0 100644 --- a/Kernel/Core/async/event.rs +++ b/Kernel/Core/async/event.rs @@ -5,7 +5,7 @@ //! Asynchronous event waiter #[allow(unused_imports)] use prelude::*; -use core::sync::atomic::{AtomicBool,ATOMIC_BOOL_INIT,Ordering}; +use core::sync::atomic::{AtomicBool,Ordering}; use core::fmt; /// A general-purpose wait event (when flag is set, waiters will be informed) @@ -34,15 +34,15 @@ pub struct Waiter<'a> source: Option<&'a Source>, } -//static S_EVENT_NONE: Source = Source { flag: ATOMIC_BOOL_INIT, waiter: mutex_init!(None) }; +//static S_EVENT_NONE: Source = Source { flag: AtomicBool::new(false), waiter: mutex_init!(None) }; impl Source { /// Create a new event source - pub fn new() -> Source + pub const fn new() -> Source { Source { - flag: ATOMIC_BOOL_INIT, + flag: AtomicBool::new(false), waiter: ::sync::mutex::Mutex::new(None), } } diff --git a/Kernel/Core/lib/mem/aref.rs b/Kernel/Core/lib/mem/aref.rs index d1e9602c..90ef4043 100644 --- a/Kernel/Core/lib/mem/aref.rs +++ b/Kernel/Core/lib/mem/aref.rs @@ -133,7 +133,7 @@ impl<T: ?Sized + Any> ArefBorrow<T> { pub fn downcast<U: Any>(self) -> Result<ArefBorrow<U>,Self> { // SAFE: Transmute validity is checked by checking that the type IDs match unsafe { - if (*self).get_type_id() == ::core::any::TypeId::of::<U>() { + if (*self).type_id() == ::core::any::TypeId::of::<U>() { let ptr = self.__ptr.as_ptr() as *const ArefInner<U>; ::core::mem::forget(self); Ok(ArefBorrow { __ptr: NonNull::new_unchecked(ptr as *mut _) }) diff --git a/Kernel/Core/lib/mod.rs b/Kernel/Core/lib/mod.rs index 2559aff1..41249fd1 100644 --- a/Kernel/Core/lib/mod.rs +++ b/Kernel/Core/lib/mod.rs @@ -22,7 +22,7 @@ pub use self::pod::{as_byte_slice, as_byte_slice_mut}; pub use self::collections::vec_map; pub mod collections; -pub mod thunk; +//pub mod thunk; pub mod borrow; pub mod ascii; diff --git a/Kernel/Core/main.rs b/Kernel/Core/main.rs index 0c08a640..e9fe6db3 100644 --- a/Kernel/Core/main.rs +++ b/Kernel/Core/main.rs @@ -16,8 +16,7 @@ #![feature(slice_patterns)] // Slice (array) destructuring patterns, used by multiboot code #![feature(linkage)] // allows using #[linkage="external"] #![feature(const_fn)] // Allows defining `const fn` -#![feature(get_type_id)] // used by process_local's "AnyMap" hackery -#![feature(integer_atomics)] // AtomicU8 +//#![feature(integer_atomics)] // AtomicU8 #![feature(dropck_eyepatch)] #![feature(panic_info_message)] diff --git a/Kernel/Core/metadevs/storage.rs b/Kernel/Core/metadevs/storage.rs index ac1dc1aa..003775c7 100644 --- a/Kernel/Core/metadevs/storage.rs +++ b/Kernel/Core/metadevs/storage.rs @@ -4,7 +4,7 @@ // Core/metadevs/storage.rs // - Storage (block device) subsystem use prelude::*; -use core::sync::atomic::{AtomicUsize,ATOMIC_USIZE_INIT}; +use core::sync::atomic::{AtomicUsize}; use sync::mutex::LazyMutex; use lib::{VecMap}; use lib::mem::Arc; @@ -157,9 +157,9 @@ struct PhysicalRegion first_block: u64, } -static S_NEXT_PV_IDX: AtomicUsize = ATOMIC_USIZE_INIT; +static S_NEXT_PV_IDX: AtomicUsize = AtomicUsize::new(0); static S_PHYSICAL_VOLUMES: LazyMutex<VecMap<usize,PhysicalVolumeInfo>> = lazymutex_init!(); -static S_NEXT_LV_IDX: AtomicUsize = ATOMIC_USIZE_INIT; +static S_NEXT_LV_IDX: AtomicUsize = AtomicUsize::new(0); static S_LOGICAL_VOLUMES: LazyMutex<VecMap<usize,Arc<LogicalVolume>>> = lazymutex_init!(); static S_MAPPERS: LazyMutex<Vec<&'static Mapper>> = lazymutex_init!(); diff --git a/Kernel/Core/metadevs/video/geom.rs b/Kernel/Core/metadevs/video/geom.rs index 15bd2b26..8252d928 100644 --- a/Kernel/Core/metadevs/video/geom.rs +++ b/Kernel/Core/metadevs/video/geom.rs @@ -120,8 +120,8 @@ impl Rect /// Obtain the closest Pos in this Rect pub fn clamp_pos(&self, pos: Pos) -> Pos { - let x = ::core::cmp::min( ::core::cmp::max(pos.x, self.left()), self.right() ); - let y = ::core::cmp::min( ::core::cmp::max(pos.y, self.top() ), self.bottom() ); + let x = ::core::cmp::min( ::core::cmp::max(pos.x, self.left()), self.right() - 1 ); + let y = ::core::cmp::min( ::core::cmp::max(pos.y, self.top() ), self.bottom() - 1 ); Pos::new(x, y) } diff --git a/Kernel/Core/metadevs/video/mod.rs b/Kernel/Core/metadevs/video/mod.rs index 37ef7b31..8a17388a 100644 --- a/Kernel/Core/metadevs/video/mod.rs +++ b/Kernel/Core/metadevs/video/mod.rs @@ -286,9 +286,11 @@ fn get_closest_visible_pos(pos: Pos) -> Pos } /// Returns the display region that contains the given point -pub fn get_display_for_pos(pos: Pos) -> Option<Rect> +pub fn get_display_for_pos(pos: Pos) -> Result<Rect,Rect> { with_display_at_pos(pos, |s| s.region) + // If the position is outside of any displays, return the closest display to it + .ok_or_else( || with_display_at_pos(get_closest_visible_pos(pos), |s| s.region).unwrap() ) } /// Write part of a single scanline to the screen diff --git a/Kernel/Core/sync/event_channel.rs b/Kernel/Core/sync/event_channel.rs index 0c0b03f8..824f8f20 100644 --- a/Kernel/Core/sync/event_channel.rs +++ b/Kernel/Core/sync/event_channel.rs @@ -32,7 +32,7 @@ impl EventChannel EventChannel { lock: Spinlock::new( false ), queue: UnsafeCell::new( WaitQueue::new() ), - pending_wakes: ::core::sync::atomic::ATOMIC_USIZE_INIT, + pending_wakes: ::core::sync::atomic::AtomicUsize::new(0), } } diff --git a/Kernel/Core/threads/mod.rs b/Kernel/Core/threads/mod.rs index ea830223..beabcde4 100644 --- a/Kernel/Core/threads/mod.rs +++ b/Kernel/Core/threads/mod.rs @@ -198,8 +198,8 @@ pub fn get_process_local<T: Send+Sync+::core::any::Any+Default+'static>() -> Are for s in pld.read().iter() { let item_ref: &::core::any::Any = &**s; - //log_debug!("{:?} ?== {:?}", item_ref.get_type_id(), ::core::any::TypeId::of::<T>()); - if item_ref.get_type_id() == ::core::any::TypeId::of::<T>() { + //log_debug!("{:?} ?== {:?}", item_ref.type_id(), ::core::any::TypeId::of::<T>()); + if item_ref.type_id() == ::core::any::TypeId::of::<T>() { return s.borrow().downcast::<T>().ok().unwrap(); } } @@ -208,8 +208,8 @@ pub fn get_process_local<T: Send+Sync+::core::any::Any+Default+'static>() -> Are let mut lh = pld.write(); for s in lh.iter() { let item_ref: &::core::any::Any = &**s; - //log_debug!("{:?} ?== {:?}", item_ref.get_type_id(), ::core::any::TypeId::of::<T>()); - if item_ref.get_type_id() == ::core::any::TypeId::of::<T>() { + //log_debug!("{:?} ?== {:?}", item_ref.type_id(), ::core::any::TypeId::of::<T>()); + if item_ref.type_id() == ::core::any::TypeId::of::<T>() { return s.borrow().downcast::<T>().ok().unwrap(); } } diff --git a/Kernel/Core/threads/thread.rs b/Kernel/Core/threads/thread.rs index 45835f29..95383c90 100644 --- a/Kernel/Core/threads/thread.rs +++ b/Kernel/Core/threads/thread.rs @@ -85,9 +85,9 @@ pub struct Thread assert_trait!{Thread : Send} /// Last allocated TID (because TID0 is allocated differently) -static S_LAST_TID: ::core::sync::atomic::AtomicUsize = ::core::sync::atomic::ATOMIC_USIZE_INIT; +static S_LAST_TID: ::core::sync::atomic::AtomicUsize = ::core::sync::atomic::AtomicUsize::new(0); const C_MAX_TID: usize = 0x7FFF_FFF0; // Leave 16 TIDs spare at end of 31 bit number -static S_LAST_PID: ::core::sync::atomic::AtomicUsize = ::core::sync::atomic::ATOMIC_USIZE_INIT; +static S_LAST_PID: ::core::sync::atomic::AtomicUsize = ::core::sync::atomic::AtomicUsize::new(0); const C_MAX_PID: usize = 0x007F_FFF0; // Leave 16 PIDs spare at end of 23 bit number fn allocate_tid() -> ThreadID @@ -195,7 +195,7 @@ impl ProcessHandle for s in pld.read().iter() { let item_ref: &::core::any::Any = &**s; - if item_ref.get_type_id() == ::core::any::TypeId::of::<T>() { + if item_ref.type_id() == ::core::any::TypeId::of::<T>() { return Some( s.borrow().downcast::<T>().ok().unwrap() ); } } @@ -211,7 +211,7 @@ impl ProcessHandle for s in pld.read().iter() { let item_ref: &::core::any::Any = &**s; - if item_ref.get_type_id() == ::core::any::TypeId::of::<T>() { + if item_ref.type_id() == ::core::any::TypeId::of::<T>() { return s.borrow().downcast::<T>().ok().unwrap(); } } @@ -220,7 +220,7 @@ impl ProcessHandle for s in lh.iter() { let item_ref: &::core::any::Any = &**s; - if item_ref.get_type_id() == ::core::any::TypeId::of::<T>() { + if item_ref.type_id() == ::core::any::TypeId::of::<T>() { return s.borrow().downcast::<T>().ok().unwrap(); } } diff --git a/Kernel/Core/unwind.rs b/Kernel/Core/unwind.rs index 7f1a5fef..034fcf59 100644 --- a/Kernel/Core/unwind.rs +++ b/Kernel/Core/unwind.rs @@ -75,7 +75,7 @@ pub extern fn rust_begin_unwind(info: &::core::panic::PanicInfo) -> ! { } fn begin_panic_fmt(msg: &::core::fmt::Arguments, (file, line): (&str, u32)) -> ! { - static NESTED: ::core::sync::atomic::AtomicBool = ::core::sync::atomic::ATOMIC_BOOL_INIT; + static NESTED: ::core::sync::atomic::AtomicBool = ::core::sync::atomic::AtomicBool::new(false); ::arch::puts("\nERROR: rust_begin_unwind: "); ::arch::puts(file); ::arch::puts(":"); diff --git a/Kernel/Makefile b/Kernel/Makefile index 7d96fdd0..fd70a7dc 100644 --- a/Kernel/Makefile +++ b/Kernel/Makefile @@ -246,7 +246,7 @@ $(OBJDIR)libcore.rlib: $(LIBCORESRC)lib.rs $(TARGET_FILE) $(OBJDIR)libcompiler_builtins.rlib: $(RUSTUP_SRC_DIR)libcompiler_builtins/src/lib.rs $(TARGET_FILE) @echo [RUSTC] -o $@ @mkdir -p $(dir $@) - $V$(ENV) $(RUSTC) $(RUSTFLAGS) --emit=link,dep-info --out-dir $(dir $@) --cfg feature=\"compiler-builtins\" $< + $V$(ENV) $(RUSTC) $(RUSTFLAGS) --emit=link,dep-info --out-dir $(dir $@) --cfg feature=\"compiler-builtins\" $< --cfg stage0 @cp $(OBJDIR)core.d $(OBJDIR)libcore.d $(OBJDIR)acpica.a: ../acpica/Makefile $(wildcard ../acpica/patches/source/include/platform/*) diff --git a/Kernel/Modules/gui/input/mod.rs b/Kernel/Modules/gui/input/mod.rs index 8bd228bb..494d5551 100644 --- a/Kernel/Modules/gui/input/mod.rs +++ b/Kernel/Modules/gui/input/mod.rs @@ -6,7 +6,7 @@ #[allow(unused_imports)] use kernel::prelude::*; use self::keyboard::KeyCode; -use core::sync::atomic::{AtomicUsize,ATOMIC_USIZE_INIT,Ordering}; +use core::sync::atomic::{AtomicUsize,Ordering}; use kernel::sync::atomic::AtomicValue; use kernel::sync::Mutex; @@ -286,7 +286,7 @@ impl InputChannel impl ModKeyPair { const fn new() -> ModKeyPair { - ModKeyPair(ATOMIC_USIZE_INIT) + ModKeyPair(AtomicUsize::new(0)) } fn set_l(&self) { self.0.fetch_or(1, Ordering::Relaxed); } fn set_r(&self) { self.0.fetch_or(2, Ordering::Relaxed); } diff --git a/Kernel/Modules/gui/kernel_log.rs b/Kernel/Modules/gui/kernel_log.rs index 1540d2d3..8c569aeb 100644 --- a/Kernel/Modules/gui/kernel_log.rs +++ b/Kernel/Modules/gui/kernel_log.rs @@ -81,8 +81,8 @@ impl KernelLog // - Is this particular call bad for bypassing the GUI? Or is this acceptable let max_dims = match ::kernel::metadevs::video::get_display_for_pos( Pos::new(0,0) ) { - Some(display) => display.dims(), - None => { + Ok(display) => display.dims(), + Err(_) => { log_warning!("No display at (0,0)"); Dims::new(0,0) }, diff --git a/Kernel/Modules/gui/windows/mod.rs b/Kernel/Modules/gui/windows/mod.rs index 7d04b312..3d98777a 100644 --- a/Kernel/Modules/gui/windows/mod.rs +++ b/Kernel/Modules/gui/windows/mod.rs @@ -72,7 +72,7 @@ struct CursorPos { // - 13 sessions, #0 is fixed to be the kernel's log 1-12 are bound to F1-F12 const C_MAX_SESSIONS: usize = 13; static S_WINDOW_GROUPS: LazyMutex<SparseVec< Arc<Mutex<WindowGroup>> >> = lazymutex_init!(); -static S_CURRENT_GROUP: ::core::sync::atomic::AtomicUsize = ::core::sync::atomic::ATOMIC_USIZE_INIT; +static S_CURRENT_GROUP: ::core::sync::atomic::AtomicUsize = ::core::sync::atomic::AtomicUsize::new(0); static S_RENDER_REQUEST: ::kernel::sync::EventChannel = ::kernel::sync::EventChannel::new(); static S_RENDER_NEEDED: atomic::AtomicBool = atomic::AtomicBool::new(false); @@ -102,20 +102,36 @@ pub fn update_dims() let mut lh = grp.lock(); for &mut (ref mut pos, ref win) in lh.windows.iter_mut() { - // Locate screen for the upper-left corner - let screen = match ::kernel::metadevs::video::get_display_for_pos(*pos) - { - Some(x) => x, - // TODO: If now off-screen, warp to a visible position (with ~20px leeway) - None => todo!("update_dims: Handle window moving off display area"), - }; // if window is maximised, keep it that way if win.flags.lock().maximised { + // Locate screen for the upper-left corner + let screen = match ::kernel::metadevs::video::get_display_for_pos(*pos) + { + Ok(x) => x, + // TODO: If now off-screen, warp to a visible position (with ~20px leeway) + Err(r) => { + todo!("update_dims: Handle full-screen window moving off display area - {:?} - {:?}", *pos, r) + }, + }; // Re-maximise *pos = screen.pos(); win.resize(screen.dims()); } + else + { + // Otherwise, ensure that the window stays visible + match ::kernel::metadevs::video::get_display_for_pos(*pos) + { + Ok(x) => { + // TODO: Crop window's display area to fit on-screen? + }, + // TODO: If now off-screen, warp to a visible position (with ~20px leeway) + Err(r) => { + todo!("update_dims: Handle window moving off display area - {:?} - {:?}", *pos, r) + }, + } + } } // Recalculate all visibilities let count = lh.render_order.len(); @@ -476,9 +492,9 @@ impl WindowGroup let &mut(ref mut pos, ref win_rc) = &mut self.windows[idx as usize]; let rect = match ::kernel::metadevs::video::get_display_for_pos(*pos) { - Some(x) => x, - None => { - log_error!("TODO: Handle window being off-screen"); + Ok(x) => x, + Err(r) => { + log_error!("TODO: Handle window being off-screen - closest {:?}", r); Rect::new(0,0, 0,0) }, }; diff --git a/Kernel/Modules/gui/windows/window.rs b/Kernel/Modules/gui/windows/window.rs index 7d5cfd58..517c4c45 100644 --- a/Kernel/Modules/gui/windows/window.rs +++ b/Kernel/Modules/gui/windows/window.rs @@ -66,7 +66,7 @@ impl Window name: name, buf: Default::default(), dirty_rects: Default::default(), - is_dirty: atomic::ATOMIC_BOOL_INIT, + is_dirty: atomic::AtomicBool::new(false), flags: Default::default(), input: WindowInput { queue: Mutex::new(RingBuf::new(16)), diff --git a/Kernel/Modules/nic_rtl8139/lib.rs b/Kernel/Modules/nic_rtl8139/lib.rs index f1deba2f..60fd9b39 100644 --- a/Kernel/Modules/nic_rtl8139/lib.rs +++ b/Kernel/Modules/nic_rtl8139/lib.rs @@ -5,7 +5,6 @@ //! Realtek 8139 driver #![no_std] #![feature(linkage)] // for module_define! -#![feature(integer_atomics)] // AtomicU8 use kernel::prelude::*; use kernel::sync::Mutex; use kernel::_async3 as async; diff --git a/Kernel/Modules/syscalls/lib.rs b/Kernel/Modules/syscalls/lib.rs index 0e807cfa..6fa5174e 100644 --- a/Kernel/Modules/syscalls/lib.rs +++ b/Kernel/Modules/syscalls/lib.rs @@ -4,7 +4,6 @@ // Core/syscalls/mod.rs //! Userland system-call interface #![no_std] -#![feature(integer_atomics)] #[allow(unused_imports)] use kernel::prelude::*; diff --git a/Kernel/Modules/usb_ohci/lib.rs b/Kernel/Modules/usb_ohci/lib.rs index 2a26910c..85e324e8 100644 --- a/Kernel/Modules/usb_ohci/lib.rs +++ b/Kernel/Modules/usb_ohci/lib.rs @@ -2,7 +2,6 @@ //! Open Host Controller Interface (OHCI) driver #![no_std] #![feature(linkage)] // for module_define! -#![feature(integer_atomics)] // AtomicU8 use kernel::prelude::*; use kernel::_async3 as async; use kernel::lib::mem::aref::{Aref,ArefBorrow}; diff --git a/Kernel/Modules/virtio/devices/video.rs b/Kernel/Modules/virtio/devices/video.rs index 28f7ce56..aa3fee1e 100644 --- a/Kernel/Modules/virtio/devices/video.rs +++ b/Kernel/Modules/virtio/devices/video.rs @@ -141,10 +141,12 @@ where width: width, height: height, }; + let mut ret_hdr: hw::CtrlHeader = ::kernel::lib::PodHelpers::zeroed(); let _rv = { let h = self.controlq.send_buffers(&self.interface, &mut [ Buffer::Read(::kernel::lib::as_byte_slice(&hdr)), Buffer::Read(::kernel::lib::as_byte_slice(&cmd)), + Buffer::Write(::kernel::lib::as_byte_slice_mut(&mut ret_hdr)), ]); h.wait_for_completion().expect("") }; @@ -169,11 +171,13 @@ where scanout_id: scanout_idx as u32, resource_id: resource_handle.idx, }; + let mut ret_hdr: hw::CtrlHeader = ::kernel::lib::PodHelpers::zeroed(); let _rv = { let h = self.controlq.send_buffers(&self.interface, &mut [ Buffer::Read(::kernel::lib::as_byte_slice(&hdr)), Buffer::Read(::kernel::lib::as_byte_slice(&cmd)), + Buffer::Write(::kernel::lib::as_byte_slice_mut(&mut ret_hdr)), ]); h.wait_for_completion().expect("") }; diff --git a/Kernel/Modules/virtio/lib.rs b/Kernel/Modules/virtio/lib.rs index 57cc54e1..70cad334 100644 --- a/Kernel/Modules/virtio/lib.rs +++ b/Kernel/Modules/virtio/lib.rs @@ -5,7 +5,6 @@ //! Virtual IO devices #![no_std] #![feature(linkage)] -#![feature(integer_atomics)] #[macro_use] extern crate kernel; diff --git a/Kernel/Modules/virtio/queue.rs b/Kernel/Modules/virtio/queue.rs index 90dd75b5..453107ff 100644 --- a/Kernel/Modules/virtio/queue.rs +++ b/Kernel/Modules/virtio/queue.rs @@ -113,7 +113,7 @@ impl Queue log_debug!("idx={}, desc={:?}", idx, self.used_ring().ents[idx]); let UsedElem { id, len } = self.used_ring().ents[idx]; - assert!(len > 0); + assert!(len > 0, "Used entry {} returned a zero length (id={})", idx, id); self.avail_ring_res[id as usize].store(len as usize, Ordering::Release); self.interrupt_flag.release(); } diff --git a/Usermode/Makefile b/Usermode/Makefile index 17f94bf6..8da9b005 100644 --- a/Usermode/Makefile +++ b/Usermode/Makefile @@ -46,7 +46,7 @@ endif BIN_RUSTFLAGS := #BIN_RUSTFLAGS += -C lto -RUSTFLAGS_compiler_builtins = --cfg feature=\"compiler-builtins\" +RUSTFLAGS_compiler_builtins = --cfg feature=\"compiler-builtins\" --cfg stage0 # - List non-file targets .PHONY: all clean -- GitLab