diff options
| author | rsc <rsc> | 2007-08-09 17:32:40 +0000 | 
|---|---|---|
| committer | rsc <rsc> | 2007-08-09 17:32:40 +0000 | 
| commit | 9583b476bf0caa3fca61f08dcb8afe138f4b4fb9 (patch) | |
| tree | eab343d678599672102009097ea55b35fa5bdc45 /syscall.c | |
| parent | 22330658fff5039b69e6b68ac3f5197c417003b6 (diff) | |
| download | xv6-labs-9583b476bf0caa3fca61f08dcb8afe138f4b4fb9.tar.gz xv6-labs-9583b476bf0caa3fca61f08dcb8afe138f4b4fb9.tar.bz2 xv6-labs-9583b476bf0caa3fca61f08dcb8afe138f4b4fb9.zip | |
try to use cp only for curproc[cpu()]
Diffstat (limited to 'syscall.c')
| -rw-r--r-- | syscall.c | 18 | 
1 files changed, 9 insertions, 9 deletions
| @@ -37,15 +37,15 @@ fetchint(struct proc *p, uint addr, int *ip)  int  fetchstr(struct proc *p, uint addr, char **pp)  { -  char *cp, *ep; +  char *s, *ep;    if(addr >= p->sz)      return -1;    *pp = p->mem + addr;    ep = p->mem + p->sz; -  for(cp = *pp; cp < ep; cp++) -    if(*cp == 0) -      return cp - *pp; +  for(s = *pp; s < ep; s++) +    if(*s == 0) +      return s - *pp;    return -1;  } @@ -53,9 +53,9 @@ fetchstr(struct proc *p, uint addr, char **pp)  int  argint(int argno, int *ip)  { -  struct proc *p = curproc[cpu()]; +  struct proc *cp = curproc[cpu()]; -  return fetchint(p, p->tf->esp + 4 + 4*argno, ip); +  return fetchint(cp, cp->tf->esp + 4 + 4*argno, ip);  }  // Fetch the nth word-sized system call argument as a pointer @@ -65,13 +65,13 @@ int  argptr(int argno, char **pp, int size)  {    int i; -  struct proc *p = curproc[cpu()]; +  struct proc *cp = curproc[cpu()];    if(argint(argno, &i) < 0)      return -1; -  if((uint)i >= p->sz || (uint)i+size >= p->sz) +  if((uint)i >= cp->sz || (uint)i+size >= cp->sz)      return -1; -  *pp = p->mem + i; +  *pp = cp->mem + i;    return 0;  } | 
