Implement halt system call w/ S.

This commit is contained in:
EDiasAlberto
2024-11-03 22:34:50 +00:00
parent 0bf5fdb0e5
commit fa6dac2108

View File

@@ -1,4 +1,5 @@
#include "userprog/syscall.h" #include "userprog/syscall.h"
#include "devices/shutdown.h"
#include <stdio.h> #include <stdio.h>
#include <syscall-nr.h> #include <syscall-nr.h>
#include "threads/interrupt.h" #include "threads/interrupt.h"
@@ -11,6 +12,9 @@ static void syscall_handler (struct intr_frame *);
in size. */ in size. */
typedef uintptr_t syscall_function (uintptr_t, uintptr_t, uintptr_t); typedef uintptr_t syscall_function (uintptr_t, uintptr_t, uintptr_t);
/* System Call Functions */
static void halt (void);
void void
syscall_init (void) syscall_init (void)
{ {
@@ -23,3 +27,9 @@ syscall_handler (struct intr_frame *f UNUSED)
printf ("system call!\n"); printf ("system call!\n");
thread_exit (); thread_exit ();
} }
static void
halt (void)
{
shutdown_power_off ();
}