mirror of
https://github.com/rcore-os/rCore.git
synced 2024-11-23 08:26:17 +04:00
Remove unused import
This commit is contained in:
parent
c1907b6772
commit
a6cd153fca
@ -1,6 +1,5 @@
|
|||||||
use crate::drivers::bus::pci;
|
use crate::drivers::bus::pci;
|
||||||
use crate::drivers::gpu::fb::{self, FramebufferInfo};
|
use crate::drivers::gpu::fb::{self, FramebufferInfo};
|
||||||
use alloc::string::String;
|
|
||||||
use mips::registers::cp0;
|
use mips::registers::cp0;
|
||||||
|
|
||||||
pub mod consts;
|
pub mod consts;
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
pub use self::context::*;
|
pub use self::context::*;
|
||||||
use crate::arch::paging::get_root_page_table_ptr;
|
use crate::arch::paging::get_root_page_table_ptr;
|
||||||
use crate::drivers::{DRIVERS, IRQ_MANAGER};
|
use crate::drivers::IRQ_MANAGER;
|
||||||
use log::*;
|
use log::*;
|
||||||
use mips::addr::*;
|
use mips::addr::*;
|
||||||
use mips::interrupts;
|
use mips::interrupts;
|
||||||
use mips::paging::{
|
use mips::paging::PageTable as MIPSPageTable;
|
||||||
PageTable as MIPSPageTable, PageTableEntry, PageTableFlags as EF, TwoLevelPageTable,
|
|
||||||
};
|
|
||||||
use mips::registers::cp0;
|
use mips::registers::cp0;
|
||||||
use mips::tlb;
|
use mips::tlb;
|
||||||
|
|
||||||
@ -154,7 +152,7 @@ fn syscall(tf: &mut TrapFrame) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// temporary solution for ThinPad
|
// temporary solution for ThinPad
|
||||||
if (tf.v0 == 0) {
|
if tf.v0 == 0 {
|
||||||
warn!("Syscall ID = 0");
|
warn!("Syscall ID = 0");
|
||||||
tf.v0 = unsafe { *((tf.sp + 28) as *const usize) };
|
tf.v0 = unsafe { *((tf.sp + 28) as *const usize) };
|
||||||
}
|
}
|
||||||
@ -162,7 +160,7 @@ fn syscall(tf: &mut TrapFrame) {
|
|||||||
let ret = crate::syscall::syscall(tf.v0, arguments, tf) as isize;
|
let ret = crate::syscall::syscall(tf.v0, arguments, tf) as isize;
|
||||||
// comply with mips n32 abi, always return a positive value
|
// comply with mips n32 abi, always return a positive value
|
||||||
// https://git.musl-libc.org/cgit/musl/tree/arch/mipsn32/syscall_arch.h
|
// https://git.musl-libc.org/cgit/musl/tree/arch/mipsn32/syscall_arch.h
|
||||||
if (ret < 0) {
|
if ret < 0 {
|
||||||
tf.v0 = (-ret) as usize;
|
tf.v0 = (-ret) as usize;
|
||||||
tf.a3 = 1;
|
tf.a3 = 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
use crate::arch::paging::*;
|
use crate::arch::paging::*;
|
||||||
use crate::consts::{KERNEL_OFFSET, MEMORY_END, MEMORY_OFFSET};
|
use crate::consts::{KERNEL_OFFSET, MEMORY_END, MEMORY_OFFSET};
|
||||||
use crate::memory::{init_heap, Linear, MemoryAttr, MemorySet, FRAME_ALLOCATOR};
|
use crate::memory::{init_heap, FRAME_ALLOCATOR};
|
||||||
use core::mem;
|
|
||||||
use log::*;
|
|
||||||
use rcore_memory::PAGE_SIZE;
|
use rcore_memory::PAGE_SIZE;
|
||||||
|
|
||||||
/// Initialize the memory management module
|
/// Initialize the memory management module
|
||||||
|
@ -9,7 +9,6 @@ pub mod rand;
|
|||||||
pub mod syscall;
|
pub mod syscall;
|
||||||
pub mod timer;
|
pub mod timer;
|
||||||
|
|
||||||
use log::*;
|
|
||||||
use mips::registers::cp0;
|
use mips::registers::cp0;
|
||||||
|
|
||||||
#[cfg(feature = "board_malta")]
|
#[cfg(feature = "board_malta")]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
pub use self::context::*;
|
pub use self::context::*;
|
||||||
use crate::drivers::{DRIVERS, IRQ_MANAGER};
|
use crate::drivers::IRQ_MANAGER;
|
||||||
use log::*;
|
use log::*;
|
||||||
use riscv::register::*;
|
use riscv::register::*;
|
||||||
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
use crate::consts::{KERNEL_OFFSET, MEMORY_END, MEMORY_OFFSET, PHYSICAL_MEMORY_OFFSET};
|
use crate::consts::{KERNEL_OFFSET, MEMORY_END, MEMORY_OFFSET};
|
||||||
use crate::memory::{init_heap, Linear, MemoryAttr, MemorySet, FRAME_ALLOCATOR};
|
use crate::memory::{init_heap, MemorySet, FRAME_ALLOCATOR};
|
||||||
use core::mem;
|
use core::mem;
|
||||||
use log::*;
|
use log::*;
|
||||||
use rcore_memory::PAGE_SIZE;
|
use rcore_memory::PAGE_SIZE;
|
||||||
use riscv::register::satp;
|
use riscv::register::sstatus;
|
||||||
use riscv::{addr::*, register::sstatus};
|
|
||||||
|
|
||||||
/// Initialize the memory management module
|
/// Initialize the memory management module
|
||||||
pub fn init(dtb: usize) {
|
pub fn init(dtb: usize) {
|
||||||
|
@ -22,7 +22,6 @@ pub mod timer;
|
|||||||
|
|
||||||
use crate::memory::phys_to_virt;
|
use crate::memory::phys_to_virt;
|
||||||
use core::sync::atomic::{AtomicBool, Ordering};
|
use core::sync::atomic::{AtomicBool, Ordering};
|
||||||
use log::*;
|
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn rust_main(hartid: usize, device_tree_paddr: usize) -> ! {
|
pub extern "C" fn rust_main(hartid: usize, device_tree_paddr: usize) -> ! {
|
||||||
@ -88,7 +87,7 @@ const BOOT_HART_ID: usize = 0;
|
|||||||
#[cfg(feature = "board_u540")]
|
#[cfg(feature = "board_u540")]
|
||||||
const BOOT_HART_ID: usize = 1;
|
const BOOT_HART_ID: usize = 1;
|
||||||
|
|
||||||
/// Constant & Macro for `trap.asm`
|
// Constant & Macro for `trap.asm`
|
||||||
#[cfg(target_arch = "riscv32")]
|
#[cfg(target_arch = "riscv32")]
|
||||||
global_asm!(
|
global_asm!(
|
||||||
r"
|
r"
|
||||||
|
@ -6,11 +6,7 @@ use rcore_memory::paging::*;
|
|||||||
use riscv::addr::*;
|
use riscv::addr::*;
|
||||||
use riscv::asm::{sfence_vma, sfence_vma_all};
|
use riscv::asm::{sfence_vma, sfence_vma_all};
|
||||||
use riscv::paging::{FrameAllocator, FrameDeallocator};
|
use riscv::paging::{FrameAllocator, FrameDeallocator};
|
||||||
use riscv::paging::{
|
use riscv::paging::{Mapper, PageTable as RvPageTable, PageTableEntry, PageTableFlags as EF};
|
||||||
Mapper, PageTable as RvPageTable, PageTableEntry, PageTableFlags as EF, PageTableType,
|
|
||||||
RecursivePageTable,
|
|
||||||
};
|
|
||||||
use riscv::register::satp;
|
|
||||||
|
|
||||||
#[cfg(target_arch = "riscv32")]
|
#[cfg(target_arch = "riscv32")]
|
||||||
type TopLevelPageTable<'a> = riscv::paging::Rv32PageTable<'a>;
|
type TopLevelPageTable<'a> = riscv::paging::Rv32PageTable<'a>;
|
||||||
@ -199,7 +195,7 @@ impl PageTableExt for PageTableImpl {
|
|||||||
}
|
}
|
||||||
#[cfg(target_arch = "riscv64")]
|
#[cfg(target_arch = "riscv64")]
|
||||||
for i in 509..512 {
|
for i in 509..512 {
|
||||||
if (i == 510) {
|
if i == 510 {
|
||||||
// MMIO range 0x60000000 - 0x7FFFFFFF does not work as a large page, dunno why
|
// MMIO range 0x60000000 - 0x7FFFFFFF does not work as a large page, dunno why
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
use crate::consts::KERNEL_OFFSET;
|
|
||||||
use crate::drivers::gpu::fb::{self, ColorDepth, ColorFormat, FramebufferInfo};
|
use crate::drivers::gpu::fb::{self, ColorDepth, ColorFormat, FramebufferInfo};
|
||||||
use crate::memory::phys_to_virt;
|
use crate::memory::phys_to_virt;
|
||||||
use core::mem::zeroed;
|
|
||||||
use rboot::BootInfo;
|
use rboot::BootInfo;
|
||||||
|
|
||||||
pub fn init_driver(boot_info: &BootInfo) {
|
pub fn init_driver(boot_info: &BootInfo) {
|
||||||
@ -17,7 +15,7 @@ pub fn init_driver(boot_info: &BootInfo) {
|
|||||||
xoffset: 0,
|
xoffset: 0,
|
||||||
yoffset: 0,
|
yoffset: 0,
|
||||||
depth: ColorDepth::ColorDepth32,
|
depth: ColorDepth::ColorDepth32,
|
||||||
format: fb::ColorFormat::RGBA8888,
|
format: ColorFormat::RGBA8888,
|
||||||
paddr: info.fb_addr as usize,
|
paddr: info.fb_addr as usize,
|
||||||
vaddr: phys_to_virt(info.fb_addr as usize),
|
vaddr: phys_to_virt(info.fb_addr as usize),
|
||||||
screen_size: info.fb_size as usize,
|
screen_size: info.fb_size as usize,
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
|
|
||||||
use super::consts::*;
|
use super::consts::*;
|
||||||
use super::TrapFrame;
|
use super::TrapFrame;
|
||||||
use crate::drivers::{DRIVERS, IRQ_MANAGER};
|
use crate::drivers::IRQ_MANAGER;
|
||||||
use bitflags::*;
|
use bitflags::*;
|
||||||
use log::*;
|
use log::*;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use core::mem::size_of;
|
use core::mem::size_of;
|
||||||
use rcore_memory::PAGE_SIZE;
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
fn stext();
|
fn stext();
|
||||||
@ -165,6 +164,7 @@ pub fn backtrace() {
|
|||||||
// Kernel stack at 0x0000_57ac_0000_0000 (defined in bootloader crate)
|
// Kernel stack at 0x0000_57ac_0000_0000 (defined in bootloader crate)
|
||||||
// size = 512 pages
|
// size = 512 pages
|
||||||
current_fp = *(current_fp as *const usize).offset(0);
|
current_fp = *(current_fp as *const usize).offset(0);
|
||||||
|
use rcore_memory::PAGE_SIZE;
|
||||||
if current_fp >= 0x0000_57ac_0000_0000 + 512 * PAGE_SIZE - size_of::<usize>()
|
if current_fp >= 0x0000_57ac_0000_0000 + 512 * PAGE_SIZE - size_of::<usize>()
|
||||||
&& current_fp <= 0xffff_ff00_0000_0000
|
&& current_fp <= 0xffff_ff00_0000_0000
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
use alloc::sync::Arc;
|
use alloc::sync::Arc;
|
||||||
|
|
||||||
use log::*;
|
|
||||||
use virtio_drivers::{VirtIOBlk, VirtIOHeader};
|
use virtio_drivers::{VirtIOBlk, VirtIOHeader};
|
||||||
|
|
||||||
use super::super::{DeviceType, Driver, BLK_DRIVERS, DRIVERS, IRQ_MANAGER};
|
use super::super::{DeviceType, Driver, BLK_DRIVERS, DRIVERS, IRQ_MANAGER};
|
||||||
use crate::memory::phys_to_virt;
|
|
||||||
use crate::sync::SpinNoIrqLock as Mutex;
|
use crate::sync::SpinNoIrqLock as Mutex;
|
||||||
|
|
||||||
struct VirtIOBlkDriver(Mutex<VirtIOBlk<'static>>);
|
struct VirtIOBlkDriver(Mutex<VirtIOBlk<'static>>);
|
||||||
|
@ -8,7 +8,7 @@ use super::super::block::virtio_blk;
|
|||||||
use super::super::gpu::virtio_gpu;
|
use super::super::gpu::virtio_gpu;
|
||||||
use super::super::input::virtio_input;
|
use super::super::input::virtio_input;
|
||||||
use super::super::net::virtio_net;
|
use super::super::net::virtio_net;
|
||||||
use crate::memory::{phys_to_virt, virt_to_phys};
|
use crate::memory::phys_to_virt;
|
||||||
|
|
||||||
pub fn virtio_probe(node: &Node) {
|
pub fn virtio_probe(node: &Node) {
|
||||||
let reg = match node.prop_raw("reg") {
|
let reg = match node.prop_raw("reg") {
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use lazy_static::lazy_static;
|
|
||||||
use log::*;
|
use log::*;
|
||||||
use spin::Mutex;
|
use spin::Mutex;
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
use alloc::sync::Arc;
|
use alloc::sync::Arc;
|
||||||
|
|
||||||
use log::*;
|
|
||||||
use virtio_drivers::{VirtIOGpu, VirtIOHeader};
|
use virtio_drivers::{VirtIOGpu, VirtIOHeader};
|
||||||
|
|
||||||
use super::super::{DeviceType, Driver, DRIVERS, IRQ_MANAGER};
|
use super::super::{DeviceType, Driver, DRIVERS, IRQ_MANAGER};
|
||||||
|
@ -2,7 +2,6 @@ use alloc::format;
|
|||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
use alloc::sync::Arc;
|
use alloc::sync::Arc;
|
||||||
|
|
||||||
use log::*;
|
|
||||||
use smoltcp::phy::{self, DeviceCapabilities};
|
use smoltcp::phy::{self, DeviceCapabilities};
|
||||||
use smoltcp::time::Instant;
|
use smoltcp::time::Instant;
|
||||||
use smoltcp::wire::{EthernetAddress, Ipv4Address};
|
use smoltcp::wire::{EthernetAddress, Ipv4Address};
|
||||||
@ -10,7 +9,6 @@ use smoltcp::Result;
|
|||||||
use virtio_drivers::{VirtIOHeader, VirtIONet};
|
use virtio_drivers::{VirtIOHeader, VirtIONet};
|
||||||
|
|
||||||
use super::super::{DeviceType, Driver, DRIVERS, IRQ_MANAGER, NET_DRIVERS};
|
use super::super::{DeviceType, Driver, DRIVERS, IRQ_MANAGER, NET_DRIVERS};
|
||||||
use crate::memory::phys_to_virt;
|
|
||||||
use crate::sync::SpinNoIrqLock as Mutex;
|
use crate::sync::SpinNoIrqLock as Mutex;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -8,6 +8,7 @@ use crate::arch::driver::ide;
|
|||||||
|
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
use crate::arch::board::emmc;
|
use crate::arch::board::emmc;
|
||||||
|
#[cfg(target_arch = "aarch64")]
|
||||||
use crate::sync::SpinNoIrqLock as Mutex;
|
use crate::sync::SpinNoIrqLock as Mutex;
|
||||||
|
|
||||||
pub struct MemBuf(RwLock<&'static mut [u8]>);
|
pub struct MemBuf(RwLock<&'static mut [u8]>);
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
use crate::fs::FileLike;
|
use crate::fs::FileLike;
|
||||||
use crate::memory::MemorySet;
|
|
||||||
use crate::process::Process;
|
use crate::process::Process;
|
||||||
use crate::sync::{Condvar, SpinNoIrqLock};
|
use crate::sync::SpinNoIrqLock;
|
||||||
use crate::syscall::{SysError, SysResult};
|
use crate::syscall::{SysError, SysResult};
|
||||||
use alloc::{collections::BTreeMap, collections::BTreeSet};
|
use alloc::{collections::BTreeMap, collections::BTreeSet};
|
||||||
use core::mem::size_of;
|
|
||||||
use core::slice;
|
|
||||||
|
|
||||||
pub struct EpollInstance {
|
pub struct EpollInstance {
|
||||||
pub events: BTreeMap<usize, EpollEvent>,
|
pub events: BTreeMap<usize, EpollEvent>,
|
||||||
@ -29,7 +26,7 @@ impl EpollInstance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn control(&mut self, op: usize, fd: usize, event: &EpollEvent) -> SysResult {
|
pub fn control(&mut self, op: usize, fd: usize, event: &EpollEvent) -> SysResult {
|
||||||
match (op as i32) {
|
match op as i32 {
|
||||||
EPollCtlOp::ADD => {
|
EPollCtlOp::ADD => {
|
||||||
self.events.insert(fd, event.clone());
|
self.events.insert(fd, event.clone());
|
||||||
self.newCtlList.lock().insert(fd);
|
self.newCtlList.lock().insert(fd);
|
||||||
|
@ -4,10 +4,8 @@ use super::ioctl::*;
|
|||||||
use super::FileHandle;
|
use super::FileHandle;
|
||||||
use crate::fs::epoll::EpollInstance;
|
use crate::fs::epoll::EpollInstance;
|
||||||
use crate::net::Socket;
|
use crate::net::Socket;
|
||||||
use crate::sync::Condvar;
|
|
||||||
use crate::syscall::{SysError, SysResult};
|
use crate::syscall::{SysError, SysResult};
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
use alloc::vec::Vec;
|
|
||||||
use rcore_fs::vfs::PollStatus;
|
use rcore_fs::vfs::PollStatus;
|
||||||
|
|
||||||
// TODO: merge FileLike to FileHandle ?
|
// TODO: merge FileLike to FileHandle ?
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
use alloc::{sync::Arc, vec::Vec};
|
use alloc::{sync::Arc, vec::Vec};
|
||||||
|
|
||||||
use rcore_fs::dev::block_cache::BlockCache;
|
|
||||||
use rcore_fs::vfs::*;
|
use rcore_fs::vfs::*;
|
||||||
use rcore_fs_devfs::{special::*, DevFS};
|
use rcore_fs_devfs::{special::*, DevFS};
|
||||||
use rcore_fs_mountfs::MountFS;
|
use rcore_fs_mountfs::MountFS;
|
||||||
use rcore_fs_ramfs::RamFS;
|
use rcore_fs_ramfs::RamFS;
|
||||||
use rcore_fs_sfs::SimpleFileSystem;
|
use rcore_fs_sfs::SimpleFileSystem;
|
||||||
|
|
||||||
use crate::drivers::BlockDriver;
|
|
||||||
|
|
||||||
pub use self::file::*;
|
pub use self::file::*;
|
||||||
pub use self::file_like::*;
|
pub use self::file_like::*;
|
||||||
pub use self::pipe::Pipe;
|
pub use self::pipe::Pipe;
|
||||||
@ -50,6 +47,8 @@ lazy_static! {
|
|||||||
let device = {
|
let device = {
|
||||||
#[cfg(any(target_arch = "riscv32", target_arch = "riscv64", target_arch = "x86_64"))]
|
#[cfg(any(target_arch = "riscv32", target_arch = "riscv64", target_arch = "x86_64"))]
|
||||||
{
|
{
|
||||||
|
use crate::drivers::BlockDriver;
|
||||||
|
use rcore_fs::dev::block_cache::BlockCache;
|
||||||
let driver = BlockDriver(
|
let driver = BlockDriver(
|
||||||
crate::drivers::BLK_DRIVERS
|
crate::drivers::BLK_DRIVERS
|
||||||
.read().iter()
|
.read().iter()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//! Implement INode for Pipe
|
//! Implement INode for Pipe
|
||||||
|
|
||||||
use alloc::{collections::vec_deque::VecDeque, string::String, sync::Arc};
|
use alloc::{collections::vec_deque::VecDeque, sync::Arc};
|
||||||
use core::any::Any;
|
use core::any::Any;
|
||||||
|
|
||||||
use rcore_fs::vfs::*;
|
use rcore_fs::vfs::*;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//! Pseudo file system INode
|
//! Pseudo file system INode
|
||||||
|
|
||||||
use alloc::{string::String, sync::Arc, vec::Vec};
|
use alloc::vec::Vec;
|
||||||
use core::any::Any;
|
use core::any::Any;
|
||||||
|
|
||||||
use rcore_fs::vfs::*;
|
use rcore_fs::vfs::*;
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
//! Implement INode for RandomINode
|
//! Implement INode for RandomINode
|
||||||
|
|
||||||
use alloc::{collections::vec_deque::VecDeque, string::String, sync::Arc};
|
use alloc::sync::Arc;
|
||||||
use core::any::Any;
|
use core::any::Any;
|
||||||
|
|
||||||
use rcore_fs::vfs::*;
|
use rcore_fs::vfs::*;
|
||||||
|
|
||||||
use crate::sync::Condvar;
|
|
||||||
use crate::sync::SpinNoIrqLock as Mutex;
|
use crate::sync::SpinNoIrqLock as Mutex;
|
||||||
|
|
||||||
pub struct RandomINodeData {
|
pub struct RandomINodeData {
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
//! Implement INode for Stdin & Stdout
|
//! Implement INode for Stdin & Stdout
|
||||||
|
|
||||||
use alloc::{collections::vec_deque::VecDeque, string::String, sync::Arc};
|
use alloc::{collections::vec_deque::VecDeque, sync::Arc};
|
||||||
use core::any::Any;
|
use core::any::Any;
|
||||||
|
|
||||||
use rcore_fs::vfs::*;
|
use rcore_fs::vfs::*;
|
||||||
|
|
||||||
use super::ioctl::*;
|
use super::ioctl::*;
|
||||||
use crate::process::Process;
|
|
||||||
use crate::sync::Condvar;
|
use crate::sync::Condvar;
|
||||||
use crate::sync::SpinNoIrqLock as Mutex;
|
use crate::sync::SpinNoIrqLock as Mutex;
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
use rcore_fs::vfs::*;
|
use rcore_fs::vfs::*;
|
||||||
|
|
||||||
use crate::drivers::gpu::fb::{ColorFormat, FramebufferInfo, FRAME_BUFFER};
|
use crate::drivers::gpu::fb::{ColorFormat, FramebufferInfo, FRAME_BUFFER};
|
||||||
use crate::memory::phys_to_virt;
|
|
||||||
use alloc::{string::String, sync::Arc, vec::Vec};
|
|
||||||
use core::any::Any;
|
use core::any::Any;
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use crate::sync::Semaphore;
|
use crate::sync::Semaphore;
|
||||||
use crate::sync::SpinLock as Mutex;
|
use alloc::{collections::BTreeMap, sync::Arc, sync::Weak, vec::Vec};
|
||||||
use alloc::{boxed::Box, collections::BTreeMap, string::String, sync::Arc, sync::Weak, vec::Vec};
|
|
||||||
use core::ops::Index;
|
use core::ops::Index;
|
||||||
use spin::RwLock;
|
use spin::RwLock;
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::lkm::manager::ModuleManager;
|
|
||||||
use crate::lkm::structs::LoadedModule;
|
use crate::lkm::structs::LoadedModule;
|
||||||
use alloc::boxed::Box;
|
|
||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
use alloc::sync::Arc;
|
use alloc::sync::Arc;
|
||||||
use core::alloc::{GlobalAlloc, Layout};
|
use core::alloc::{GlobalAlloc, Layout};
|
||||||
@ -10,7 +8,7 @@ use core::slice::from_raw_parts;
|
|||||||
pub fn get_module(this_module: usize) -> &'static mut LoadedModule {
|
pub fn get_module(this_module: usize) -> &'static mut LoadedModule {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = this_module as *mut LoadedModule;
|
let ptr = this_module as *mut LoadedModule;
|
||||||
&mut (*ptr) as (&'static mut LoadedModule)
|
&mut (*ptr) as &'static mut LoadedModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
// Simple kernel memory set for kernel virtual memory
|
// Simple kernel memory set for kernel virtual memory
|
||||||
use crate::arch::paging::PageTableImpl;
|
use crate::arch::paging::PageTableImpl;
|
||||||
use crate::consts::*;
|
|
||||||
use crate::memory::GlobalFrameAlloc;
|
use crate::memory::GlobalFrameAlloc;
|
||||||
use crate::sync::SpinLock as Mutex;
|
use crate::sync::SpinLock as Mutex;
|
||||||
use alloc::vec::*;
|
use alloc::vec::*;
|
||||||
use buddy_system_allocator::*;
|
|
||||||
use core::alloc::Layout;
|
|
||||||
use core::mem::ManuallyDrop;
|
use core::mem::ManuallyDrop;
|
||||||
use core::ops::DerefMut;
|
use core::ops::DerefMut;
|
||||||
use core::ptr::NonNull;
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use rcore_memory::memory_set::handler::{ByFrame, MemoryHandler};
|
use rcore_memory::memory_set::handler::{ByFrame, MemoryHandler};
|
||||||
use rcore_memory::memory_set::MemoryAttr;
|
use rcore_memory::memory_set::MemoryAttr;
|
||||||
@ -119,7 +115,7 @@ impl VirtualArea {
|
|||||||
parent: &mut VirtualSpace,
|
parent: &mut VirtualSpace,
|
||||||
) -> VirtualArea {
|
) -> VirtualArea {
|
||||||
let aligned_start_addr = page_addr - page_addr % PAGE_SIZE;
|
let aligned_start_addr = page_addr - page_addr % PAGE_SIZE;
|
||||||
let mut aligned_end = (page_addr + size + PAGE_SIZE - 1);
|
let mut aligned_end = page_addr + size + PAGE_SIZE - 1;
|
||||||
aligned_end = aligned_end - aligned_end % PAGE_SIZE;
|
aligned_end = aligned_end - aligned_end % PAGE_SIZE;
|
||||||
let lock = parent.allocator.lock();
|
let lock = parent.allocator.lock();
|
||||||
let mut active_pt = lock.kernel_table();
|
let mut active_pt = lock.kernel_table();
|
||||||
|
@ -2,36 +2,26 @@ use super::api::*;
|
|||||||
use super::const_reloc as loader;
|
use super::const_reloc as loader;
|
||||||
use super::kernelvm::*;
|
use super::kernelvm::*;
|
||||||
use super::structs::*;
|
use super::structs::*;
|
||||||
use crate::consts::*;
|
|
||||||
use crate::lkm::structs::ModuleState::{Ready, Unloading};
|
use crate::lkm::structs::ModuleState::{Ready, Unloading};
|
||||||
use crate::memory::GlobalFrameAlloc;
|
use crate::sync::SpinLock as Mutex;
|
||||||
use crate::sync::{Condvar, SpinLock as Mutex};
|
|
||||||
use crate::syscall::SysError::*;
|
use crate::syscall::SysError::*;
|
||||||
use crate::syscall::SysResult;
|
use crate::syscall::SysResult;
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
use alloc::collections::btree_map::BTreeMap;
|
use alloc::collections::btree_map::BTreeMap;
|
||||||
use alloc::prelude::*;
|
|
||||||
use alloc::string::*;
|
use alloc::string::*;
|
||||||
use alloc::sync::Arc;
|
use alloc::sync::Arc;
|
||||||
use alloc::vec::*;
|
use alloc::vec::*;
|
||||||
use core::borrow::BorrowMut;
|
|
||||||
use core::mem::transmute;
|
use core::mem::transmute;
|
||||||
use core::slice;
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use rcore_memory::memory_set::handler::{ByFrame, MemoryHandler};
|
|
||||||
use rcore_memory::memory_set::MemoryAttr;
|
use rcore_memory::memory_set::MemoryAttr;
|
||||||
use rcore_memory::{Page, PAGE_SIZE};
|
use rcore_memory::PAGE_SIZE;
|
||||||
use xmas_elf::dynamic::Tag;
|
use xmas_elf::dynamic::Tag;
|
||||||
use xmas_elf::program::Type::Load;
|
use xmas_elf::program::Type::Load;
|
||||||
use xmas_elf::sections::SectionData;
|
use xmas_elf::sections::SectionData;
|
||||||
use xmas_elf::sections::SectionData::{DynSymbolTable64, Dynamic64, Undefined};
|
use xmas_elf::sections::SectionData::{DynSymbolTable64, Dynamic64, Undefined};
|
||||||
use xmas_elf::symbol_table::DynEntry64;
|
use xmas_elf::symbol_table::DynEntry64;
|
||||||
use xmas_elf::symbol_table::Entry;
|
use xmas_elf::symbol_table::Entry;
|
||||||
use xmas_elf::{
|
use xmas_elf::{header, ElfFile};
|
||||||
header,
|
|
||||||
program::{Flags, Type},
|
|
||||||
ElfFile,
|
|
||||||
};
|
|
||||||
// The symbol data table.
|
// The symbol data table.
|
||||||
global_asm!(include_str!("symbol_table.asm"));
|
global_asm!(include_str!("symbol_table.asm"));
|
||||||
|
|
||||||
@ -96,15 +86,15 @@ impl ModuleManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
use compression::prelude::*;
|
use compression::prelude::*;
|
||||||
let zipped_symbols =
|
let zipped_symbols = unsafe {
|
||||||
unsafe { slice::from_raw_parts(symbol_table_start as *const u8, symbol_table_len) }
|
core::slice::from_raw_parts(symbol_table_start as *const u8, symbol_table_len)
|
||||||
.to_vec();
|
}
|
||||||
|
.to_vec();
|
||||||
|
|
||||||
let real_symbols = zipped_symbols
|
let real_symbols = zipped_symbols
|
||||||
.decode(&mut GZipDecoder::new())
|
.decode(&mut GZipDecoder::new())
|
||||||
.collect::<Result<Vec<_>, _>>()
|
.collect::<Result<Vec<_>, _>>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
use core::slice;
|
|
||||||
use core::str::from_utf8;
|
use core::str::from_utf8;
|
||||||
self.init_kernel_symbols(from_utf8(&real_symbols).unwrap());
|
self.init_kernel_symbols(from_utf8(&real_symbols).unwrap());
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::process::thread_manager;
|
||||||
use crate::process::Process;
|
use crate::process::Process;
|
||||||
use crate::process::{current_thread, thread_manager};
|
|
||||||
use crate::thread;
|
use crate::thread;
|
||||||
use alloc::collections::VecDeque;
|
use alloc::collections::VecDeque;
|
||||||
use alloc::sync::Arc;
|
use alloc::sync::Arc;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
//! Custom nonstandard syscalls
|
//! Custom nonstandard syscalls
|
||||||
use super::*;
|
use super::*;
|
||||||
use rcore_memory::memory_set::handler::Linear;
|
|
||||||
use rcore_memory::memory_set::MemoryAttr;
|
|
||||||
|
|
||||||
impl Syscall<'_> {
|
impl Syscall<'_> {
|
||||||
/// Allocate this PCI device to user space
|
/// Allocate this PCI device to user space
|
||||||
@ -9,6 +7,9 @@ impl Syscall<'_> {
|
|||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
pub fn sys_map_pci_device(&mut self, vendor: usize, product: usize) -> SysResult {
|
pub fn sys_map_pci_device(&mut self, vendor: usize, product: usize) -> SysResult {
|
||||||
use crate::drivers::bus::pci;
|
use crate::drivers::bus::pci;
|
||||||
|
use rcore_memory::memory_set::handler::Linear;
|
||||||
|
use rcore_memory::memory_set::MemoryAttr;
|
||||||
|
|
||||||
info!(
|
info!(
|
||||||
"map_pci_device: vendor: {:x}, product: {:x}",
|
"map_pci_device: vendor: {:x}, product: {:x}",
|
||||||
vendor, product
|
vendor, product
|
||||||
|
@ -8,18 +8,14 @@ use rcore_fs::vfs::Timespec;
|
|||||||
use crate::drivers::SOCKET_ACTIVITY;
|
use crate::drivers::SOCKET_ACTIVITY;
|
||||||
use crate::fs::*;
|
use crate::fs::*;
|
||||||
use crate::memory::MemorySet;
|
use crate::memory::MemorySet;
|
||||||
use crate::sync::{Condvar, SpinNoIrqLock};
|
use crate::sync::Condvar;
|
||||||
use crate::trap::TICK_ACTIVITY;
|
use crate::trap::TICK_ACTIVITY;
|
||||||
use alloc::{collections::BTreeMap, collections::BTreeSet};
|
|
||||||
|
|
||||||
use bitvec::prelude::{BitSlice, BitVec, LittleEndian};
|
use bitvec::prelude::{BitSlice, BitVec, LittleEndian};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::fs::epoll::EpollInstance;
|
use crate::fs::epoll::EpollInstance;
|
||||||
use crate::net::server;
|
|
||||||
use crate::process::Process;
|
use crate::process::Process;
|
||||||
use alloc::collections::VecDeque;
|
|
||||||
use bitflags::_core::task::Poll;
|
|
||||||
use rcore_fs::vfs::PollStatus;
|
use rcore_fs::vfs::PollStatus;
|
||||||
|
|
||||||
impl Syscall<'_> {
|
impl Syscall<'_> {
|
||||||
@ -394,7 +390,6 @@ impl Syscall<'_> {
|
|||||||
|
|
||||||
let begin_time_ms = crate::trap::uptime_msec();
|
let begin_time_ms = crate::trap::uptime_msec();
|
||||||
let condition = move || {
|
let condition = move || {
|
||||||
use PollEvents as PE;
|
|
||||||
let mut proc = self.process();
|
let mut proc = self.process();
|
||||||
|
|
||||||
let epollInstance = match proc.get_epoll_instance_mut(epfd) {
|
let epollInstance = match proc.get_epoll_instance_mut(epfd) {
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
use crate::sync::Semaphore;
|
|
||||||
use crate::sync::SpinLock as Mutex;
|
|
||||||
use alloc::{boxed::Box, collections::BTreeMap, string::String, sync::Arc, sync::Weak, vec::Vec};
|
|
||||||
use bitflags::*;
|
use bitflags::*;
|
||||||
use core::cell::UnsafeCell;
|
|
||||||
use spin::RwLock;
|
|
||||||
|
|
||||||
pub use crate::ipc::*;
|
pub use crate::ipc::*;
|
||||||
|
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
use crate::lkm::manager::ModuleManager;
|
use crate::lkm::manager::ModuleManager;
|
||||||
use crate::sync::Mutex;
|
|
||||||
use crate::syscall::{check_and_clone_cstr, SysResult, Syscall};
|
use crate::syscall::{check_and_clone_cstr, SysResult, Syscall};
|
||||||
use alloc::collections::btree_map::BTreeMap;
|
|
||||||
use compression::prelude::Action;
|
|
||||||
|
|
||||||
impl Syscall<'_> {
|
impl Syscall<'_> {
|
||||||
pub fn sys_init_module(
|
pub fn sys_init_module(
|
||||||
|
Loading…
Reference in New Issue
Block a user