summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2021-02-04 10:56:38 +0100
committerGustav Sörnäs <gustav@sornas.net>2021-02-05 13:02:01 +0100
commitf9d352a64d125ac69c2d1a74fdbc75665c6d0b42 (patch)
treeebde76ce39659d8f38ed233a53d51268b564e8e5 /src
parent7826c4030ea1651e31463cd7986de4007d8e041b (diff)
downloadpintos-f9d352a64d125ac69c2d1a74fdbc75665c6d0b42.tar.gz
implement halt()
Diffstat (limited to 'src')
-rw-r--r--src/userprog/syscall.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/userprog/syscall.c b/src/userprog/syscall.c
index e15555e..49e61e8 100644
--- a/src/userprog/syscall.c
+++ b/src/userprog/syscall.c
@@ -1,6 +1,7 @@
#include "userprog/syscall.h"
#include <stdio.h>
#include <syscall-nr.h>
+#include "threads/init.h"
#include "threads/interrupt.h"
#include "threads/thread.h"
@@ -17,6 +18,10 @@ syscall_handler (struct intr_frame *f UNUSED)
{
int syscall_number = *((int *)f->esp);
switch (syscall_number) {
+ case 0:
+ // halt
+ power_off ();
+ break;
case 9:
// printf
printf ("printf: %s", *((char **)(f->esp+8)));