PKUOS - Pintos
Pintos source browser for PKU Operating System 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
7static void syscall_handler (struct intr_frame *);
8
9void
11{
12 intr_register_int (0x30, 3, INTR_ON, syscall_handler, "syscall");
13}
14
15static void
17{
18 printf ("system call!\n");
19 thread_exit ();
20}
#define UNUSED
GCC lets us add "attributes" to functions, function parameters, etc.
Definition: debug.h:7
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_ON
Interrupts enabled.
Definition: interrupt.h:11
int printf(const char *format,...)
Writes formatted output to the console.
Definition: stdio.c:79
Interrupt stack frame.
Definition: interrupt.h:21
void thread_exit(void)
Deschedules the current thread and destroys it.
Definition: thread.c:281
static void syscall_handler(struct intr_frame *)
void syscall_init(void)
userprog/syscall.h
Definition: syscall.c:10