From abd273ce0a9ae9267f8b0a144ea9b56d8912f9b5 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 19 Jun 2012 23:31:28 +0200 Subject: add dynamic stack growing --- userprog/syscall.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'userprog/syscall.c') diff --git a/userprog/syscall.c b/userprog/syscall.c index f8e0197..541668d 100644 --- a/userprog/syscall.c +++ b/userprog/syscall.c @@ -17,6 +17,9 @@ #define STACK_SLOT_SIZE sizeof(int) +/* stored stack pointer for the "page fault inside syscall/kernel"-case */ +void *syscall_sp; + /* Prototypes for Utilities */ static int get_user (const uint8_t *uaddr); static bool put_user (uint8_t *udst, uint8_t byte); @@ -195,10 +198,10 @@ syscall_handler (struct intr_frame *f) handler* fp; bool segfault = false; int result; - void *sp = f->esp; + syscall_sp = f->esp; /* The system call number and the arguments are on the stack */ - if (! copy_from_user (&syscall_nr,sp)) + if (! copy_from_user (&syscall_nr,syscall_sp)) goto fail; switch (syscall_nr) { case SYS_HALT: fp = syscall_halt; break; @@ -217,7 +220,7 @@ syscall_handler (struct intr_frame *f) default: goto fail; } - result = fp (sp, &segfault); + result = fp (syscall_sp, &segfault); if (segfault) goto fail; f->eax = result; -- cgit v1.2.3