diff options
| author | Karoline Knoth <e0326266@student.tuwien.ac.at> | 2012-06-21 15:19:08 +0200 |
|---|---|---|
| committer | Karoline Knoth <e0326266@student.tuwien.ac.at> | 2012-06-21 15:19:08 +0200 |
| commit | e9e69def589375c3d0e51b532268b27d3d403bbf (patch) | |
| tree | 5e64cfd3c5c858bddbae31b666519dcc1145fb1c /userprog | |
| parent | 4bd5cb5f9e4778ceed3737e3c8f7f6fa1cf0b3f1 (diff) | |
| download | progos-e9e69def589375c3d0e51b532268b27d3d403bbf.tar.gz progos-e9e69def589375c3d0e51b532268b27d3d403bbf.tar.bz2 progos-e9e69def589375c3d0e51b532268b27d3d403bbf.zip | |
use local stack pointer inside syscall_handler
Diffstat (limited to 'userprog')
| -rw-r--r-- | userprog/syscall.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/userprog/syscall.c b/userprog/syscall.c index 71aba5c..7f8c397 100644 --- a/userprog/syscall.c +++ b/userprog/syscall.c | |||
| @@ -201,10 +201,10 @@ syscall_handler (struct intr_frame *f) | |||
| 201 | handler* fp; | 201 | handler* fp; |
| 202 | bool segfault = false; | 202 | bool segfault = false; |
| 203 | int result; | 203 | int result; |
| 204 | syscall_sp = f->esp; | 204 | void *sp = f->esp; |
| 205 | 205 | ||
| 206 | /* The system call number and the arguments are on the stack */ | 206 | /* The system call number and the arguments are on the stack */ |
| 207 | if (! copy_from_user (&syscall_nr,syscall_sp)) | 207 | if (! copy_from_user (&syscall_nr,sp)) |
| 208 | goto fail; | 208 | goto fail; |
| 209 | switch (syscall_nr) { | 209 | switch (syscall_nr) { |
| 210 | case SYS_HALT: fp = syscall_halt; break; | 210 | case SYS_HALT: fp = syscall_halt; break; |
| @@ -225,8 +225,9 @@ syscall_handler (struct intr_frame *f) | |||
| 225 | default: | 225 | default: |
| 226 | goto fail; | 226 | goto fail; |
| 227 | } | 227 | } |
| 228 | result = fp (syscall_sp, &segfault); | 228 | syscall_sp = sp; |
| 229 | if (segfault) | 229 | result = fp (sp, &segfault); |
| 230 | if (segfault) | ||
| 230 | goto fail; | 231 | goto fail; |
| 231 | f->eax = result; | 232 | f->eax = result; |
| 232 | return; | 233 | return; |
