diff options
author | Frans Kaashoek <[email protected]> | 2017-01-31 17:47:16 -0500 |
---|---|---|
committer | Frans Kaashoek <[email protected]> | 2017-01-31 17:47:16 -0500 |
commit | abf847a083888bbed4260ecacf849ea19f23e810 (patch) | |
tree | 4ae9b3487bbfe27f6382486bf877917dbb8bc030 /syscall.c | |
parent | 59cdd6c63b89395d64ec9550181af5ed569b8466 (diff) | |
download | xv6-labs-abf847a083888bbed4260ecacf849ea19f23e810.tar.gz xv6-labs-abf847a083888bbed4260ecacf849ea19f23e810.tar.bz2 xv6-labs-abf847a083888bbed4260ecacf849ea19f23e810.zip |
Start of an experiment to remove the use of gs for cpu local variables.
Diffstat (limited to 'syscall.c')
-rw-r--r-- | syscall.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -17,7 +17,7 @@ int fetchint(uint addr, int *ip) { - if(addr >= proc->sz || addr+4 > proc->sz) + if(addr >= myproc()->sz || addr+4 > myproc()->sz) return -1; *ip = *(int*)(addr); return 0; @@ -31,13 +31,14 @@ fetchstr(uint addr, char **pp) { char *s, *ep; - if(addr >= proc->sz) + if(addr >= myproc()->sz) return -1; *pp = (char*)addr; - ep = (char*)proc->sz; - for(s = *pp; s < ep; s++) + ep = (char*)myproc()->sz; + for(s = *pp; s < ep; s++){ if(*s == 0) return s - *pp; + } return -1; } @@ -45,7 +46,7 @@ fetchstr(uint addr, char **pp) int argint(int n, int *ip) { - return fetchint(proc->tf->esp + 4 + 4*n, ip); + return fetchint((myproc()->tf->esp) + 4 + 4*n, ip); } // Fetch the nth word-sized system call argument as a pointer @@ -58,7 +59,7 @@ argptr(int n, char **pp, int size) if(argint(n, &i) < 0) return -1; - if(size < 0 || (uint)i >= proc->sz || (uint)i+size > proc->sz) + if(size < 0 || (uint)i >= myproc()->sz || (uint)i+size > myproc()->sz) return -1; *pp = (char*)i; return 0; @@ -128,12 +129,12 @@ syscall(void) { int num; - num = proc->tf->eax; + num = myproc()->tf->eax; if(num > 0 && num < NELEM(syscalls) && syscalls[num]) { - proc->tf->eax = syscalls[num](); + myproc()->tf->eax = syscalls[num](); } else { cprintf("%d %s: unknown sys call %d\n", - proc->pid, proc->name, num); - proc->tf->eax = -1; + myproc()->pid, myproc()->name, num); + myproc()->tf->eax = -1; } } |