Make graphical_debug arch independent and fix lots of warnings
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -9,8 +9,6 @@ pub trait Rxsdt {
|
||||
fn iter(&self) -> Box<dyn Iterator<Item = usize>>;
|
||||
|
||||
fn map_all(&self) {
|
||||
let iter = self.iter();
|
||||
|
||||
let mut mapper = KernelMapper::lock();
|
||||
for sdt in self.iter() {
|
||||
get_sdt(sdt, &mut mapper);
|
||||
|
||||
@@ -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")]
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<Box<[u32]>>
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<Option<DebugDisplay>> = 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");
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<A: Arch>(
|
||||
// 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() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<Box<[u8]>>,
|
||||
/// 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),
|
||||
|
||||
@@ -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<RmmA>
|
||||
};
|
||||
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<Table> {
|
||||
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));
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ pub unsafe fn debugger(target_id: Option<crate::context::ContextId>) {
|
||||
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);
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
#[cfg(feature = "graphical_debug")]
|
||||
pub mod graphical_debug;
|
||||
pub mod uart_16550;
|
||||
|
||||
@@ -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::*;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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::<usize>()]>::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);
|
||||
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -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};
|
||||
|
||||
|
||||
@@ -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<usize> {
|
||||
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) {
|
||||
|
||||
@@ -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<usize>`. 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<usize> {
|
||||
fn inner(a: usize, b: usize, c: usize, d: usize, e: usize, f: usize, stack: &mut InterruptStack) -> Result<usize> {
|
||||
//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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user