Fix implementation of clone and exec. Now the init process can load and execute the pci driver
This commit is contained in:
parent
b01a918556
commit
33e098c124
9 changed files with 233 additions and 78 deletions
|
@ -1,6 +1,7 @@
|
|||
//! File struct
|
||||
|
||||
/// A file
|
||||
//TODO: Close on exec
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct File {
|
||||
/// The scheme that this file refers to
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use arch::externs::memset;
|
||||
use arch::paging::{ActivePageTable, InactivePageTable, Page, PageIter, VirtualAddress};
|
||||
use arch::paging::entry::EntryFlags;
|
||||
use arch::paging::entry::{self, EntryFlags};
|
||||
use arch::paging::temporary_page::TemporaryPage;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -31,6 +31,10 @@ impl Memory {
|
|||
self.size
|
||||
}
|
||||
|
||||
pub fn flags(&self) -> EntryFlags {
|
||||
self.flags
|
||||
}
|
||||
|
||||
pub fn pages(&self) -> PageIter {
|
||||
let start_page = Page::containing_address(self.start);
|
||||
let end_page = Page::containing_address(VirtualAddress::new(self.start.get() + self.size - 1));
|
||||
|
@ -57,7 +61,7 @@ impl Memory {
|
|||
}
|
||||
|
||||
if clear {
|
||||
assert!(flush);
|
||||
assert!(flush && self.flags.contains(entry::WRITABLE));
|
||||
unsafe { memset(self.start_address().get() as *mut u8, 0, self.size); }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,7 +167,6 @@ pub unsafe fn switch() {
|
|||
// TODO: Sleep, wait for interrupt
|
||||
// Unset global lock if no context found
|
||||
arch::context::CONTEXT_SWITCH_LOCK.store(false, Ordering::SeqCst);
|
||||
println!("No to_ptr");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue