X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=doc%2Freference.texi;h=c44988cf810b6e59a5f0d715b20fdd23f3779697;hb=53a7f5d0952a4595f252247f5ee3d017468eb57e;hp=5e4db9e8fc482065383f73f5fe4bb7f7049b4571;hpb=eb5c6a0f64ab2b0a9efa853fa0ef53822af80047;p=pintos-anon diff --git a/doc/reference.texi b/doc/reference.texi index 5e4db9e..c44988c 100644 --- a/doc/reference.texi +++ b/doc/reference.texi @@ -136,30 +136,17 @@ just use @func{memset} to zero it out. The other task of the loader stored it and put it into the @code{ram_pages} variable for later use. -Next, @func{thread_init} initializes the thread system. We will defer -full discussion to our discussion of Pintos threads below. It is -called so early in initialization because the console, initialized -just afterward, tries to use locks, and locks in turn require there to be a -running thread. - -Then we initialize the console so that @func{printf} will work. -@func{main} calls @func{vga_init}, which initializes the VGA text -display and clears the screen. It also calls @func{serial_init_poll} -to initialize the first serial port in ``polling mode,'' that is, -where the kernel busy-waits for the port to be ready for each -character to be output. (We use polling mode until we're ready to enable -interrupts, later.) Finally we initialize the console device and -print a startup message to the console. - -@func{main} calls @func{read_command_line} to break the kernel command +Next, @func{main} calls @func{read_command_line} to break the kernel command line into arguments, then @func{parse_options} to read any options at the beginning of the command line. (Actions specified on the command line execute later.) -@func{main} calls @func{random_init} to initialize the kernel random -number generator. If the user specified @option{-rs} on the -@command{pintos} command line, @func{parse_options} already did -this, but calling it a second time is harmless. +@func{thread_init} initializes the thread system. We will defer full +discussion to our discussion of Pintos threads below. It is called so +early in initialization because a valid thread structure is a +prerequisite for acquiring a lock, and lock acquisition in turn is +important to other Pintos subsystems. Then we initialize the console +and print a startup message to the console. The next block of functions we call initialize the kernel's memory system. @func{palloc_init} sets up the kernel page allocator, which @@ -844,6 +831,11 @@ char get (void) @{ @} @end example +Note that @code{BUF_SIZE} must divide evenly into @code{SIZE_MAX + 1} +for the above code to be completely correct. Otherwise, it will fail +the first time @code{head} wraps around to 0. In practice, +@code{BUF_SIZE} would ordinarily be a power of 2. + @node Optimization Barriers @subsection Optimization Barriers