maually remove warning, pt1

master
Ben Pig Chu 6 years ago
parent ac71a45986
commit 1ca2bde069

@ -3,7 +3,6 @@
//! Implemented for every architecture, used by OS.
use super::*;
use log::*;
#[cfg(test)]
pub use self::mock_page_table::MockPageTable;
pub use self::ext::*;

@ -296,7 +296,7 @@ impl<T: PageTable, M: SwapManager, S: Swapper> SwapExt<T, M, S> {
entry.set_present(true);
entry.update();
}
if(swapin){
if swapin {
unsafe {
self.set_swappable(pt, addr & 0xfffff000);
}

@ -1,9 +1,7 @@
use alloc::boxed::Box;
use alloc::sync::Arc;
use alloc::vec::Vec;
use spin::Mutex;
use log::*;
use core::cell::UnsafeCell;
use crate::scheduler::Scheduler;
use crate::event_hub::EventHub;

@ -1,6 +1,5 @@
use alloc::boxed::Box;
use alloc::sync::Arc;
use spin::Mutex;
use log::*;
use core::cell::UnsafeCell;
use crate::process_manager::*;
@ -30,14 +29,12 @@ impl Processor {
}
pub unsafe fn init(&self, id: usize, context: Box<Context>, manager: Arc<ProcessManager>) {
unsafe {
*self.inner.get() = Some(ProcessorInner {
id,
proc: None,
loop_context: context,
manager,
});
}
*self.inner.get() = Some(ProcessorInner {
id,
proc: None,
loop_context: context,
manager,
});
}
fn inner(&self) -> &mut ProcessorInner {

@ -7,14 +7,11 @@
//! - `new_kernel_context`: Construct a `Context` of the new kernel thread
use alloc::boxed::Box;
use alloc::collections::BTreeMap;
use core::marker::PhantomData;
use core::ptr;
use core::time::Duration;
use log::*;
use crate::processor::*;
use crate::process_manager::*;
use crate::scheduler::Scheduler;
#[linkage = "weak"]
#[no_mangle]

@ -1,7 +1,6 @@
use simple_filesystem::*;
use alloc::{boxed::Box, sync::Arc, string::String, collections::VecDeque, vec::Vec};
use core::any::Any;
use core::slice;
use lazy_static::lazy_static;
#[cfg(target_arch = "x86_64")]
use crate::arch::driver::ide;

@ -2,4 +2,5 @@
#![cfg_attr(not(test), no_main)] // disable all Rust-level entry points
#![cfg_attr(test, allow(dead_code, unused_macros, unused_imports))]
#[allow(unused_imports)]
use ucore;

@ -2,13 +2,11 @@ pub use crate::arch::paging::*;
use bit_allocator::BitAlloc;
use crate::consts::MEMORY_OFFSET;
use super::HEAP_ALLOCATOR;
use ucore_memory::{*, paging::PageTable};
use ucore_memory::*;
use ucore_memory::cow::CowExt;
pub use ucore_memory::memory_set::{MemoryArea, MemoryAttr, handler::*};
use ucore_memory::swap::*;
use crate::process::{process};
use crate::sync::{SpinNoIrqLock, SpinNoIrq, MutexGuard};
use alloc::collections::VecDeque;
use lazy_static::*;
use log::*;
use linked_list_allocator::LockedHeap;

@ -4,10 +4,10 @@ use log::*;
use simple_filesystem::file::File;
use spin::Mutex;
use ucore_process::Context;
use xmas_elf::{ElfFile, header, program::{Flags, ProgramHeader, SegmentData, Type}};
use xmas_elf::{ElfFile, header, program::{Flags, Type}};
use crate::arch::interrupt::{Context as ArchContext, TrapFrame};
use crate::memory::{ByFrame, Delay, FrameAllocator, GlobalFrameAlloc, KernelStack, MemoryArea, MemoryAttr, MemorySet};
use crate::memory::{ByFrame, GlobalFrameAlloc, KernelStack, MemoryAttr, MemorySet};
// TODO: avoid pub
pub struct Process {
@ -110,7 +110,7 @@ impl Process {
pub fn fork(&self, tf: &TrapFrame) -> Box<Context> {
info!("COME into fork!");
// Clone memory set, make a new page table
let mut memory_set = self.memory_set.clone();
let memory_set = self.memory_set.clone();
info!("finish mmset clone in fork!");
// MMU: copy data to the new space
@ -149,7 +149,6 @@ unsafe fn push_slice<T: Copy>(mut sp: usize, vs: &[T]) -> usize {
unsafe fn push_args_at_stack<'a, Iter>(args: Iter, stack_top: usize) -> usize
where Iter: Iterator<Item=&'a str>
{
use core::{ptr, slice};
let mut sp = stack_top;
let mut argv = Vec::new();
for arg in args {

@ -1,11 +1,8 @@
use spin::Mutex;
pub use self::context::Process;
pub use ucore_process::*;
use crate::consts::{MAX_CPU_NUM, MAX_PROCESS_NUM};
use crate::arch::cpu;
use alloc::{boxed::Box, sync::Arc, vec::Vec};
use crate::sync::Condvar;
use core::sync::atomic::*;
use alloc::{boxed::Box, sync::Arc};
use log::*;
pub mod context;

@ -1,7 +1,6 @@
//! Kernel shell
use alloc::string::String;
use alloc::vec::Vec;
use crate::fs::{ROOT_INODE, INodeExt};
use crate::process::*;

@ -141,7 +141,7 @@ fn sys_dup(fd1: usize, fd2: usize) -> SysResult {
/// Fork the current process. Return the child's PID.
fn sys_fork(tf: &TrapFrame) -> SysResult {
let mut context = process().fork(tf);
let context = process().fork(tf);
//memory_set_map_swappable(context.get_memory_set_mut());
let pid = processor().manager().add(context, thread::current().id());
//memory_set_map_swappable(processor.get_context_mut(pid).get_memory_set_mut());
@ -374,6 +374,7 @@ impl From<FileInfo> for Stat {
mode: match info.type_ {
FileType::File => StatMode::FILE,
FileType::Dir => StatMode::DIR,
#[allow(unreachable_patterns)]
_ => StatMode::NULL,
},
nlinks: info.nlinks as u32,

@ -1,5 +1,3 @@
use core::fmt::Debug;
/// Convert C string to Rust string
pub unsafe fn from_cstr(s: *const u8) -> &'static str {
use core::{str, slice};

Loading…
Cancel
Save