提交 1fb7b9c5 创建 作者: Nickolai Zeldovich's avatar Nickolai Zeldovich

pass fork flags to forkt

上级 296bdfb1
......@@ -54,7 +54,7 @@ void free(void*);
int atoi(const char*);
// uthread.S
int forkt(void *sp, void *pc, void *arg);
int forkt(void *sp, void *pc, void *arg, int forkflags);
void forkt_setup(u64 pid);
// printf.c
......
......@@ -2,6 +2,7 @@
#include "pthread.h"
#include "user.h"
#include "atomic.hh"
#include "fcntl.h"
enum { stack_size = 8192 };
static std::atomic<int> nextkey;
......@@ -22,7 +23,7 @@ pthread_create(pthread_t* tid, const pthread_attr_t* attr,
void* (*start)(void*), void* arg)
{
char* base = (char*) sbrk(stack_size);
int t = forkt(base + stack_size, (void*) start, arg);
int t = forkt(base + stack_size, (void*) start, arg, FORK_SHARE_VMAP);
if (t < 0)
return t;
......
......@@ -12,7 +12,7 @@ forkt:
movq %rdx, 0x00(%r12) # arg
movq %rsi, 0x08(%r12) # function ptr
movq $1, %rdi # flag for sys_fork
movq %rcx, %rdi # flag for sys_fork
movq $SYS_fork, %rax
syscall
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论