PKUOS - Pintos
Pintos source browser for PKU Operating System course
Macros | Functions | Variables
shutdown.c File Reference
#include "devices/shutdown.h"
#include <console.h>
#include <stdio.h>
#include "devices/kbd.h"
#include "devices/serial.h"
#include "devices/timer.h"
#include "threads/io.h"
#include "threads/thread.h"
Include dependency graph for shutdown.c:

Go to the source code of this file.

Macros

#define CONTROL_REG   0x64
 Keyboard control register port. More...
 

Functions

static void print_stats (void)
 Print statistics about Pintos execution. More...
 
void shutdown (void)
 Shuts down the machine in the way configured by shutdown_configure(). More...
 
void shutdown_configure (enum shutdown_type type)
 Sets TYPE as the way that machine will shut down when Pintos execution is complete. More...
 
void shutdown_reboot (void)
 Reboots the machine via the keyboard controller. More...
 
void shutdown_power_off (void)
 Powers down the machine we're running on, as long as we're running on Bochs or QEMU. More...
 

Variables

static enum shutdown_type how = SHUTDOWN_NONE
 How to shut down when shutdown() is called. More...
 

Macro Definition Documentation

◆ CONTROL_REG

#define CONTROL_REG   0x64

Keyboard control register port.

Definition at line 18 of file shutdown.c.

Function Documentation

◆ print_stats()

static void print_stats ( void  )
static

Print statistics about Pintos execution.

Definition at line 129 of file shutdown.c.

References block_print_stats(), console_print_stats(), exception_print_stats(), kbd_print_stats(), thread_print_stats(), and timer_print_stats().

Referenced by shutdown_power_off().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown()

void shutdown ( void  )

Shuts down the machine in the way configured by shutdown_configure().

If the shutdown type is SHUTDOWN_NONE (which is the default), returns without doing anything.

Definition at line 29 of file shutdown.c.

References how, shutdown_power_off(), SHUTDOWN_POWER_OFF, shutdown_reboot(), and SHUTDOWN_REBOOT.

Referenced by debug_panic(), and pintos_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown_configure()

void shutdown_configure ( enum shutdown_type  type)

Sets TYPE as the way that machine will shut down when Pintos execution is complete.

Definition at line 50 of file shutdown.c.

References how.

Referenced by parse_options().

Here is the caller graph for this function:

◆ shutdown_power_off()

void shutdown_power_off ( void  )

Powers down the machine we're running on, as long as we're running on Bochs or QEMU.

devices/shutdown.h

Definition at line 88 of file shutdown.c.

References filesys_done(), outb(), outw(), print_stats(), printf(), s, and serial_flush().

Referenced by shutdown(), and usage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown_reboot()

void shutdown_reboot ( void  )

Reboots the machine via the keyboard controller.

Definition at line 57 of file shutdown.c.

References CONTROL_REG, inb(), outb(), printf(), and timer_udelay().

Referenced by keyboard_interrupt(), and shutdown().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ how

enum shutdown_type how = SHUTDOWN_NONE
static

How to shut down when shutdown() is called.

Definition at line 21 of file shutdown.c.

Referenced by shutdown(), and shutdown_configure().