18#define CONTROL_REG 0x64
69 for (i = 0; i < 0x10000; i++)
90 const char s[] =
"Shutdown";
99 printf (
"Powering off...\n");
103 outw (0xB004, 0x2000);
107 for (p =
s; *p !=
'\0'; p++)
120 asm volatile (
"cli; hlt" : : :
"memory");
123 printf (
"still running...\n");
void block_print_stats(void)
Prints statistics for each block device used for a Pintos role.
void exception_print_stats(void)
Prints exception statistics.
void filesys_done(void)
Shuts down the file system module, writing any unwritten data to disk.
static uint8_t inb(uint16_t port)
Reads and returns a byte from PORT.
static void outw(uint16_t port, uint16_t data)
Writes the 16-bit DATA to PORT.
static void outb(uint16_t port, uint8_t data)
Writes byte DATA to PORT.
void kbd_print_stats(void)
Prints keyboard statistics.
void console_print_stats(void)
Prints console statistics.
int printf(const char *format,...)
Writes formatted output to the console.
static uint8_t s[256]
RC4-based pseudo-random number generator (PRNG).
void serial_flush(void)
Flushes anything in the serial buffer out the port in polling mode.
void shutdown(void)
Shuts down the machine in the way configured by shutdown_configure().
#define CONTROL_REG
Keyboard control register port.
void shutdown_configure(enum shutdown_type type)
Sets TYPE as the way that machine will shut down when Pintos execution is complete.
void shutdown_power_off(void)
Powers down the machine we're running on, as long as we're running on Bochs or QEMU.
void shutdown_reboot(void)
Reboots the machine via the keyboard controller.
static void print_stats(void)
Print statistics about Pintos execution.
static enum shutdown_type how
How to shut down when shutdown() is called.
shutdown_type
How to shut down when Pintos has nothing left to do.
@ SHUTDOWN_POWER_OFF
Power off the machine (if possible).
@ SHUTDOWN_NONE
Loop forever.
@ SHUTDOWN_REBOOT
Reboot the machine (if possible).
void thread_print_stats(void)
Prints thread statistics.
void timer_print_stats(void)
Prints timer statistics.
void timer_udelay(int64_t us)
Sleeps for approximately US microseconds.