Panic upon use of unsupported flags
This commit is contained in:
parent
6ad843184d
commit
0b2fd79816
|
@ -46,6 +46,10 @@ pub fn brk(address: usize) -> Result<usize> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub const CLONE_VM: usize = 0x100;
|
||||||
|
pub const CLONE_FS: usize = 0x200;
|
||||||
|
pub const CLONE_FILES: usize = 0x400;
|
||||||
|
pub const CLONE_VFORK: usize = 0x4000;
|
||||||
pub fn clone(flags: usize, stack_base: usize) -> Result<usize> {
|
pub fn clone(flags: usize, stack_base: usize) -> Result<usize> {
|
||||||
//TODO: Implement flags
|
//TODO: Implement flags
|
||||||
//TODO: Copy on write?
|
//TODO: Copy on write?
|
||||||
|
@ -78,6 +82,9 @@ pub fn clone(flags: usize, stack_base: usize) -> Result<usize> {
|
||||||
kstack_option = Some(new_stack);
|
kstack_option = Some(new_stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if flags & CLONE_VM == CLONE_VM {
|
||||||
|
panic!("unimplemented: CLONE_VM");
|
||||||
|
} else {
|
||||||
for memory in context.image.iter() {
|
for memory in context.image.iter() {
|
||||||
let mut new_memory = context::memory::Memory::new(
|
let mut new_memory = context::memory::Memory::new(
|
||||||
VirtualAddress::new(memory.start_address().get() + arch::USER_TMP_OFFSET),
|
VirtualAddress::new(memory.start_address().get() + arch::USER_TMP_OFFSET),
|
||||||
|
@ -111,6 +118,7 @@ pub fn clone(flags: usize, stack_base: usize) -> Result<usize> {
|
||||||
new_heap.remap(heap.flags(), true);
|
new_heap.remap(heap.flags(), true);
|
||||||
heap_option = Some(new_heap);
|
heap_option = Some(new_heap);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(ref stack) = context.stack {
|
if let Some(ref stack) = context.stack {
|
||||||
let mut new_stack = context::memory::Memory::new(
|
let mut new_stack = context::memory::Memory::new(
|
||||||
|
@ -129,6 +137,9 @@ pub fn clone(flags: usize, stack_base: usize) -> Result<usize> {
|
||||||
stack_option = Some(new_stack);
|
stack_option = Some(new_stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if flags & CLONE_FILES == CLONE_FILES {
|
||||||
|
panic!("unimplemented: CLONE_FILES");
|
||||||
|
} else {
|
||||||
for (fd, file_option) in context.files.iter().enumerate() {
|
for (fd, file_option) in context.files.iter().enumerate() {
|
||||||
if let Some(file) = *file_option {
|
if let Some(file) = *file_option {
|
||||||
let result = {
|
let result = {
|
||||||
|
@ -150,6 +161,7 @@ pub fn clone(flags: usize, stack_base: usize) -> Result<usize> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set up new process
|
// Set up new process
|
||||||
{
|
{
|
||||||
|
|
2
libstd
2
libstd
|
@ -1 +1 @@
|
||||||
Subproject commit eaad8f520ce853c15c2071eff08ed813e87118fa
|
Subproject commit 00920975234a9bc774ad6e33efd57a56a40c0ee8
|
Loading…
Reference in a new issue