From: Ben Pfaff Date: Sun, 5 Sep 2004 08:30:04 +0000 (+0000) Subject: System call interface. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d321fddc6a25651e7fccacfe46b0ff1c4e52501;p=pintos-anon System call interface. --- diff --git a/src/Makefile.inc b/src/Makefile.inc index 9d92909..885c6bb 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -51,6 +51,7 @@ FILESYS_SRC += fsutil.c # Utilities. # User process code. USERPROG_SRC = addrspace.c # Address spaces. USERPROG_SRC += exception.c # User exception handler. +USERPROG_SRC += syscall.c # System call handler. USERPROG_SRC += gdt.c # GDT initialization. USERPROG_SRC += tss.c # TSS management. diff --git a/src/threads/init.c b/src/threads/init.c index b099d02..57f3cbe 100644 --- a/src/threads/init.c +++ b/src/threads/init.c @@ -19,6 +19,7 @@ #include "vga.h" #ifdef USERPROG #include "exception.h" +#include "syscall.h" #include "gdt.h" #include "tss.h" #endif @@ -79,6 +80,7 @@ main (void) kbd_init (); #ifdef USERPROG exception_init (); + syscall_init (); #endif /* Start thread scheduler and enable interrupts. */ diff --git a/src/userprog/syscall.c b/src/userprog/syscall.c new file mode 100644 index 0000000..6084726 --- /dev/null +++ b/src/userprog/syscall.c @@ -0,0 +1,19 @@ +#include "syscall.h" +#include "lib.h" +#include "interrupt.h" +#include "thread.h" + +static void syscall_handler (struct intr_frame *); + +void +syscall_init (void) +{ + intr_register (0x30, 3, INTR_ON, syscall_handler, "syscall"); +} + +static void +syscall_handler (struct intr_frame *f) +{ + printk ("system call!\n"); + thread_exit (); +} diff --git a/src/userprog/syscall.h b/src/userprog/syscall.h new file mode 100644 index 0000000..f57676c --- /dev/null +++ b/src/userprog/syscall.h @@ -0,0 +1,6 @@ +#ifndef HEADER_SYSCALL_H +#define HEADER_SYSCALL_H 1 + +void syscall_init (void); + +#endif /* syscall.h */