diff --git a/kernel/src/arch/x86_64/consts.rs b/kernel/src/arch/x86_64/consts.rs index 2095e39..0b3a4f9 100644 --- a/kernel/src/arch/x86_64/consts.rs +++ b/kernel/src/arch/x86_64/consts.rs @@ -55,7 +55,7 @@ pub const USER_GRANT_PML4: usize = (USER_GRANT_OFFSET & PML4_MASK) / PML4_SIZE; pub const USER_STACK_OFFSET: usize = USER_GRANT_OFFSET + PML4_SIZE; pub const USER_STACK_PML4: usize = (USER_STACK_OFFSET & PML4_MASK) / PML4_SIZE; /// Size of user stack -pub const USER_STACK_SIZE: usize = 1024 * 1024; // 1 MB +pub const USER_STACK_SIZE: usize = 8 * 1024 * 1024; // 8 MB, the default config of Linux /// Offset to user sigstack pub const USER_SIGSTACK_OFFSET: usize = USER_STACK_OFFSET + PML4_SIZE; diff --git a/kernel/src/syscall/proc.rs b/kernel/src/syscall/proc.rs index 362aef0..89b7765 100644 --- a/kernel/src/syscall/proc.rs +++ b/kernel/src/syscall/proc.rs @@ -13,7 +13,7 @@ pub fn sys_fork(tf: &TrapFrame) -> SysResult { /// Create a new thread in the current process. /// The new thread's stack pointer will be set to `newsp`, -/// and thread pointer will be set to `newtls`. +/// and thread pointer will be set to `newtls`. /// The child tid will be stored at both `parent_tid` and `child_tid`. /// This is partially implemented for musl only. pub fn sys_clone( @@ -26,16 +26,17 @@ pub fn sys_clone( ) -> SysResult { let clone_flags = CloneFlags::from_bits_truncate(flags); info!( - "clone: flags: {:?}, newsp: {:#x}, parent_tid: {:?}, child_tid: {:?}, newtls: {:#x}", - clone_flags, newsp, parent_tid, child_tid, newtls + "clone: flags: {:?} == {:#x}, newsp: {:#x}, parent_tid: {:?}, child_tid: {:?}, newtls: {:#x}", + clone_flags, flags, newsp, parent_tid, child_tid, newtls ); if flags == 0x4111 || flags == 0x11 { warn!("sys_clone is calling sys_fork instead, ignoring other args"); return sys_fork(tf); } - if flags != 0x7d0f00 { - warn!("sys_clone only support musl pthread_create"); - return Err(SysError::ENOSYS); + if (flags != 0x7d0f00) && (flags!= 0x5d0f00) { //0x5d0f00 is the args from gcc of alpine linux + //warn!("sys_clone only support musl pthread_create"); + panic!("sys_clone only support sys_fork OR musl pthread_create without flags{:x}", flags); + //return Err(SysError::ENOSYS); } { let proc = process();