From 0c80643077568a68d5a87f808fa8ffb420804a3e Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Fri, 29 Jul 2022 15:56:44 -0600 Subject: [PATCH] Make graphical_debug arch independent and fix lots of warnings --- src/acpi/mod.rs | 3 +- src/acpi/rxsdt.rs | 2 - src/arch/x86_64/debug.rs | 2 +- src/arch/x86_64/graphical_debug/debug.rs | 63 ----------------- src/arch/x86_64/graphical_debug/display.rs | 80 ---------------------- src/arch/x86_64/graphical_debug/mod.rs | 70 ------------------- src/arch/x86_64/idt.rs | 2 +- src/arch/x86_64/interrupt/syscall.rs | 12 +--- src/arch/x86_64/interrupt/trace.rs | 2 +- src/arch/x86_64/mod.rs | 4 -- src/arch/x86_64/rmm.rs | 4 +- src/arch/x86_64/start.rs | 8 +-- src/context/context.rs | 4 +- src/context/memory.rs | 10 +-- src/debugger.rs | 4 +- src/devices/mod.rs | 2 + src/lib.rs | 2 +- src/scheme/memory.rs | 4 +- src/scheme/proc.rs | 4 +- src/scheme/user.rs | 2 +- src/syscall/driver.rs | 4 +- src/syscall/futex.rs | 2 +- src/syscall/mod.rs | 8 +-- src/syscall/process.rs | 4 +- 24 files changed, 37 insertions(+), 265 deletions(-) delete mode 100644 src/arch/x86_64/graphical_debug/debug.rs delete mode 100644 src/arch/x86_64/graphical_debug/display.rs delete mode 100644 src/arch/x86_64/graphical_debug/mod.rs diff --git a/src/acpi/mod.rs b/src/acpi/mod.rs index 49b5bb8..370d058 100644 --- a/src/acpi/mod.rs +++ b/src/acpi/mod.rs @@ -9,8 +9,7 @@ use alloc::boxed::Box; use spin::{Once, RwLock}; use crate::log::info; -use crate::memory::Frame; -use crate::paging::{KernelMapper, Page, PageFlags, PhysicalAddress, RmmA, RmmArch, VirtualAddress}; +use crate::paging::{KernelMapper, PageFlags, PhysicalAddress, RmmA, RmmArch}; use self::madt::Madt; use self::rsdt::Rsdt; diff --git a/src/acpi/rxsdt.rs b/src/acpi/rxsdt.rs index 1f17d79..ffcb869 100644 --- a/src/acpi/rxsdt.rs +++ b/src/acpi/rxsdt.rs @@ -9,8 +9,6 @@ pub trait Rxsdt { fn iter(&self) -> Box>; fn map_all(&self) { - let iter = self.iter(); - let mut mapper = KernelMapper::lock(); for sdt in self.iter() { get_sdt(sdt, &mut mapper); diff --git a/src/arch/x86_64/debug.rs b/src/arch/x86_64/debug.rs index 70f79db..0906c89 100644 --- a/src/arch/x86_64/debug.rs +++ b/src/arch/x86_64/debug.rs @@ -14,7 +14,7 @@ use crate::syscall::io::Mmio; use crate::devices::uart_16550::SerialPort; #[cfg(feature = "graphical_debug")] -use super::graphical_debug::{DEBUG_DISPLAY, DebugDisplay}; +use crate::devices::graphical_debug::{DEBUG_DISPLAY, DebugDisplay}; #[cfg(feature = "lpss_debug")] use super::device::serial::LPSS; #[cfg(feature = "serial_debug")] diff --git a/src/arch/x86_64/graphical_debug/debug.rs b/src/arch/x86_64/graphical_debug/debug.rs deleted file mode 100644 index afa08dc..0000000 --- a/src/arch/x86_64/graphical_debug/debug.rs +++ /dev/null @@ -1,63 +0,0 @@ -use super::Display; - -pub struct DebugDisplay { - pub (crate) display: Display, - x: usize, - y: usize, - w: usize, - h: usize, -} - -impl DebugDisplay { - pub fn new(display: Display) -> DebugDisplay { - let w = display.width/8; - let h = display.height/16; - DebugDisplay { - display, - x: 0, - y: 0, - w: w, - h: h, - } - } - - pub fn write_char(&mut self, c: char) { - if self.x >= self.w || c == '\n' { - self.x = 0; - self.y += 1; - } - - if self.y >= self.h { - let new_y = self.h - 1; - let d_y = self.y - new_y; - - self.display.scroll(d_y * 16); - - unsafe { - self.display.sync(0, 0, self.display.width, self.display.height); - } - - self.y = new_y; - } - - if c != '\n' { - self.display.char( - self.x * 8, self.y * 16, - c, - 0xFFFFFF - ); - - unsafe { - self.display.sync(self.x * 8, self.y * 16, 8, 16); - } - - self.x += 1; - } - } - - pub fn write(&mut self, buf: &[u8]) { - for &b in buf { - self.write_char(b as char); - } - } -} diff --git a/src/arch/x86_64/graphical_debug/display.rs b/src/arch/x86_64/graphical_debug/display.rs deleted file mode 100644 index ab4a93e..0000000 --- a/src/arch/x86_64/graphical_debug/display.rs +++ /dev/null @@ -1,80 +0,0 @@ -use alloc::boxed::Box; -use core::{cmp, ptr, slice}; - -use super::FONT; - -/// A display -pub struct Display { - pub width: usize, - pub height: usize, - pub onscreen: &'static mut [u32], - pub offscreen: Option> -} - -impl Display { - pub fn new(width: usize, height: usize, onscreen_ptr: *mut u32) -> Display { - let size = width * height; - let onscreen = unsafe { - ptr::write_bytes(onscreen_ptr, 0, size); - slice::from_raw_parts_mut(onscreen_ptr, size) - }; - Display { - width, - height, - onscreen, - offscreen: None, - } - } - - pub fn data_mut(&mut self) -> &mut [u32] { - match &mut self.offscreen { - Some(offscreen) => offscreen, - None => self.onscreen, - } - } - - /// Draw a character - pub fn char(&mut self, x: usize, y: usize, character: char, color: u32) { - if x + 8 <= self.width && y + 16 <= self.height { - let mut dst = self.data_mut().as_mut_ptr() as usize + (y * self.width + x) * 4; - - let font_i = 16 * (character as usize); - if font_i + 16 <= FONT.len() { - for row in 0..16 { - let row_data = FONT[font_i + row]; - for col in 0..8 { - if (row_data >> (7 - col)) & 1 == 1 { - unsafe { *((dst + col * 4) as *mut u32) = color; } - } - } - dst += self.width * 4; - } - } - } - } - - /// Scroll the screen - pub fn scroll(&mut self, lines: usize) { - let offset = cmp::min(self.height, lines) * self.width; - let size = (self.width * self.height) - offset; - unsafe { - let ptr = self.data_mut().as_mut_ptr(); - ptr::copy(ptr.add(offset), ptr, size); - ptr::write_bytes(ptr.add(size), 0, offset); - } - } - - /// Sync from offscreen to onscreen, unsafe because it trusts provided x, y, w, h - pub unsafe fn sync(&mut self, x: usize, y: usize, w: usize, mut h: usize) { - if let Some(offscreen) = &self.offscreen { - let mut offset = y * self.width + x; - while h > 0 { - self.onscreen[offset..offset+w].copy_from_slice( - &offscreen[offset..offset+w] - ); - offset += self.width; - h -= 1; - } - } - } -} diff --git a/src/arch/x86_64/graphical_debug/mod.rs b/src/arch/x86_64/graphical_debug/mod.rs deleted file mode 100644 index 642d002..0000000 --- a/src/arch/x86_64/graphical_debug/mod.rs +++ /dev/null @@ -1,70 +0,0 @@ -use core::str; -use spin::Mutex; - -pub use self::debug::DebugDisplay; -use self::display::Display; - -pub mod debug; -pub mod display; - -pub static FONT: &'static [u8] = include_bytes!("../../../../res/unifont.font"); - -pub static DEBUG_DISPLAY: Mutex> = Mutex::new(None); - -pub fn init(env: &[u8]) { - println!("Starting graphical debug"); - - let mut width = 0; - let mut height = 0; - let mut physbaseptr = 0; - - //TODO: should errors be reported? - for line in str::from_utf8(env).unwrap_or("").lines() { - let mut parts = line.splitn(2, '='); - let name = parts.next().unwrap_or(""); - let value = parts.next().unwrap_or(""); - - if name == "FRAMEBUFFER_ADDR" { - physbaseptr = usize::from_str_radix(value, 16).unwrap_or(0); - } - - if name == "FRAMEBUFFER_WIDTH" { - width = usize::from_str_radix(value, 16).unwrap_or(0); - } - - if name == "FRAMEBUFFER_HEIGHT" { - height = usize::from_str_radix(value, 16).unwrap_or(0); - } - } - - if physbaseptr == 0 || width == 0 || height == 0 { - println!("Framebuffer not found"); - return; - } - - println!("Framebuffer {}x{} at {:X}", width, height, physbaseptr); - - { - let size = width * height * 4; - - let virtbaseptr = physbaseptr + crate::PHYS_OFFSET; - - let display = Display::new(width, height, virtbaseptr as *mut u32); - let debug_display = DebugDisplay::new(display); - *DEBUG_DISPLAY.lock() = Some(debug_display); - } -} - -pub fn init_heap() { - if let Some(debug_display) = &mut *DEBUG_DISPLAY.lock() { - debug_display.display.offscreen = Some( - debug_display.display.onscreen.to_vec().into_boxed_slice() - ); - } -} - -pub fn fini() { - DEBUG_DISPLAY.lock().take(); - - println!("Finished graphical debug"); -} diff --git a/src/arch/x86_64/idt.rs b/src/arch/x86_64/idt.rs index 4a71269..3e74885 100644 --- a/src/arch/x86_64/idt.rs +++ b/src/arch/x86_64/idt.rs @@ -247,7 +247,7 @@ pub unsafe fn init_generic(is_bsp: bool, idt: &mut Idt) { current_idt[49].set_func(irq::lapic_error); // reserve bit 49 - *current_reservations[0].get_mut() |= (1 << 49); + *current_reservations[0].get_mut() |= 1 << 49; } use_default_irqs!(current_idt); diff --git a/src/arch/x86_64/interrupt/syscall.rs b/src/arch/x86_64/interrupt/syscall.rs index 803a6d8..eadd57a 100644 --- a/src/arch/x86_64/interrupt/syscall.rs +++ b/src/arch/x86_64/interrupt/syscall.rs @@ -50,12 +50,8 @@ macro_rules! with_interrupt_stack { pub unsafe extern "C" fn __inner_syscall_instruction(stack: *mut InterruptStack) { let _guard = ptrace::set_process_regs(stack); with_interrupt_stack!(|stack| { - // Set a restore point for clone - let rbp; - core::arch::asm!("mov {}, rbp", out(reg) rbp); - let scratch = &stack.scratch; - syscall::syscall(scratch.rax, scratch.rdi, scratch.rsi, scratch.rdx, scratch.r10, scratch.r8, rbp, stack) + syscall::syscall(scratch.rax, scratch.rdi, scratch.rsi, scratch.rdx, scratch.r10, scratch.r8, stack) }); } @@ -152,11 +148,7 @@ interrupt_stack!(syscall, |stack| { } } - // Set a restore point for clone - let rbp; - core::arch::asm!("mov {}, rbp", out(reg) rbp); - let scratch = &stack.scratch; - syscall::syscall(scratch.rax, stack.preserved.rbx, scratch.rcx, scratch.rdx, scratch.rsi, scratch.rdi, rbp, stack) + syscall::syscall(scratch.rax, stack.preserved.rbx, scratch.rcx, scratch.rdx, scratch.rsi, scratch.rdi, stack) }) }); diff --git a/src/arch/x86_64/interrupt/trace.rs b/src/arch/x86_64/interrupt/trace.rs index ecff30e..31c6812 100644 --- a/src/arch/x86_64/interrupt/trace.rs +++ b/src/arch/x86_64/interrupt/trace.rs @@ -3,7 +3,7 @@ use core::{mem, str}; use goblin::elf::sym; use rustc_demangle::demangle; -use crate::{context, paging::{KernelMapper, VirtualAddress}}; +use crate::{paging::{KernelMapper, VirtualAddress}}; /// Get a stack trace //TODO: Check for stack being mapped before dereferencing diff --git a/src/arch/x86_64/mod.rs b/src/arch/x86_64/mod.rs index 0811d26..5846973 100644 --- a/src/arch/x86_64/mod.rs +++ b/src/arch/x86_64/mod.rs @@ -13,10 +13,6 @@ pub mod device; /// Global descriptor table pub mod gdt; -/// Graphical debug -#[cfg(feature = "graphical_debug")] -mod graphical_debug; - /// Interrupt instructions #[macro_use] pub mod interrupt; diff --git a/src/arch/x86_64/rmm.rs b/src/arch/x86_64/rmm.rs index 5fc741a..d158b79 100644 --- a/src/arch/x86_64/rmm.rs +++ b/src/arch/x86_64/rmm.rs @@ -21,7 +21,7 @@ use rmm::{ X8664Arch as RmmA, }; -use spin::{Mutex, MutexGuard}; +use spin::Mutex; extern "C" { /// The starting byte of the text (code) data segment. @@ -163,7 +163,7 @@ unsafe fn inner( // Ensure graphical debug region remains paged #[cfg(feature = "graphical_debug")] { - use super::graphical_debug::DEBUG_DISPLAY; + use crate::devices::graphical_debug::DEBUG_DISPLAY; use super::paging::entry::EntryFlags; let (base, size) = if let Some(debug_display) = &*DEBUG_DISPLAY.lock() { diff --git a/src/arch/x86_64/start.rs b/src/arch/x86_64/start.rs index b8acccd..8394617 100644 --- a/src/arch/x86_64/start.rs +++ b/src/arch/x86_64/start.rs @@ -9,11 +9,11 @@ use core::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use crate::allocator; #[cfg(feature = "acpi")] use crate::acpi; -#[cfg(feature = "graphical_debug")] -use crate::arch::x86_64::graphical_debug; -use crate::arch::x86_64::pti; -use crate::arch::x86_64::flags::*; +use crate::arch::pti; +use crate::arch::flags::*; use crate::device; +#[cfg(feature = "graphical_debug")] +use crate::devices::graphical_debug; use crate::gdt; use crate::idt; use crate::interrupt; diff --git a/src/context/context.rs b/src/context/context.rs index b9bc233..182c6b1 100644 --- a/src/context/context.rs +++ b/src/context/context.rs @@ -220,7 +220,7 @@ pub struct Context { /// The architecture specific context pub arch: arch::Context, /// Kernel FX - used to store SIMD and FPU registers on context switch - pub kfx: AlignedBox<[u8; {arch::KFX_SIZE}], {arch::KFX_ALIGN}>, + pub kfx: AlignedBox<[u8; arch::KFX_SIZE], {arch::KFX_ALIGN}>, /// Kernel stack pub kstack: Option>, /// Kernel signal backup: Registers, Kernel FX, Kernel Stack, Signal number @@ -335,7 +335,7 @@ impl Context { let syscall_head = AlignedBox::try_zeroed()?; let syscall_tail = AlignedBox::try_zeroed()?; - let mut this = Context { + let this = Context { id, pgid: id, ppid: ContextId::from(0), diff --git a/src/context/memory.rs b/src/context/memory.rs index 967bf26..7c8fafe 100644 --- a/src/context/memory.rs +++ b/src/context/memory.rs @@ -15,7 +15,7 @@ use crate::arch::paging::PAGE_SIZE; use crate::context::file::FileDescriptor; use crate::memory::{Enomem, Frame}; use crate::paging::mapper::{Flusher, InactiveFlusher, PageFlushAll}; -use crate::paging::{KernelMapper, Page, PageFlags, PageIter, PageMapper, PhysicalAddress, RmmA, round_up_pages, VirtualAddress}; +use crate::paging::{KernelMapper, Page, PageFlags, PageIter, PageMapper, RmmA, round_up_pages, VirtualAddress}; pub const MMAP_MIN_DEFAULT: usize = PAGE_SIZE; @@ -123,7 +123,7 @@ impl AddrSpace { inactive = InactiveFlusher::new(); &mut inactive as &mut dyn Flusher }; - let mut mapper = &mut self.table.utable; + let mapper = &mut self.table.utable; let region = Region::new(base.start_address(), page_count * PAGE_SIZE); @@ -375,7 +375,7 @@ impl UserGrants { holes.insert(grant.start_address(), grant.size() + exactly_after_size.unwrap_or(0)); } } - pub fn insert(&mut self, mut grant: Grant) { + pub fn insert(&mut self, grant: Grant) { assert!(self.conflicts(*grant).next().is_none()); self.reserve(&grant); @@ -900,13 +900,13 @@ impl Drop for Table { /// Allocates a new identically mapped ktable and empty utable (same memory on x86_64). pub fn setup_new_utable() -> Result { - let mut utable = unsafe { PageMapper::create(crate::rmm::FRAME_ALLOCATOR).ok_or(Error::new(ENOMEM))? }; + let utable = unsafe { PageMapper::create(crate::rmm::FRAME_ALLOCATOR).ok_or(Error::new(ENOMEM))? }; #[cfg(target_arch = "x86_64")] { let active_ktable = KernelMapper::lock(); - let mut copy_mapping = |p4_no| unsafe { + let copy_mapping = |p4_no| unsafe { let entry = active_ktable.table().entry(p4_no) .unwrap_or_else(|| panic!("expected kernel PML {} to be mapped", p4_no)); diff --git a/src/debugger.rs b/src/debugger.rs index aa99dbe..030babd 100644 --- a/src/debugger.rs +++ b/src/debugger.rs @@ -54,7 +54,7 @@ pub unsafe fn debugger(target_id: Option) { let mut rsp = regs.iret.rsp; println!("stack: {:>016x}", rsp); //Maximum 64 qwords - for i in 0..64 { + for _ in 0..64 { if context.addr_space.as_ref().map_or(false, |space| space.read().table.utable.translate(crate::paging::VirtualAddress::new(rsp)).is_some()) { let value = *(rsp as *const usize); println!(" {:>016x}: {:>016x}", rsp, value); @@ -132,7 +132,7 @@ pub unsafe fn check_consistency(addr_space: &mut crate::context::memory::AddrSpa for grant in addr_space.grants.iter() { for page in grant.pages() { - let entry = match addr_space.table.utable.translate(page.start_address()) { + let _entry = match addr_space.table.utable.translate(page.start_address()) { Some(e) => e, None => { log::error!("GRANT AT {:?} LACKING MAPPING AT PAGE {:p}", grant.region(), page.start_address().data() as *const u8); diff --git a/src/devices/mod.rs b/src/devices/mod.rs index 0fb7194..1b05f81 100644 --- a/src/devices/mod.rs +++ b/src/devices/mod.rs @@ -1 +1,3 @@ +#[cfg(feature = "graphical_debug")] +pub mod graphical_debug; pub mod uart_16550; diff --git a/src/lib.rs b/src/lib.rs index 72247b5..a776b57 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -78,7 +78,7 @@ extern crate slab_allocator; use core::sync::atomic::{AtomicUsize, Ordering}; -use crate::scheme::{FileHandle, SchemeNamespace}; +use crate::scheme::SchemeNamespace; pub use crate::consts::*; diff --git a/src/scheme/memory.rs b/src/scheme/memory.rs index 603ece5..f8b0fa7 100644 --- a/src/scheme/memory.rs +++ b/src/scheme/memory.rs @@ -2,13 +2,11 @@ use alloc::sync::Arc; use spin::RwLock; use crate::context; -use crate::context::memory::{AddrSpace, page_flags, Grant}; +use crate::context::memory::{AddrSpace, Grant}; use crate::memory::{free_frames, used_frames, PAGE_SIZE}; -use crate::paging::{mapper::PageFlushAll, Page, VirtualAddress}; use crate::syscall::data::{Map, StatVfs}; use crate::syscall::error::*; -use crate::syscall::flag::MapFlags; use crate::syscall::scheme::Scheme; pub struct MemoryScheme; diff --git a/src/scheme/proc.rs b/src/scheme/proc.rs index 3c06996..59eeb84 100644 --- a/src/scheme/proc.rs +++ b/src/scheme/proc.rs @@ -1,5 +1,5 @@ use crate::{ - arch::paging::{Flusher, mapper::{InactiveFlusher, PageFlushAll}, Page, RmmA, VirtualAddress}, + arch::paging::{mapper::InactiveFlusher, Page, VirtualAddress}, context::{self, Context, ContextId, Status, file::{FileDescription, FileDescriptor}, memory::{AddrSpace, Grant, new_addrspace, map_flags, page_flags, Region}}, memory::PAGE_SIZE, ptrace, @@ -970,7 +970,7 @@ impl Scheme for ProcScheme { let filetable_fd = usize::from_ne_bytes(<[u8; mem::size_of::()]>::try_from(buf).map_err(|_| Error::new(EINVAL))?); let (hopefully_this_scheme, number) = extract_scheme_number(filetable_fd)?; - let mut filetable = hopefully_this_scheme.as_filetable(number)?; + let filetable = hopefully_this_scheme.as_filetable(number)?; self.handles.write().get_mut(&id).ok_or(Error::new(EBADF))?.info.operation = Operation::AwaitingFiletableChange(filetable); diff --git a/src/scheme/user.rs b/src/scheme/user.rs index 3bf224c..787df3a 100644 --- a/src/scheme/user.rs +++ b/src/scheme/user.rs @@ -8,7 +8,7 @@ use spin::{Mutex, RwLock}; use crate::context::{self, Context}; use crate::context::file::FileDescriptor; -use crate::context::memory::{AddrSpace, DANGLING, page_flags, Grant, Region, GrantFileRef}; +use crate::context::memory::{AddrSpace, DANGLING, Grant, Region, GrantFileRef}; use crate::event; use crate::paging::{PAGE_SIZE, mapper::InactiveFlusher, Page, round_down_pages, round_up_pages, VirtualAddress}; use crate::scheme::{AtomicSchemeId, SchemeId}; diff --git a/src/syscall/driver.rs b/src/syscall/driver.rs index d586d68..bc350b8 100644 --- a/src/syscall/driver.rs +++ b/src/syscall/driver.rs @@ -1,9 +1,9 @@ use crate::interrupt::InterruptStack; use crate::memory::{allocate_frames_complex, deallocate_frames, Frame, PAGE_SIZE}; -use crate::paging::{Page, PageFlags, PhysicalAddress, VirtualAddress, mapper::PageFlushAll}; +use crate::paging::{PageFlags, PhysicalAddress, VirtualAddress, mapper::PageFlushAll}; use crate::paging::entry::EntryFlags; use crate::context; -use crate::context::memory::{DANGLING, Grant, Region}; +use crate::context::memory::{Grant, Region}; use crate::syscall::error::{Error, EFAULT, EINVAL, ENOMEM, EPERM, ESRCH, Result}; use crate::syscall::flag::{PhysallocFlags, PartialAllocStrategy, PhysmapFlags, PHYSMAP_WRITE, PHYSMAP_WRITE_COMBINE, PHYSMAP_NO_CACHE}; diff --git a/src/syscall/futex.rs b/src/syscall/futex.rs index b3fde4b..5838ec3 100644 --- a/src/syscall/futex.rs +++ b/src/syscall/futex.rs @@ -46,7 +46,7 @@ pub fn futexes_mut() -> RwLockWriteGuard<'static, FutexList> { pub fn futex(addr: usize, op: usize, val: usize, val2: usize, addr2: usize) -> Result { let addr_space = Arc::clone(context::current()?.read().addr_space()?); - let (target_physaddr, _) = unsafe { + let (target_physaddr, _) = { let virtual_address = VirtualAddress::new(addr); if !crate::CurrentRmmArch::virt_is_valid(virtual_address) { diff --git a/src/syscall/mod.rs b/src/syscall/mod.rs index 613bb00..f6bf8a4 100644 --- a/src/syscall/mod.rs +++ b/src/syscall/mod.rs @@ -28,7 +28,7 @@ pub use self::validate::*; use self::scheme::Scheme as _; use self::data::{Map, SigAction, Stat, TimeSpec}; -use self::error::{Error, Result, ENOSYS, EINVAL}; +use self::error::{Error, Result, ENOSYS}; use self::flag::{MapFlags, PhysmapFlags, WaitFlags}; use self::number::*; @@ -62,9 +62,9 @@ pub mod validate; /// This function is the syscall handler of the kernel, it is composed of an inner function that returns a `Result`. After the inner function runs, the syscall /// function calls [`Error::mux`] on it. -pub fn syscall(a: usize, b: usize, c: usize, d: usize, e: usize, f: usize, bp: usize, stack: &mut InterruptStack) -> usize { +pub fn syscall(a: usize, b: usize, c: usize, d: usize, e: usize, f: usize, stack: &mut InterruptStack) -> usize { #[inline(always)] - fn inner(a: usize, b: usize, c: usize, d: usize, e: usize, f: usize, bp: usize, stack: &mut InterruptStack) -> Result { + fn inner(a: usize, b: usize, c: usize, d: usize, e: usize, f: usize, stack: &mut InterruptStack) -> Result { //SYS_* is declared in kernel/syscall/src/number.rs match a & SYS_CLASS { SYS_CLASS_FILE => { @@ -217,7 +217,7 @@ pub fn syscall(a: usize, b: usize, c: usize, d: usize, e: usize, f: usize, bp: u } } - let result = inner(a, b, c, d, e, f, bp, stack); + let result = inner(a, b, c, d, e, f, stack); { let contexts = crate::context::contexts(); diff --git a/src/syscall/process.rs b/src/syscall/process.rs index e91cb5c..9ae211e 100644 --- a/src/syscall/process.rs +++ b/src/syscall/process.rs @@ -11,13 +11,13 @@ use crate::context::{Context, ContextId, memory::AddrSpace, WaitpidKey}; use crate::Bootstrap; use crate::context; use crate::interrupt; -use crate::paging::mapper::{Flusher, InactiveFlusher, PageFlushAll}; +use crate::paging::mapper::{InactiveFlusher, PageFlushAll}; use crate::paging::{Page, PageFlags, VirtualAddress, PAGE_SIZE}; use crate::ptrace; use crate::start::usermode; use crate::syscall::data::SigAction; use crate::syscall::error::*; -use crate::syscall::flag::{wifcontinued, wifstopped, MapFlags, PROT_EXEC, PROT_READ, PROT_WRITE, +use crate::syscall::flag::{wifcontinued, wifstopped, MapFlags, PTRACE_STOP_EXIT, SIG_BLOCK, SIG_SETMASK, SIG_UNBLOCK, SIGCONT, SIGTERM, WaitFlags, WCONTINUED, WNOHANG, WUNTRACED}; use crate::syscall::ptrace_event;