PKUOS - Pintos
Pintos source browser for PKU Operating System course
src
userprog
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
16
syscall_handler
(
struct
intr_frame
*f
UNUSED
)
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
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
interrupt.h
INTR_ON
@ INTR_ON
Interrupts enabled.
Definition:
interrupt.h:11
printf
int printf(const char *format,...)
Writes formatted output to the console.
Definition:
stdio.c:79
intr_frame
Interrupt stack frame.
Definition:
interrupt.h:21
syscall-nr.h
thread_exit
void thread_exit(void)
Deschedules the current thread and destroys it.
Definition:
thread.c:281
thread.h
syscall_handler
static void syscall_handler(struct intr_frame *)
syscall_init
void syscall_init(void)
userprog/syscall.h
Definition:
syscall.c:10
syscall.h
Generated on Thu Nov 4 2021 19:31:01 for PKUOS - Pintos by
1.9.2