summaryrefslogtreecommitdiff
path: root/syscall.c
diff options
context:
space:
mode:
Diffstat (limited to 'syscall.c')
-rw-r--r--syscall.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/syscall.c b/syscall.c
index 420a578..6ac739f 100644
--- a/syscall.c
+++ b/syscall.c
@@ -30,7 +30,7 @@ fetchint(struct proc *p, unsigned addr, int *ip)
if(addr > p->sz - 4)
return -1;
- memcpy(ip, p->mem + addr, 4);
+ memmove(ip, p->mem + addr, 4);
return 0;
}
@@ -49,7 +49,7 @@ putint(struct proc *p, unsigned addr, int ip)
{
if(addr > p->sz - 4)
return -1;
- memcpy(p->mem + addr, &ip, 4);
+ memmove(p->mem + addr, &ip, 4);
return 0;
}
@@ -150,13 +150,10 @@ sys_fork(void)
{
struct proc *np;
- np = newproc();
- if(np){
- np->state = RUNNABLE;
- return np->pid;
- } else {
+ if((np = copyproc(curproc[cpu()])) == 0)
return -1;
- }
+ np->state = RUNNABLE;
+ return np->pid;
}
int