📄 multiboot.texi
字号:
Management (APM) BIOS Interface Specification}, for more information.If bit 11 in the @samp{flags} is set, the graphics table is available.This must only be done if the kernel has indicated in the@samp{Multiboot Header} that it accepts a graphics mode.The fields @samp{vbe_control_info} and @samp{vbe_mode_info} containthe physical addresses of @sc{vbe} control information returned by the@sc{vbe} Function 00h and @sc{vbe} mode information returned by the@sc{vbe} Function 01h, respectively.The field @samp{vbe_mode} indicates current video mode in the formatspecified in @sc{vbe} 3.0.The rest fields @samp{vbe_interface_seg}, @samp{vbe_interface_off}, and@samp{vbe_interface_len} contain the table of a protected mode interfacedefined in @sc{vbe} 2.0+. If this information is not available, thosefields contain zero. Note that @sc{vbe} 3.0 defines another protectedmode interface which is incompatible with the old one. If you want touse the new protected mode interface, you will have to find the tableyourself.The fields for the graphics table are designed for @sc{vbe}, butMultiboot boot loaders may simulate @sc{vbe} on non-@sc{vbe} modes, asif they were @sc{vbe} modes.@node Examples@chapter Examples@strong{Caution:} The following items are not part of the specificationdocument, but are included for prospective operating system and bootloader writers.@menu* Notes on PC:: * BIOS device mapping techniques:: * Example OS code:: * Example boot loader code:: @end menu@node Notes on PC@section Notes on PCIn reference to bit 0 of the @samp{flags} parameter in the Multibootinformation structure, if the bootloader in question uses older@sc{bios} interfaces, or the newest ones are not available (seedescription about bit 6), then a maximum of either 15 or 63 megabytes ofmemory may be reported. It is @emph{highly} recommended that bootloaders perform a thorough memory probe.In reference to bit 1 of the @samp{flags} parameter in the Multibootinformation structure, it is recognized that determination of which@sc{bios} drive maps to which device driver in an operating system isnon-trivial, at best. Many kludges have been made to various operatingsystems instead of solving this problem, most of them breaking undermany conditions. To encourage the use of general-purpose solutions tothis problem, there are 2 @sc{bios} device mapping techniques(@pxref{BIOS device mapping techniques}). In reference to bit 6 of the @samp{flags} parameter in the Multibootinformation structure, it is important to note that the data structureused there (starting with @samp{BaseAddrLow}) is the data returned bythe INT 15h, AX=E820h --- Query System Address Map call. See @xref{QuerySystem Address Map, , Query System Address Map, grub.info, The GRUBManual}, for more information. The interface here is meant to allow aboot loader to work unmodified with any reasonable extensions of the@sc{bios} interface, passing along any extra data to be interpreted bythe operating system as desired.@node BIOS device mapping techniques@section BIOS device mapping techniquesBoth of these techniques should be usable from any PC operating system,and neither require any special support in the drivers themselves. Thissection will be flushed out into detailed explanations, particularly forthe I/O restriction technique.The general rule is that the data comparison technique is the quick anddirty solution. It works most of the time, but doesn't cover all thebases, and is relatively simple.The I/O restriction technique is much more complex, but it has potentialto solve the problem under all conditions, plus allow access of theremaining @sc{bios} devices when not all of them have operating systemdrivers.@menu* Data comparison technique:: * I/O restriction technique:: @end menu@node Data comparison technique@subsection Data comparison techniqueBefore activating @emph{any} of the device drivers, gather enough datafrom similar sectors on each of the disks such that each one can beuniquely identified.After activating the device drivers, compare data from the drives usingthe operating system drivers. This should hopefully be sufficient toprovide such a mapping.Problems:@enumerate@itemThe data on some @sc{bios} devices might be identical (so the partreading the drives from the @sc{bios} should have some mechanism to giveup).@itemThere might be extra drives not accessible from the @sc{bios} which areidentical to some drive used by the @sc{bios} (so it should be capableof giving up there as well).@end enumerate@node I/O restriction technique@subsection I/O restriction techniqueThis first step may be unnecessary, but first create copy-on-writemappings for the device drivers writing into @sc{pc} @sc{ram}. Keep theoriginal copies for the @dfn{clean @sc{bios} virtual machine} to becreated later.For each device driver brought online, determine which @sc{bios} devicesbecome inaccessible by:@enumerate@itemCreate a @dfn{clean @sc{bios} virtual machine}.@itemSet the I/O permission map for the I/O area claimed by the device driverto no permissions (neither read nor write).@itemAccess each device.@itemRecord which devices succeed, and those which try to access the@dfn{restricted} I/O areas (hopefully, this will be an @dfn{xor}situation).@end enumerateFor each device driver, given how many of the @sc{bios} devices weresubsumed by it (there should be no gaps in this list), it should be easyto determine which devices on the controller these are.In general, you have at most 2 disks from each controller given@sc{bios} numbers, but they pretty much always count from the lowestlogically numbered devices on the controller.@node Example OS code@section Example OS codeIn this distribution, the example Multiboot kernel @file{kernel} isincluded. The kernel just prints out the Multiboot information structureon the screen, so you can make use of the kernel to test aMultiboot-compliant boot loader and for reference to how to implement aMultiboot kernel. The source files can be found under the directory@file{docs} in the GRUB distribution.The kernel @file{kernel} consists of only three files: @file{boot.S},@file{kernel.c} and @file{multiboot.h}. The assembly source@file{boot.S} is written in GAS (@pxref{Top, , GNU assembler, as.info,The GNU assembler}), and contains the Multiboot information structure tocomply with the specification. When a Multiboot-compliant boot loaderloads and execute it, it initialize the stack pointer and @code{EFLAGS},and then call the function @code{cmain} defined in @file{kernel.c}. If@code{cmain} returns to the callee, then it shows a message to informthe user of the halt state and stops forever until you push the resetkey. The file @file{kernel.c} contains the function @code{cmain},which checks if the magic number passed by the boot loader is valid andso on, and some functions to print messages on the screen. The file@file{multiboot.h} defines some macros, such as the magic number for theMultiboot header, the Multiboot header structure and the Multibootinformation structure.@menu* multiboot.h:: * boot.S:: * kernel.c:: * Other Multiboot kernels:: @end menu@node multiboot.h@subsection multiboot.hThis is the source code in the file @file{multiboot.h}:@example@include multiboot.h.texi@end example@node boot.S@subsection boot.SIn the file @file{boot.S}:@example@include boot.S.texi@end example@node kernel.c@subsection kernel.cAnd, in the file @file{kernel.c}:@example@include kernel.c.texi@end example@node Other Multiboot kernels@subsection Other Multiboot kernelsOther useful information should be available in Multiboot kernels, suchas GNU Mach and Fiasco @url{http://os.inf.tu-dresden.de/fiasco/}. And,it is worth mentioning the OSKit@url{http://www.cs.utah.edu/projects/flux/oskit/}, which provides alibrary supporting the specification.@node Example boot loader code@section Example boot loader codeThe GNU GRUB (@pxref{Top, , GRUB, grub.info, The GRUB manual}) projectis a full Multiboot-compliant boot loader, supporting all required andoptional features present in this specification. A public release hasnot been made, but the test release is available from:@url{ftp://alpha.gnu.org/gnu/grub}See the webpage @url{http://www.gnu.org/software/grub/grub.html}, formore information.@node History@chapter The change log of this specification@table @asis@item 0.7@itemize @bullet@item@dfn{Multiboot Standard} is renamed to @dfn{Multiboot Specification}.@itemGraphics fields are added to Multiboot header.@itemBIOS drive information, BIOS configuration table, the name of a bootloader, APM information, and graphics information are added to Multibootinformation.@itemRewritten in Texinfo format.@itemRewritten, using more strict words.@itemThe maintainer changes to the GNU GRUB maintainer team@email{bug-grub@@gnu.org}, from Bryan Ford and Erich Stefan Boleyn.@end itemize@item 0.6@itemize @bullet@itemA few wording changes.@itemHeader checksum.@itemClasification of machine state passed to an operating system.@end itemize@item 0.5@itemize @bullet@itemName change.@end itemize@item 0.4@itemize @bullet@itemMajor changes plus HTMLification.@end itemize@end table@node Index@unnumbered Index@printindex cp@contents@bye
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -