PKUOS - Pintos
Pintos source browser for PKU Operating System course
|
#include "threads/init.h"
#include <console.h>
#include <debug.h>
#include <inttypes.h>
#include <limits.h>
#include <random.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "devices/kbd.h"
#include "devices/input.h"
#include "devices/serial.h"
#include "devices/shutdown.h"
#include "devices/timer.h"
#include "devices/vga.h"
#include "devices/rtc.h"
#include "threads/interrupt.h"
#include "threads/io.h"
#include "threads/loader.h"
#include "threads/malloc.h"
#include "threads/palloc.h"
#include "threads/pte.h"
#include "threads/thread.h"
#include "tests/threads/tests.h"
Go to the source code of this file.
Functions | |
static void | bss_init (void) |
Clear the "BSS", a segment that should be initialized to zeros. More... | |
static void | paging_init (void) |
Populates the base page directory and page table with the kernel virtual mapping, and then sets up the CPU to use the new page directory. More... | |
static char ** | read_command_line (void) |
Breaks the kernel command line into words and returns them as an argv-like array. More... | |
static char ** | parse_options (char **argv) |
Parses options in ARGV[] and returns the first non-option argument. More... | |
static void | run_actions (char **argv) |
Executes all of the actions specified in ARGV[] up to the null pointer sentinel. More... | |
static void | usage (void) |
Prints a kernel command line help message and powers off the machine. More... | |
int | pintos_init (void) |
Pintos main entry point. More... | |
static void | run_task (char **argv) |
Runs the task specified in ARGV[1]. More... | |
Variables | |
uint32_t * | init_page_dir |
Page directory with kernel mappings only. More... | |
static size_t | user_page_limit = SIZE_MAX |
-ul: Maximum number of pages to put into palloc's user pool. More... | |
|
static |
Clear the "BSS", a segment that should be initialized to zeros.
It isn't actually stored on disk or zeroed by the kernel loader, so we have to zero it ourselves.
The start and end of the BSS segment is recorded by the linker as _start_bss and _end_bss. See kernel.lds.
Definition at line 151 of file init.c.
References memset().
Referenced by pintos_init().
|
static |
Populates the base page directory and page table with the kernel virtual mapping, and then sets up the CPU to use the new page directory.
Points init_page_dir to the page directory it creates.
Definition at line 162 of file init.c.
References _start(), init_page_dir, init_ram_pages, NULL, PAL_ASSERT, PAL_ZERO, palloc_get_page(), pd_no(), pde_create(), PGSIZE, pt_no(), pte_create_kernel(), ptov(), and vtop().
Referenced by pintos_init().
|
static |
Parses options in ARGV[] and returns the first non-option argument.
Definition at line 233 of file init.c.
References atoi(), name, NULL, PANIC, random_init(), rtc_get_time(), shutdown_configure(), SHUTDOWN_POWER_OFF, SHUTDOWN_REBOOT, strcmp(), strtok_r(), thread_mlfqs, usage(), and user_page_limit.
Referenced by pintos_init().
int pintos_init | ( | void | ) |
Pintos main entry point.
Definition at line 73 of file init.c.
References bss_init(), console_init(), exception_init(), filesys_init(), gdt_init(), ide_init(), init_ram_pages, input_init(), intr_init(), kbd_init(), malloc_init(), NULL, paging_init(), palloc_init(), parse_options(), PGSIZE, printf(), PRIu32, read_command_line(), run_actions(), serial_init_queue(), shutdown(), syscall_init(), thread_exit(), thread_init(), thread_start(), timer_calibrate(), timer_init(), tss_init(), and user_page_limit.
|
static |
Breaks the kernel command line into words and returns them as an argv-like array.
Definition at line 198 of file init.c.
References LOADER_ARG_CNT, LOADER_ARGS, LOADER_ARGS_LEN, NULL, PANIC, printf(), ptov(), strchr(), and strnlen().
Referenced by pintos_init().
|
static |
Executes all of the actions specified in ARGV[] up to the null pointer sentinel.
< Action name.
< # of args, including action name.
< Function to execute action.
Definition at line 302 of file init.c.
References fsutil_append(), fsutil_cat(), fsutil_extract(), fsutil_ls(), fsutil_rm(), name, NULL, PANIC, run_task(), and strcmp().
Referenced by pintos_init().
|
static |
Runs the task specified in ARGV[1].
Definition at line 286 of file init.c.
References printf(), process_execute(), process_wait(), and run_test().
Referenced by run_actions().
|
static |
Prints a kernel command line help message and powers off the machine.
Definition at line 353 of file init.c.
References printf(), and shutdown_power_off().
Referenced by parse_options().
uint32_t* init_page_dir |
Page directory with kernel mappings only.
FILESYS
Definition at line 42 of file init.c.
Referenced by pagedir_activate(), pagedir_create(), pagedir_destroy(), pagedir_set_page(), and paging_init().
-ul: Maximum number of pages to put into palloc's user pool.
Definition at line 58 of file init.c.
Referenced by palloc_init(), parse_options(), and pintos_init().