CS318 - Pintos
Pintos source browser for JHU CS318 course
syscall.c
Go to the documentation of this file.
1 #include "userprog/syscall.h"
2 #include <stdio.h>
3 #include <syscall-nr.h>
4 #include "threads/interrupt.h"
5 #include "threads/thread.h"
6 
7 static void syscall_handler (struct intr_frame *);
8 
9 void
10 syscall_init (void)
11 {
12  intr_register_int (0x30, 3, INTR_ON, syscall_handler, "syscall");
13 }
14 
15 static void
17 {
18  printf ("system call!\n");
19  thread_exit ();
20 }
UNUSED
#define UNUSED
GCC lets us add "attributes" to functions, function parameters, etc.
Definition: debug.h:7
syscall_init
void syscall_init(void)
userprog/syscall.h
Definition: syscall.c:10
syscall.h
interrupt.h
printf
int printf(const char *format,...)
Writes formatted output to the console.
Definition: stdio.c:79
syscall-nr.h
thread_exit
void thread_exit(void)
Deschedules the current thread and destroys it.
Definition: thread.c:281
intr_register_int
void intr_register_int(uint8_t vec_no, int dpl, enum intr_level level, intr_handler_func *handler, const char *name)
Registers internal interrupt VEC_NO to invoke HANDLER, which is named NAME for debugging purposes.
Definition: interrupt.c:202
intr_frame
Interrupt stack frame.
Definition: interrupt.h:20
syscall_handler
static void syscall_handler(struct intr_frame *)
thread.h
INTR_ON
Interrupts enabled.
Definition: interrupt.h:11