Rewrite the sections "Header graphics fields" and "Machine state".

This commit is contained in:
okuji 2002-06-16 03:12:58 +00:00
parent 52c5e2e399
commit fada891e5c

View file

@ -486,86 +486,97 @@ start running the operating system.
@node Header graphics fields @node Header graphics fields
@subsection The graphics fields of Multiboot header @subsection The graphics fields of Multiboot header
Also, information about a preferred default mode can be specified in the All of the graphics fields are enabled by flag bit 2. They specify the
@samp{mode_type}, @samp{width}, @samp{height} and @samp{depth} preferred graphics mode. Note that that is only a @emph{recommended}
fields. This is only a @emph{recommended} mode by the kernel. If the mode by the OS image. If the mode exists, the boot loader should set
mode exists, the boot loader should set it if the user hasn't specified it, when the user doesn't specify a mode explicitly. Otherwise, the
a mode. If not, it should fall back to a similar mode, if available. boot loader should fall back to a similar mode, if available.
Valid numbers for @samp{mode_type} is 0 for linear graphics mode and 1 The meaning of each is as follows:
for EGA-standard text mode. Everything else is reserved for future
expansion. Please note that even if you set this field to indicate that
you want a graphics mode, you might get a text mode.
@samp{width} and @samp{height} is specified in pixels, if graphics mode, @table @code
or characters in EGA text mode. @samp{depth} is given in bits per pixel @item mode_type
for graphics, or zero for EGA text modes. Contains @samp{0} for linear graphics mode or @samp{1} for
EGA-standard text mode. Everything else is reserved for future
expansion. Note that the boot loader may set a text mode, even if this
field contains @samp{0}.
Any, some or all of those three fields may be set to zero, indicating to @item width
the boot loader that no preference is given. This makes it possible for Contains the number of the columns. This is specified in pixels in a
a kernel to just say it wants a 32-bit resolution, for example. graphics mode, and in characters in a text mode. The value zero
indicates that the OS image has no preference.
@item height
Contains the number of the lines. This is specified in pixels in a
graphics mode, and in characters in a text mode. The value zero
indicates that the OS image has no preference.
@item depth
Contains the number of bits per pixel in a graphics mode, and zero in
a text mode. The value zero indicates that the OS image has no
preference.
@end table
@node Machine state @node Machine state
@section Machine state @section Machine state
FIXME: Use a table like the chapter ``Header layout''.
When the boot loader invokes the 32-bit operating system, the machine When the boot loader invokes the 32-bit operating system, the machine
must have the following state: must have the following state:
@itemize @bullet @table @samp
@item @item EAX
@code{CS} must be a 32-bit read/execute code segment with an offset of 0 Must contain the magic value @samp{0x2BADB002}; the presence of this
and a limit of 0xFFFFFFFF.
@item
@code{DS}, @code{ES}, @code{FS}, @code{GS}, and @code{SS} must be a
32-bit read/write data segment with an offset of 0 and a limit of
0xFFFFFFFF.
@item
The address 20 line must be usable for standard linear 32-bit addressing
of memory (in standard @sc{pc} hardware, it is wired to 0 at bootup,
forcing addresses in the 1-2 MB range to be mapped to the 0-1 MB range,
3-4 is mapped to 2-3, etc.).
@item
Paging must be turned off.
@item
The processor interrupt flag must be turned off.
@item
@code{EAX} must contain the magic value 0x2BADB002; the presence of this
value indicates to the operating system that it was loaded by a value indicates to the operating system that it was loaded by a
Multiboot-compliant boot loader (e.g. as opposed to another type of boot Multiboot-compliant boot loader (e.g. as opposed to another type of
loader that the operating system can also be loaded from). boot loader that the operating system can also be loaded from).
@item @item EBX
@code{EBX} must contain the 32-bit physical address of the Multiboot Must contain the 32-bit physical address of the Multiboot
information structure provided by the boot loader (@pxref{Boot information structure provided by the boot loader (@pxref{Boot
information format}). information format}).
@end itemize
@item CS
Must be a 32-bit read/execute code segment with an offset of @samp{0}
and a limit of @samp{0xFFFFFFFF}. The exact value is undefined.
@item DS
@itemx ES
@itemx FS
@itemx GS
@itemx SS
Must be a 32-bit read/write data segment with an offset of @samp{0}
and a limit of @samp{0xFFFFFFFF}. The exact values are all undefined.
@item A20 gate
Must be enabled.
@item CR0
Bit 31 (PG) must be cleared. Bit 0 (PE) must be set. Other bits are
all undefined.
@item EFLAGS
Bit 17 (VM) must be cleared. Bit 9 (IF) must be cleared. Other bits
are all undefined.
@end table
All other processor registers and flag bits are undefined. This All other processor registers and flag bits are undefined. This
includes, in particular: includes, in particular:
@itemize @bullet @table @samp
@item @item ESP
@code{ESP}: the 32-bit operating system must create its own stack as The OS image must create its own stack as soon as it needs one.
soon as it needs one.
@item @item GDTR
@code{GDTR}: Even though the segment registers are set up as described Even though the segment registers are set up as described above, the
above, the @code{GDTR} may be invalid, so the operating system must not @samp{GDTR} may be invalid, so the OS image must not load any segment
load any segment registers (even just reloading the same values!) until registers (even just reloading the same values!) until it sets up its
it sets up its own @code{GDT}. own @samp{GDT}.
@item @item IDTR
@code{IDTR}: The operating system must leave interrupts disabled until The OS image must leave interrupts disabled until it sets up its own
it sets up its own @code{IDT}. @code{IDT}.
@end itemize @end table
However, other machine state should be left by the boot loader in However, other machine state should be left by the boot loader in
@dfn{normal working order}, i.e. as initialized by the @sc{bios} (or @dfn{normal working order}, i.e. as initialized by the @sc{bios} (or
@ -1154,7 +1165,7 @@ is a full Multiboot-compliant boot loader, supporting all required and
optional features present in this specification. A public release has optional features present in this specification. A public release has
not been made, but the test release is available from: not been made, but the test release is available from:
@url{ftp://alpha.gnu.org/gnu/hurd/src/} @url{ftp://alpha.gnu.org/gnu/grub}
See the webpage @url{http://www.gnu.org/software/grub/grub.html}, for See the webpage @url{http://www.gnu.org/software/grub/grub.html}, for
more information. more information.