xref: /onnv-gate/usr/src/grub/grub-0.97/docs/multiboot.texi (revision 8044:b3af80bbf173)
1*8044SWilliam.Kucharski@Sun.COM\input texinfo @c -*-texinfo-*-
2*8044SWilliam.Kucharski@Sun.COM@c -*-texinfo-*-
3*8044SWilliam.Kucharski@Sun.COM@c %**start of header
4*8044SWilliam.Kucharski@Sun.COM@setfilename multiboot.info
5*8044SWilliam.Kucharski@Sun.COM@settitle Multiboot Specification
6*8044SWilliam.Kucharski@Sun.COM@c %**end of header
7*8044SWilliam.Kucharski@Sun.COM
8*8044SWilliam.Kucharski@Sun.COM@c Unify all our little indices for now.
9*8044SWilliam.Kucharski@Sun.COM@syncodeindex fn cp
10*8044SWilliam.Kucharski@Sun.COM@syncodeindex vr cp
11*8044SWilliam.Kucharski@Sun.COM@syncodeindex ky cp
12*8044SWilliam.Kucharski@Sun.COM@syncodeindex pg cp
13*8044SWilliam.Kucharski@Sun.COM@syncodeindex tp cp
14*8044SWilliam.Kucharski@Sun.COM
15*8044SWilliam.Kucharski@Sun.COM@footnotestyle separate
16*8044SWilliam.Kucharski@Sun.COM@paragraphindent 3
17*8044SWilliam.Kucharski@Sun.COM@finalout
18*8044SWilliam.Kucharski@Sun.COM
19*8044SWilliam.Kucharski@Sun.COM
20*8044SWilliam.Kucharski@Sun.COM@dircategory Kernel
21*8044SWilliam.Kucharski@Sun.COM@direntry
22*8044SWilliam.Kucharski@Sun.COM* Multiboot Specification: (multiboot).		Multiboot Specification.
23*8044SWilliam.Kucharski@Sun.COM@end direntry
24*8044SWilliam.Kucharski@Sun.COM
25*8044SWilliam.Kucharski@Sun.COM@ifinfo
26*8044SWilliam.Kucharski@Sun.COMCopyright @copyright{} 1995, 96 Bryan Ford <baford@@cs.utah.edu>
27*8044SWilliam.Kucharski@Sun.COMCopyright @copyright{} 1995, 96 Erich Stefan Boleyn <erich@@uruk.org>
28*8044SWilliam.Kucharski@Sun.COMCopyright @copyright{} 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
29*8044SWilliam.Kucharski@Sun.COM
30*8044SWilliam.Kucharski@Sun.COMPermission is granted to make and distribute verbatim copies of
31*8044SWilliam.Kucharski@Sun.COMthis manual provided the copyright notice and this permission notice
32*8044SWilliam.Kucharski@Sun.COMare preserved on all copies.
33*8044SWilliam.Kucharski@Sun.COM
34*8044SWilliam.Kucharski@Sun.COM@ignore
35*8044SWilliam.Kucharski@Sun.COMPermission is granted to process this file through TeX and print the
36*8044SWilliam.Kucharski@Sun.COMresults, provided the printed document carries a copying permission
37*8044SWilliam.Kucharski@Sun.COMnotice identical to this one except for the removal of this paragraph
38*8044SWilliam.Kucharski@Sun.COM(this paragraph not being relevant to the printed manual).
39*8044SWilliam.Kucharski@Sun.COM
40*8044SWilliam.Kucharski@Sun.COM@end ignore
41*8044SWilliam.Kucharski@Sun.COM
42*8044SWilliam.Kucharski@Sun.COMPermission is granted to copy and distribute modified versions of this
43*8044SWilliam.Kucharski@Sun.COMmanual under the conditions for verbatim copying, provided also that
44*8044SWilliam.Kucharski@Sun.COMthe entire resulting derived work is distributed under the terms of a
45*8044SWilliam.Kucharski@Sun.COMpermission notice identical to this one.
46*8044SWilliam.Kucharski@Sun.COM
47*8044SWilliam.Kucharski@Sun.COMPermission is granted to copy and distribute translations of this manual
48*8044SWilliam.Kucharski@Sun.COMinto another language, under the above conditions for modified versions.
49*8044SWilliam.Kucharski@Sun.COM@end ifinfo
50*8044SWilliam.Kucharski@Sun.COM
51*8044SWilliam.Kucharski@Sun.COM@titlepage
52*8044SWilliam.Kucharski@Sun.COM@sp 10
53*8044SWilliam.Kucharski@Sun.COM@title The Multiboot Specification
54*8044SWilliam.Kucharski@Sun.COM@author Yoshinori K. Okuji, Bryan Ford, Erich Stefan Boleyn, Kunihiro Ishiguro
55*8044SWilliam.Kucharski@Sun.COM@page
56*8044SWilliam.Kucharski@Sun.COM
57*8044SWilliam.Kucharski@Sun.COM@vskip 0pt plus 1filll
58*8044SWilliam.Kucharski@Sun.COMCopyright @copyright{} 1995, 96 Bryan Ford <baford@@cs.utah.edu>
59*8044SWilliam.Kucharski@Sun.COMCopyright @copyright{} 1995, 96 Erich Stefan Boleyn <erich@@uruk.org>
60*8044SWilliam.Kucharski@Sun.COMCopyright @copyright{} 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
61*8044SWilliam.Kucharski@Sun.COM
62*8044SWilliam.Kucharski@Sun.COMPermission is granted to make and distribute verbatim copies of
63*8044SWilliam.Kucharski@Sun.COMthis manual provided the copyright notice and this permission notice
64*8044SWilliam.Kucharski@Sun.COMare preserved on all copies.
65*8044SWilliam.Kucharski@Sun.COM
66*8044SWilliam.Kucharski@Sun.COMPermission is granted to copy and distribute modified versions of this
67*8044SWilliam.Kucharski@Sun.COMmanual under the conditions for verbatim copying, provided also that
68*8044SWilliam.Kucharski@Sun.COMthe entire resulting derived work is distributed under the terms of a
69*8044SWilliam.Kucharski@Sun.COMpermission notice identical to this one.
70*8044SWilliam.Kucharski@Sun.COM
71*8044SWilliam.Kucharski@Sun.COMPermission is granted to copy and distribute translations of this manual
72*8044SWilliam.Kucharski@Sun.COMinto another language, under the above conditions for modified versions.
73*8044SWilliam.Kucharski@Sun.COM@end titlepage
74*8044SWilliam.Kucharski@Sun.COM
75*8044SWilliam.Kucharski@Sun.COM@finalout
76*8044SWilliam.Kucharski@Sun.COM@headings double
77*8044SWilliam.Kucharski@Sun.COM
78*8044SWilliam.Kucharski@Sun.COM@ifnottex
79*8044SWilliam.Kucharski@Sun.COM@node Top
80*8044SWilliam.Kucharski@Sun.COM@top Multiboot Specification
81*8044SWilliam.Kucharski@Sun.COM
82*8044SWilliam.Kucharski@Sun.COMThis file documents Multiboot Specification, the proposal for the boot
83*8044SWilliam.Kucharski@Sun.COMsequence standard. This edition documents version 0.6.93.
84*8044SWilliam.Kucharski@Sun.COM@end ifnottex
85*8044SWilliam.Kucharski@Sun.COM
86*8044SWilliam.Kucharski@Sun.COM@menu
87*8044SWilliam.Kucharski@Sun.COM* Overview::
88*8044SWilliam.Kucharski@Sun.COM* Terminology::
89*8044SWilliam.Kucharski@Sun.COM* Specification::
90*8044SWilliam.Kucharski@Sun.COM* Examples::
91*8044SWilliam.Kucharski@Sun.COM* History::
92*8044SWilliam.Kucharski@Sun.COM* Index::
93*8044SWilliam.Kucharski@Sun.COM@end menu
94*8044SWilliam.Kucharski@Sun.COM
95*8044SWilliam.Kucharski@Sun.COM
96*8044SWilliam.Kucharski@Sun.COM@node Overview
97*8044SWilliam.Kucharski@Sun.COM@chapter Introduction to Multiboot Specification
98*8044SWilliam.Kucharski@Sun.COM
99*8044SWilliam.Kucharski@Sun.COMThis chapter describes some rough information on the Multiboot
100*8044SWilliam.Kucharski@Sun.COMSpecification. Note that this is not a part of the specification itself.
101*8044SWilliam.Kucharski@Sun.COM
102*8044SWilliam.Kucharski@Sun.COM@menu
103*8044SWilliam.Kucharski@Sun.COM* Motivation::
104*8044SWilliam.Kucharski@Sun.COM* Architecture::
105*8044SWilliam.Kucharski@Sun.COM* Operating systems::
106*8044SWilliam.Kucharski@Sun.COM* Boot sources::
107*8044SWilliam.Kucharski@Sun.COM* Boot-time configuration::
108*8044SWilliam.Kucharski@Sun.COM* Convenience to operating systems::
109*8044SWilliam.Kucharski@Sun.COM* Boot modules::
110*8044SWilliam.Kucharski@Sun.COM@end menu
111*8044SWilliam.Kucharski@Sun.COM
112*8044SWilliam.Kucharski@Sun.COM
113*8044SWilliam.Kucharski@Sun.COM@node Motivation
114*8044SWilliam.Kucharski@Sun.COM@section The background of Multiboot Specification
115*8044SWilliam.Kucharski@Sun.COM
116*8044SWilliam.Kucharski@Sun.COMEvery operating system ever created tends to have its own boot loader.
117*8044SWilliam.Kucharski@Sun.COMInstalling a new operating system on a machine generally involves
118*8044SWilliam.Kucharski@Sun.COMinstalling a whole new set of boot mechanisms, each with completely
119*8044SWilliam.Kucharski@Sun.COMdifferent install-time and boot-time user interfaces. Getting multiple
120*8044SWilliam.Kucharski@Sun.COMoperating systems to coexist reliably on one machine through typical
121*8044SWilliam.Kucharski@Sun.COM@dfn{chaining} mechanisms can be a nightmare. There is little or no
122*8044SWilliam.Kucharski@Sun.COMchoice of boot loaders for a particular operating system --- if the one
123*8044SWilliam.Kucharski@Sun.COMthat comes with the operating system doesn't do exactly what you want,
124*8044SWilliam.Kucharski@Sun.COMor doesn't work on your machine, you're screwed.
125*8044SWilliam.Kucharski@Sun.COM
126*8044SWilliam.Kucharski@Sun.COMWhile we may not be able to fix this problem in existing commercial
127*8044SWilliam.Kucharski@Sun.COMoperating systems, it shouldn't be too difficult for a few people in the
128*8044SWilliam.Kucharski@Sun.COMfree operating system communities to put their heads together and solve
129*8044SWilliam.Kucharski@Sun.COMthis problem for the popular free operating systems. That's what this
130*8044SWilliam.Kucharski@Sun.COMspecification aims for. Basically, it specifies an interface between a
131*8044SWilliam.Kucharski@Sun.COMboot loader and a operating system, such that any complying boot loader
132*8044SWilliam.Kucharski@Sun.COMshould be able to load any complying operating system. This
133*8044SWilliam.Kucharski@Sun.COMspecification does @emph{not} specify how boot loaders should work ---
134*8044SWilliam.Kucharski@Sun.COMonly how they must interface with the operating system being loaded.
135*8044SWilliam.Kucharski@Sun.COM
136*8044SWilliam.Kucharski@Sun.COM
137*8044SWilliam.Kucharski@Sun.COM@node Architecture
138*8044SWilliam.Kucharski@Sun.COM@section The target architecture
139*8044SWilliam.Kucharski@Sun.COM
140*8044SWilliam.Kucharski@Sun.COMThis specification is primarily targeted at @sc{pc}, since they are the
141*8044SWilliam.Kucharski@Sun.COMmost common and have the largest variety of operating systems and boot
142*8044SWilliam.Kucharski@Sun.COMloaders. However, to the extent that certain other architectures may
143*8044SWilliam.Kucharski@Sun.COMneed a boot specification and do not have one already, a variation of
144*8044SWilliam.Kucharski@Sun.COMthis specification, stripped of the x86-specific details, could be
145*8044SWilliam.Kucharski@Sun.COMadopted for them as well.
146*8044SWilliam.Kucharski@Sun.COM
147*8044SWilliam.Kucharski@Sun.COM
148*8044SWilliam.Kucharski@Sun.COM@node Operating systems
149*8044SWilliam.Kucharski@Sun.COM@section The target operating systems
150*8044SWilliam.Kucharski@Sun.COM
151*8044SWilliam.Kucharski@Sun.COMThis specification is targeted toward free 32-bit operating systems
152*8044SWilliam.Kucharski@Sun.COMthat can be fairly easily modified to support the specification without
153*8044SWilliam.Kucharski@Sun.COMgoing through lots of bureaucratic rigmarole. The particular free
154*8044SWilliam.Kucharski@Sun.COMoperating systems that this specification is being primarily designed
155*8044SWilliam.Kucharski@Sun.COMfor are Linux, FreeBSD, NetBSD, Mach, and VSTa. It is hoped that other
156*8044SWilliam.Kucharski@Sun.COMemerging free operating systems will adopt it from the start, and thus
157*8044SWilliam.Kucharski@Sun.COMimmediately be able to take advantage of existing boot loaders. It would
158*8044SWilliam.Kucharski@Sun.COMbe nice if commercial operating system vendors eventually adopted this
159*8044SWilliam.Kucharski@Sun.COMspecification as well, but that's probably a pipe dream.
160*8044SWilliam.Kucharski@Sun.COM
161*8044SWilliam.Kucharski@Sun.COM
162*8044SWilliam.Kucharski@Sun.COM@node Boot sources
163*8044SWilliam.Kucharski@Sun.COM@section Boot sources
164*8044SWilliam.Kucharski@Sun.COM
165*8044SWilliam.Kucharski@Sun.COMIt should be possible to write compliant boot loaders that load the OS
166*8044SWilliam.Kucharski@Sun.COMimage from a variety of sources, including floppy disk, hard disk, and
167*8044SWilliam.Kucharski@Sun.COMacross a network.
168*8044SWilliam.Kucharski@Sun.COM
169*8044SWilliam.Kucharski@Sun.COMDisk-based boot loaders may use a variety of techniques to find the
170*8044SWilliam.Kucharski@Sun.COMrelevant OS image and boot module data on disk, such as by
171*8044SWilliam.Kucharski@Sun.COMinterpretation of specific file systems (e.g. the BSD/Mach boot loader),
172*8044SWilliam.Kucharski@Sun.COMusing precalculated @dfn{block lists} (e.g. LILO), loading from a
173*8044SWilliam.Kucharski@Sun.COMspecial @dfn{boot partition} (e.g. OS/2), or even loading from within
174*8044SWilliam.Kucharski@Sun.COManother operating system (e.g. the VSTa boot code, which loads from
175*8044SWilliam.Kucharski@Sun.COMDOS). Similarly, network-based boot loaders could use a variety of
176*8044SWilliam.Kucharski@Sun.COMnetwork hardware and protocols.
177*8044SWilliam.Kucharski@Sun.COM
178*8044SWilliam.Kucharski@Sun.COMIt is hoped that boot loaders will be created that support multiple
179*8044SWilliam.Kucharski@Sun.COMloading mechanisms, increasing their portability, robustness, and
180*8044SWilliam.Kucharski@Sun.COMuser-friendliness.
181*8044SWilliam.Kucharski@Sun.COM
182*8044SWilliam.Kucharski@Sun.COM
183*8044SWilliam.Kucharski@Sun.COM@node Boot-time configuration
184*8044SWilliam.Kucharski@Sun.COM@section Configure an operating system at boot-time
185*8044SWilliam.Kucharski@Sun.COM
186*8044SWilliam.Kucharski@Sun.COMIt is often necessary for one reason or another for the user to be able
187*8044SWilliam.Kucharski@Sun.COMto provide some configuration information to an operating system
188*8044SWilliam.Kucharski@Sun.COMdynamically at boot time. While this specification should not dictate
189*8044SWilliam.Kucharski@Sun.COMhow this configuration information is obtained by the boot loader, it
190*8044SWilliam.Kucharski@Sun.COMshould provide a standard means for the boot loader to pass such
191*8044SWilliam.Kucharski@Sun.COMinformation to the operating system.
192*8044SWilliam.Kucharski@Sun.COM
193*8044SWilliam.Kucharski@Sun.COM
194*8044SWilliam.Kucharski@Sun.COM@node Convenience to operating systems
195*8044SWilliam.Kucharski@Sun.COM@section How to make OS development easier
196*8044SWilliam.Kucharski@Sun.COM
197*8044SWilliam.Kucharski@Sun.COMOS images should be easy to generate. Ideally, an OS image should simply
198*8044SWilliam.Kucharski@Sun.COMbe an ordinary 32-bit executable file in whatever file format the
199*8044SWilliam.Kucharski@Sun.COMoperating system normally uses. It should be possible to @code{nm} or
200*8044SWilliam.Kucharski@Sun.COMdisassemble OS images just like normal executables. Specialized tools
201*8044SWilliam.Kucharski@Sun.COMshould not be required to create OS images in a @emph{special} file
202*8044SWilliam.Kucharski@Sun.COMformat. If this means shifting some work from the operating system to
203*8044SWilliam.Kucharski@Sun.COMa boot loader, that is probably appropriate, because all the memory
204*8044SWilliam.Kucharski@Sun.COMconsumed by the boot loader will typically be made available again after
205*8044SWilliam.Kucharski@Sun.COMthe boot process is created, whereas every bit of code in the OS image
206*8044SWilliam.Kucharski@Sun.COMtypically has to remain in memory forever. The operating system should
207*8044SWilliam.Kucharski@Sun.COMnot have to worry about getting into 32-bit mode initially, because mode
208*8044SWilliam.Kucharski@Sun.COMswitching code generally needs to be in the boot loader anyway in order
209*8044SWilliam.Kucharski@Sun.COMto load operating system data above the 1MB boundary, and forcing the
210*8044SWilliam.Kucharski@Sun.COMoperating system to do this makes creation of OS images much more
211*8044SWilliam.Kucharski@Sun.COMdifficult.
212*8044SWilliam.Kucharski@Sun.COM
213*8044SWilliam.Kucharski@Sun.COMUnfortunately, there is a horrendous variety of executable file formats
214*8044SWilliam.Kucharski@Sun.COMeven among free Unix-like @sc{pc}-based operating systems --- generally
215*8044SWilliam.Kucharski@Sun.COMa different format for each operating system. Most of the relevant free
216*8044SWilliam.Kucharski@Sun.COMoperating systems use some variant of a.out format, but some are moving
217*8044SWilliam.Kucharski@Sun.COMto @sc{elf}. It is highly desirable for boot loaders not to have to be
218*8044SWilliam.Kucharski@Sun.COMable to interpret all the different types of executable file formats in
219*8044SWilliam.Kucharski@Sun.COMexistence in order to load the OS image --- otherwise the boot loader
220*8044SWilliam.Kucharski@Sun.COMeffectively becomes operating system specific again.
221*8044SWilliam.Kucharski@Sun.COM
222*8044SWilliam.Kucharski@Sun.COMThis specification adopts a compromise solution to this
223*8044SWilliam.Kucharski@Sun.COMproblem. Multiboot-compliant OS images always contain a magic
224*8044SWilliam.Kucharski@Sun.COM@dfn{Multiboot header} (@pxref{OS image format}), which allows the boot
225*8044SWilliam.Kucharski@Sun.COMloader to load the image without having to understand numerous a.out
226*8044SWilliam.Kucharski@Sun.COMvariants or other executable formats. This magic header does not need to
227*8044SWilliam.Kucharski@Sun.COMbe at the very beginning of the executable file, so kernel images can
228*8044SWilliam.Kucharski@Sun.COMstill conform to the local a.out format variant in addition to being
229*8044SWilliam.Kucharski@Sun.COMMultiboot-compliant.
230*8044SWilliam.Kucharski@Sun.COM
231*8044SWilliam.Kucharski@Sun.COM
232*8044SWilliam.Kucharski@Sun.COM@node Boot modules
233*8044SWilliam.Kucharski@Sun.COM@section Boot modules
234*8044SWilliam.Kucharski@Sun.COM
235*8044SWilliam.Kucharski@Sun.COMMany modern operating system kernels, such as those of VSTa and Mach, do
236*8044SWilliam.Kucharski@Sun.COMnot by themselves contain enough mechanism to get the system fully
237*8044SWilliam.Kucharski@Sun.COMoperational: they require the presence of additional software modules at
238*8044SWilliam.Kucharski@Sun.COMboot time in order to access devices, mount file systems, etc. While
239*8044SWilliam.Kucharski@Sun.COMthese additional modules could be embedded in the main OS image along
240*8044SWilliam.Kucharski@Sun.COMwith the kernel itself, and the resulting image be split apart manually
241*8044SWilliam.Kucharski@Sun.COMby the operating system when it receives control, it is often more
242*8044SWilliam.Kucharski@Sun.COMflexible, more space-efficient, and more convenient to the operating
243*8044SWilliam.Kucharski@Sun.COMsystem and user if the boot loader can load these additional modules
244*8044SWilliam.Kucharski@Sun.COMindependently in the first place.
245*8044SWilliam.Kucharski@Sun.COM
246*8044SWilliam.Kucharski@Sun.COMThus, this specification should provide a standard method for a boot
247*8044SWilliam.Kucharski@Sun.COMloader to indicate to the operating system what auxiliary boot modules
248*8044SWilliam.Kucharski@Sun.COMwere loaded, and where they can be found. Boot loaders don't have to
249*8044SWilliam.Kucharski@Sun.COMsupport multiple boot modules, but they are strongly encouraged to,
250*8044SWilliam.Kucharski@Sun.COMbecause some operating systems will be unable to boot without them.
251*8044SWilliam.Kucharski@Sun.COM
252*8044SWilliam.Kucharski@Sun.COM
253*8044SWilliam.Kucharski@Sun.COM@node Terminology
254*8044SWilliam.Kucharski@Sun.COM@chapter The definitions of terms used through the specification
255*8044SWilliam.Kucharski@Sun.COM
256*8044SWilliam.Kucharski@Sun.COM@table @dfn
257*8044SWilliam.Kucharski@Sun.COM@item must
258*8044SWilliam.Kucharski@Sun.COMWe use the term @dfn{must}, when any boot loader or OS image needs to
259*8044SWilliam.Kucharski@Sun.COMfollow a rule --- otherwise, the boot loader or OS image is @emph{not}
260*8044SWilliam.Kucharski@Sun.COMMultiboot-compliant.
261*8044SWilliam.Kucharski@Sun.COM
262*8044SWilliam.Kucharski@Sun.COM@item should
263*8044SWilliam.Kucharski@Sun.COMWe use the term @dfn{should}, when any boot loader or OS image is
264*8044SWilliam.Kucharski@Sun.COMrecommended to follow a rule, but it doesn't need to follow the rule.
265*8044SWilliam.Kucharski@Sun.COM
266*8044SWilliam.Kucharski@Sun.COM@item may
267*8044SWilliam.Kucharski@Sun.COMWe use the term @dfn{may}, when any boot loader or OS image is allowed
268*8044SWilliam.Kucharski@Sun.COMto follow a rule.
269*8044SWilliam.Kucharski@Sun.COM
270*8044SWilliam.Kucharski@Sun.COM@item boot loader
271*8044SWilliam.Kucharski@Sun.COMWhatever program or set of programs loads the image of the final
272*8044SWilliam.Kucharski@Sun.COMoperating system to be run on the machine. The boot loader may itself
273*8044SWilliam.Kucharski@Sun.COMconsist of several stages, but that is an implementation detail not
274*8044SWilliam.Kucharski@Sun.COMrelevant to this specification. Only the @emph{final} stage of the boot
275*8044SWilliam.Kucharski@Sun.COMloader --- the stage that eventually transfers control to an operating
276*8044SWilliam.Kucharski@Sun.COMsystem --- must follow the rules specified in this document in order
277*8044SWilliam.Kucharski@Sun.COMto be @dfn{Multiboot-compliant}; earlier boot loader stages may be
278*8044SWilliam.Kucharski@Sun.COMdesigned in whatever way is most convenient.
279*8044SWilliam.Kucharski@Sun.COM
280*8044SWilliam.Kucharski@Sun.COM@item OS image
281*8044SWilliam.Kucharski@Sun.COMThe initial binary image that a boot loader loads into memory and
282*8044SWilliam.Kucharski@Sun.COMtransfers control to start an operating system. The OS image is
283*8044SWilliam.Kucharski@Sun.COMtypically an executable containing the operating system kernel.
284*8044SWilliam.Kucharski@Sun.COM
285*8044SWilliam.Kucharski@Sun.COM@item boot module
286*8044SWilliam.Kucharski@Sun.COMOther auxiliary files that a boot loader loads into memory along with
287*8044SWilliam.Kucharski@Sun.COMan OS image, but does not interpret in any way other than passing their
288*8044SWilliam.Kucharski@Sun.COMlocations to the operating system when it is invoked.
289*8044SWilliam.Kucharski@Sun.COM
290*8044SWilliam.Kucharski@Sun.COM@item Multiboot-compliant
291*8044SWilliam.Kucharski@Sun.COMA boot loader or an OS image which follows the rules defined as
292*8044SWilliam.Kucharski@Sun.COM@dfn{must} is Multiboot-compliant. When this specification specifies a
293*8044SWilliam.Kucharski@Sun.COMrule as @dfn{should} or @dfn{may}, a Multiboot-complaint boot loader/OS
294*8044SWilliam.Kucharski@Sun.COMimage doesn't need to follow the rule.
295*8044SWilliam.Kucharski@Sun.COM
296*8044SWilliam.Kucharski@Sun.COM@item u8
297*8044SWilliam.Kucharski@Sun.COMThe type of unsigned 8-bit data.
298*8044SWilliam.Kucharski@Sun.COM
299*8044SWilliam.Kucharski@Sun.COM@item u16
300*8044SWilliam.Kucharski@Sun.COMThe type of unsigned 16-bit data. Because the target architecture is
301*8044SWilliam.Kucharski@Sun.COMlittle-endian, u16 is coded in little-endian.
302*8044SWilliam.Kucharski@Sun.COM
303*8044SWilliam.Kucharski@Sun.COM@item u32
304*8044SWilliam.Kucharski@Sun.COMThe type of unsigned 32-bit data. Because the target architecture is
305*8044SWilliam.Kucharski@Sun.COMlittle-endian, u32 is coded in little-endian.
306*8044SWilliam.Kucharski@Sun.COM
307*8044SWilliam.Kucharski@Sun.COM@item u64
308*8044SWilliam.Kucharski@Sun.COMThe type of unsigned 64-bit data. Because the target architecture is
309*8044SWilliam.Kucharski@Sun.COMlittle-endian, u64 is coded in little-endian.
310*8044SWilliam.Kucharski@Sun.COM@end table
311*8044SWilliam.Kucharski@Sun.COM
312*8044SWilliam.Kucharski@Sun.COM
313*8044SWilliam.Kucharski@Sun.COM@node Specification
314*8044SWilliam.Kucharski@Sun.COM@chapter The exact definitions of Multiboot Specification
315*8044SWilliam.Kucharski@Sun.COM
316*8044SWilliam.Kucharski@Sun.COMThere are three main aspects of a boot loader/OS image interface:
317*8044SWilliam.Kucharski@Sun.COM
318*8044SWilliam.Kucharski@Sun.COM@enumerate
319*8044SWilliam.Kucharski@Sun.COM@item
320*8044SWilliam.Kucharski@Sun.COMThe format of an OS image as seen by a boot loader.
321*8044SWilliam.Kucharski@Sun.COM
322*8044SWilliam.Kucharski@Sun.COM@item
323*8044SWilliam.Kucharski@Sun.COMThe state of a machine when a boot loader starts an operating
324*8044SWilliam.Kucharski@Sun.COMsystem.
325*8044SWilliam.Kucharski@Sun.COM
326*8044SWilliam.Kucharski@Sun.COM@item
327*8044SWilliam.Kucharski@Sun.COMThe format of information passed by a boot loader to an operating
328*8044SWilliam.Kucharski@Sun.COMsystem.
329*8044SWilliam.Kucharski@Sun.COM@end enumerate
330*8044SWilliam.Kucharski@Sun.COM
331*8044SWilliam.Kucharski@Sun.COM@menu
332*8044SWilliam.Kucharski@Sun.COM* OS image format::
333*8044SWilliam.Kucharski@Sun.COM* Machine state::
334*8044SWilliam.Kucharski@Sun.COM* Boot information format::
335*8044SWilliam.Kucharski@Sun.COM@end menu
336*8044SWilliam.Kucharski@Sun.COM
337*8044SWilliam.Kucharski@Sun.COM
338*8044SWilliam.Kucharski@Sun.COM@node OS image format
339*8044SWilliam.Kucharski@Sun.COM@section OS image format
340*8044SWilliam.Kucharski@Sun.COM
341*8044SWilliam.Kucharski@Sun.COMAn OS image may be an ordinary 32-bit executable file in the standard
342*8044SWilliam.Kucharski@Sun.COMformat for that particular operating system, except that it may be
343*8044SWilliam.Kucharski@Sun.COMlinked at a non-default load address to avoid loading on top of the
344*8044SWilliam.Kucharski@Sun.COM@sc{pc}'s I/O region or other reserved areas, and of course it should
345*8044SWilliam.Kucharski@Sun.COMnot use shared libraries or other fancy features.
346*8044SWilliam.Kucharski@Sun.COM
347*8044SWilliam.Kucharski@Sun.COMAn OS image must contain an additional header called @dfn{Multiboot
348*8044SWilliam.Kucharski@Sun.COMheader}, besides the headers of the format used by the OS image. The
349*8044SWilliam.Kucharski@Sun.COMMultiboot header must be contained completely within the first 8192
350*8044SWilliam.Kucharski@Sun.COMbytes of the OS image, and must be longword (32-bit) aligned. In
351*8044SWilliam.Kucharski@Sun.COMgeneral, it should come @emph{as early as possible}, and may be
352*8044SWilliam.Kucharski@Sun.COMembedded in the beginning of the text segment after the @emph{real}
353*8044SWilliam.Kucharski@Sun.COMexecutable header.
354*8044SWilliam.Kucharski@Sun.COM
355*8044SWilliam.Kucharski@Sun.COM@menu
356*8044SWilliam.Kucharski@Sun.COM* Header layout::               The layout of Multiboot header
357*8044SWilliam.Kucharski@Sun.COM* Header magic fields::         The magic fields of Multiboot header
358*8044SWilliam.Kucharski@Sun.COM* Header address fields::
359*8044SWilliam.Kucharski@Sun.COM* Header graphics fields::
360*8044SWilliam.Kucharski@Sun.COM@end menu
361*8044SWilliam.Kucharski@Sun.COM
362*8044SWilliam.Kucharski@Sun.COM
363*8044SWilliam.Kucharski@Sun.COM@node Header layout
364*8044SWilliam.Kucharski@Sun.COM@subsection The layout of Multiboot header
365*8044SWilliam.Kucharski@Sun.COM
366*8044SWilliam.Kucharski@Sun.COMThe layout of the Multiboot header must be as follows:
367*8044SWilliam.Kucharski@Sun.COM
368*8044SWilliam.Kucharski@Sun.COM@multitable @columnfractions .1 .1 .2 .5
369*8044SWilliam.Kucharski@Sun.COM@item Offset @tab Type  @tab Field Name    @tab Note
370*8044SWilliam.Kucharski@Sun.COM@item 0      @tab u32 @tab magic         @tab required
371*8044SWilliam.Kucharski@Sun.COM@item 4      @tab u32 @tab flags         @tab required
372*8044SWilliam.Kucharski@Sun.COM@item 8      @tab u32 @tab checksum      @tab required
373*8044SWilliam.Kucharski@Sun.COM@item 12     @tab u32 @tab header_addr   @tab if flags[16] is set
374*8044SWilliam.Kucharski@Sun.COM@item 16     @tab u32 @tab load_addr     @tab if flags[16] is set
375*8044SWilliam.Kucharski@Sun.COM@item 20     @tab u32 @tab load_end_addr @tab if flags[16] is set
376*8044SWilliam.Kucharski@Sun.COM@item 24     @tab u32 @tab bss_end_addr  @tab if flags[16] is set
377*8044SWilliam.Kucharski@Sun.COM@item 28     @tab u32 @tab entry_addr    @tab if flags[16] is set
378*8044SWilliam.Kucharski@Sun.COM@item 32     @tab u32 @tab mode_type     @tab if flags[2] is set
379*8044SWilliam.Kucharski@Sun.COM@item 36     @tab u32 @tab width         @tab if flags[2] is set
380*8044SWilliam.Kucharski@Sun.COM@item 40     @tab u32 @tab height        @tab if flags[2] is set
381*8044SWilliam.Kucharski@Sun.COM@item 44     @tab u32 @tab depth         @tab if flags[2] is set
382*8044SWilliam.Kucharski@Sun.COM@end multitable
383*8044SWilliam.Kucharski@Sun.COM
384*8044SWilliam.Kucharski@Sun.COMThe fields @samp{magic}, @samp{flags} and @samp{checksum} are defined in
385*8044SWilliam.Kucharski@Sun.COM@ref{Header magic fields}, the fields @samp{header_addr},
386*8044SWilliam.Kucharski@Sun.COM@samp{load_addr}, @samp{load_end_addr}, @samp{bss_end_addr} and
387*8044SWilliam.Kucharski@Sun.COM@samp{entry_addr} are defined in @ref{Header address fields}, and the
388*8044SWilliam.Kucharski@Sun.COMfields @samp{mode_type}, @samp{width}, @samp{height} and @samp{depth} are
389*8044SWilliam.Kucharski@Sun.COMdefind in @ref{Header graphics fields}.
390*8044SWilliam.Kucharski@Sun.COM
391*8044SWilliam.Kucharski@Sun.COM
392*8044SWilliam.Kucharski@Sun.COM@node Header magic fields
393*8044SWilliam.Kucharski@Sun.COM@subsection The magic fields of Multiboot header
394*8044SWilliam.Kucharski@Sun.COM
395*8044SWilliam.Kucharski@Sun.COM@table @samp
396*8044SWilliam.Kucharski@Sun.COM@item magic
397*8044SWilliam.Kucharski@Sun.COMThe field @samp{magic} is the magic number identifying the header,
398*8044SWilliam.Kucharski@Sun.COMwhich must be the hexadecimal value @code{0x1BADB002}.
399*8044SWilliam.Kucharski@Sun.COM
400*8044SWilliam.Kucharski@Sun.COM@item flags
401*8044SWilliam.Kucharski@Sun.COMThe field @samp{flags} specifies features that the OS image requests or
402*8044SWilliam.Kucharski@Sun.COMrequires of an boot loader. Bits 0-15 indicate requirements; if the
403*8044SWilliam.Kucharski@Sun.COMboot loader sees any of these bits set but doesn't understand the flag
404*8044SWilliam.Kucharski@Sun.COMor can't fulfill the requirements it indicates for some reason, it must
405*8044SWilliam.Kucharski@Sun.COMnotify the user and fail to load the OS image. Bits 16-31 indicate
406*8044SWilliam.Kucharski@Sun.COMoptional features; if any bits in this range are set but the boot loader
407*8044SWilliam.Kucharski@Sun.COMdoesn't understand them, it may simply ignore them and proceed as
408*8044SWilliam.Kucharski@Sun.COMusual. Naturally, all as-yet-undefined bits in the @samp{flags} word
409*8044SWilliam.Kucharski@Sun.COMmust be set to zero in OS images. This way, the @samp{flags} fields
410*8044SWilliam.Kucharski@Sun.COMserves for version control as well as simple feature selection.
411*8044SWilliam.Kucharski@Sun.COM
412*8044SWilliam.Kucharski@Sun.COMIf bit 0 in the @samp{flags} word is set, then all boot modules loaded
413*8044SWilliam.Kucharski@Sun.COMalong with the operating system must be aligned on page (4KB)
414*8044SWilliam.Kucharski@Sun.COMboundaries. Some operating systems expect to be able to map the pages
415*8044SWilliam.Kucharski@Sun.COMcontaining boot modules directly into a paged address space during
416*8044SWilliam.Kucharski@Sun.COMstartup, and thus need the boot modules to be page-aligned.
417*8044SWilliam.Kucharski@Sun.COM
418*8044SWilliam.Kucharski@Sun.COMIf bit 1 in the @samp{flags} word is set, then information on available
419*8044SWilliam.Kucharski@Sun.COMmemory via at least the @samp{mem_*} fields of the Multiboot information
420*8044SWilliam.Kucharski@Sun.COMstructure (@pxref{Boot information format}) must be included. If the
421*8044SWilliam.Kucharski@Sun.COMboot loader is capable of passing a memory map (the @samp{mmap_*} fields)
422*8044SWilliam.Kucharski@Sun.COMand one exists, then it may be included as well.
423*8044SWilliam.Kucharski@Sun.COM
424*8044SWilliam.Kucharski@Sun.COMIf bit 2 in the @samp{flags} word is set, information about the video
425*8044SWilliam.Kucharski@Sun.COMmode table (@pxref{Boot information format}) must be available to the
426*8044SWilliam.Kucharski@Sun.COMkernel.
427*8044SWilliam.Kucharski@Sun.COM
428*8044SWilliam.Kucharski@Sun.COMIf bit 16 in the @samp{flags} word is set, then the fields at offsets
429*8044SWilliam.Kucharski@Sun.COM8-24 in the Multiboot header are valid, and the boot loader should use
430*8044SWilliam.Kucharski@Sun.COMthem instead of the fields in the actual executable header to calculate
431*8044SWilliam.Kucharski@Sun.COMwhere to load the OS image. This information does not need to be
432*8044SWilliam.Kucharski@Sun.COMprovided if the kernel image is in @sc{elf} format, but it @emph{must}
433*8044SWilliam.Kucharski@Sun.COMbe provided if the images is in a.out format or in some other
434*8044SWilliam.Kucharski@Sun.COMformat. Compliant boot loaders must be able to load images that either
435*8044SWilliam.Kucharski@Sun.COMare in @sc{elf} format or contain the load address information embedded
436*8044SWilliam.Kucharski@Sun.COMin the Multiboot header; they may also directly support other executable
437*8044SWilliam.Kucharski@Sun.COMformats, such as particular a.out variants, but are not required to.
438*8044SWilliam.Kucharski@Sun.COM
439*8044SWilliam.Kucharski@Sun.COM@item checksum
440*8044SWilliam.Kucharski@Sun.COMThe field @samp{checksum} is a 32-bit unsigned value which, when added
441*8044SWilliam.Kucharski@Sun.COMto the other magic fields (i.e. @samp{magic} and @samp{flags}), must
442*8044SWilliam.Kucharski@Sun.COMhave a 32-bit unsigned sum of zero.
443*8044SWilliam.Kucharski@Sun.COM@end table
444*8044SWilliam.Kucharski@Sun.COM
445*8044SWilliam.Kucharski@Sun.COM
446*8044SWilliam.Kucharski@Sun.COM@node Header address fields
447*8044SWilliam.Kucharski@Sun.COM@subsection The address fields of Multiboot header
448*8044SWilliam.Kucharski@Sun.COM
449*8044SWilliam.Kucharski@Sun.COMAll of the address fields enabled by flag bit 16 are physical addresses.
450*8044SWilliam.Kucharski@Sun.COMThe meaning of each is as follows:
451*8044SWilliam.Kucharski@Sun.COM
452*8044SWilliam.Kucharski@Sun.COM@table @code
453*8044SWilliam.Kucharski@Sun.COM@item header_addr
454*8044SWilliam.Kucharski@Sun.COMContains the address corresponding to the beginning of the Multiboot
455*8044SWilliam.Kucharski@Sun.COMheader --- the physical memory location at which the magic value is
456*8044SWilliam.Kucharski@Sun.COMsupposed to be loaded. This field serves to @dfn{synchronize} the
457*8044SWilliam.Kucharski@Sun.COMmapping between OS image offsets and physical memory addresses.
458*8044SWilliam.Kucharski@Sun.COM
459*8044SWilliam.Kucharski@Sun.COM@item load_addr
460*8044SWilliam.Kucharski@Sun.COMContains the physical address of the beginning of the text segment. The
461*8044SWilliam.Kucharski@Sun.COMoffset in the OS image file at which to start loading is defined by the
462*8044SWilliam.Kucharski@Sun.COMoffset at which the header was found, minus (header_addr -
463*8044SWilliam.Kucharski@Sun.COMload_addr). load_addr must be less than or equal to header_addr.
464*8044SWilliam.Kucharski@Sun.COM
465*8044SWilliam.Kucharski@Sun.COM@item load_end_addr
466*8044SWilliam.Kucharski@Sun.COMContains the physical address of the end of the data
467*8044SWilliam.Kucharski@Sun.COMsegment. (load_end_addr - load_addr) specifies how much data to load.
468*8044SWilliam.Kucharski@Sun.COMThis implies that the text and data segments must be consecutive in the
469*8044SWilliam.Kucharski@Sun.COMOS image; this is true for existing a.out executable formats.
470*8044SWilliam.Kucharski@Sun.COMIf this field is zero, the boot loader assumes that the text and data
471*8044SWilliam.Kucharski@Sun.COMsegments occupy the whole OS image file.
472*8044SWilliam.Kucharski@Sun.COM
473*8044SWilliam.Kucharski@Sun.COM@item bss_end_addr
474*8044SWilliam.Kucharski@Sun.COMContains the physical address of the end of the bss segment. The boot
475*8044SWilliam.Kucharski@Sun.COMloader initializes this area to zero, and reserves the memory it
476*8044SWilliam.Kucharski@Sun.COMoccupies to avoid placing boot modules and other data relevant to the
477*8044SWilliam.Kucharski@Sun.COMoperating system in that area. If this field is zero, the boot loader
478*8044SWilliam.Kucharski@Sun.COMassumes that no bss segment is present.
479*8044SWilliam.Kucharski@Sun.COM
480*8044SWilliam.Kucharski@Sun.COM@item entry_addr
481*8044SWilliam.Kucharski@Sun.COMThe physical address to which the boot loader should jump in order to
482*8044SWilliam.Kucharski@Sun.COMstart running the operating system.
483*8044SWilliam.Kucharski@Sun.COM@end table
484*8044SWilliam.Kucharski@Sun.COM
485*8044SWilliam.Kucharski@Sun.COM
486*8044SWilliam.Kucharski@Sun.COM@node Header graphics fields
487*8044SWilliam.Kucharski@Sun.COM@subsection The graphics fields of Multiboot header
488*8044SWilliam.Kucharski@Sun.COM
489*8044SWilliam.Kucharski@Sun.COMAll of the graphics fields are enabled by flag bit 2. They specify the
490*8044SWilliam.Kucharski@Sun.COMpreferred graphics mode. Note that that is only a @emph{recommended}
491*8044SWilliam.Kucharski@Sun.COMmode by the OS image. If the mode exists, the boot loader should set
492*8044SWilliam.Kucharski@Sun.COMit, when the user doesn't specify a mode explicitly. Otherwise, the
493*8044SWilliam.Kucharski@Sun.COMboot loader should fall back to a similar mode, if available.
494*8044SWilliam.Kucharski@Sun.COM
495*8044SWilliam.Kucharski@Sun.COMThe meaning of each is as follows:
496*8044SWilliam.Kucharski@Sun.COM
497*8044SWilliam.Kucharski@Sun.COM@table @code
498*8044SWilliam.Kucharski@Sun.COM@item mode_type
499*8044SWilliam.Kucharski@Sun.COMContains @samp{0} for linear graphics mode or @samp{1} for
500*8044SWilliam.Kucharski@Sun.COMEGA-standard text mode. Everything else is reserved for future
501*8044SWilliam.Kucharski@Sun.COMexpansion. Note that the boot loader may set a text mode, even if this
502*8044SWilliam.Kucharski@Sun.COMfield contains @samp{0}.
503*8044SWilliam.Kucharski@Sun.COM
504*8044SWilliam.Kucharski@Sun.COM@item width
505*8044SWilliam.Kucharski@Sun.COMContains the number of the columns. This is specified in pixels in a
506*8044SWilliam.Kucharski@Sun.COMgraphics mode, and in characters in a text mode. The value zero
507*8044SWilliam.Kucharski@Sun.COMindicates that the OS image has no preference.
508*8044SWilliam.Kucharski@Sun.COM
509*8044SWilliam.Kucharski@Sun.COM@item height
510*8044SWilliam.Kucharski@Sun.COMContains the number of the lines. This is specified in pixels in a
511*8044SWilliam.Kucharski@Sun.COMgraphics mode, and in characters in a text mode. The value zero
512*8044SWilliam.Kucharski@Sun.COMindicates that the OS image has no preference.
513*8044SWilliam.Kucharski@Sun.COM
514*8044SWilliam.Kucharski@Sun.COM@item depth
515*8044SWilliam.Kucharski@Sun.COMContains the number of bits per pixel in a graphics mode, and zero in
516*8044SWilliam.Kucharski@Sun.COMa text mode. The value zero indicates that the OS image has no
517*8044SWilliam.Kucharski@Sun.COMpreference.
518*8044SWilliam.Kucharski@Sun.COM@end table
519*8044SWilliam.Kucharski@Sun.COM
520*8044SWilliam.Kucharski@Sun.COM
521*8044SWilliam.Kucharski@Sun.COM@node Machine state
522*8044SWilliam.Kucharski@Sun.COM@section Machine state
523*8044SWilliam.Kucharski@Sun.COM
524*8044SWilliam.Kucharski@Sun.COMWhen the boot loader invokes the 32-bit operating system, the machine
525*8044SWilliam.Kucharski@Sun.COMmust have the following state:
526*8044SWilliam.Kucharski@Sun.COM
527*8044SWilliam.Kucharski@Sun.COM@table @samp
528*8044SWilliam.Kucharski@Sun.COM@item EAX
529*8044SWilliam.Kucharski@Sun.COMMust contain the magic value @samp{0x2BADB002}; the presence of this
530*8044SWilliam.Kucharski@Sun.COMvalue indicates to the operating system that it was loaded by a
531*8044SWilliam.Kucharski@Sun.COMMultiboot-compliant boot loader (e.g. as opposed to another type of
532*8044SWilliam.Kucharski@Sun.COMboot loader that the operating system can also be loaded from).
533*8044SWilliam.Kucharski@Sun.COM
534*8044SWilliam.Kucharski@Sun.COM@item EBX
535*8044SWilliam.Kucharski@Sun.COMMust contain the 32-bit physical address of the Multiboot
536*8044SWilliam.Kucharski@Sun.COMinformation structure provided by the boot loader (@pxref{Boot
537*8044SWilliam.Kucharski@Sun.COMinformation format}).
538*8044SWilliam.Kucharski@Sun.COM
539*8044SWilliam.Kucharski@Sun.COM@item CS
540*8044SWilliam.Kucharski@Sun.COMMust be a 32-bit read/execute code segment with an offset of @samp{0}
541*8044SWilliam.Kucharski@Sun.COMand a limit of @samp{0xFFFFFFFF}. The exact value is undefined.
542*8044SWilliam.Kucharski@Sun.COM
543*8044SWilliam.Kucharski@Sun.COM@item DS
544*8044SWilliam.Kucharski@Sun.COM@itemx ES
545*8044SWilliam.Kucharski@Sun.COM@itemx FS
546*8044SWilliam.Kucharski@Sun.COM@itemx GS
547*8044SWilliam.Kucharski@Sun.COM@itemx SS
548*8044SWilliam.Kucharski@Sun.COMMust be a 32-bit read/write data segment with an offset of @samp{0}
549*8044SWilliam.Kucharski@Sun.COMand a limit of @samp{0xFFFFFFFF}. The exact values are all undefined.
550*8044SWilliam.Kucharski@Sun.COM
551*8044SWilliam.Kucharski@Sun.COM@item A20 gate
552*8044SWilliam.Kucharski@Sun.COMMust be enabled.
553*8044SWilliam.Kucharski@Sun.COM
554*8044SWilliam.Kucharski@Sun.COM@item CR0
555*8044SWilliam.Kucharski@Sun.COMBit 31 (PG) must be cleared. Bit 0 (PE) must be set. Other bits are
556*8044SWilliam.Kucharski@Sun.COMall undefined.
557*8044SWilliam.Kucharski@Sun.COM
558*8044SWilliam.Kucharski@Sun.COM@item EFLAGS
559*8044SWilliam.Kucharski@Sun.COMBit 17 (VM) must be cleared. Bit 9 (IF) must be cleared. Other bits
560*8044SWilliam.Kucharski@Sun.COMare all undefined.
561*8044SWilliam.Kucharski@Sun.COM@end table
562*8044SWilliam.Kucharski@Sun.COM
563*8044SWilliam.Kucharski@Sun.COMAll other processor registers and flag bits are undefined. This
564*8044SWilliam.Kucharski@Sun.COMincludes, in particular:
565*8044SWilliam.Kucharski@Sun.COM
566*8044SWilliam.Kucharski@Sun.COM@table @samp
567*8044SWilliam.Kucharski@Sun.COM@item ESP
568*8044SWilliam.Kucharski@Sun.COMThe OS image must create its own stack as soon as it needs one.
569*8044SWilliam.Kucharski@Sun.COM
570*8044SWilliam.Kucharski@Sun.COM@item GDTR
571*8044SWilliam.Kucharski@Sun.COMEven though the segment registers are set up as described above, the
572*8044SWilliam.Kucharski@Sun.COM@samp{GDTR} may be invalid, so the OS image must not load any segment
573*8044SWilliam.Kucharski@Sun.COMregisters (even just reloading the same values!) until it sets up its
574*8044SWilliam.Kucharski@Sun.COMown @samp{GDT}.
575*8044SWilliam.Kucharski@Sun.COM
576*8044SWilliam.Kucharski@Sun.COM@item IDTR
577*8044SWilliam.Kucharski@Sun.COMThe OS image must leave interrupts disabled until it sets up its own
578*8044SWilliam.Kucharski@Sun.COM@code{IDT}.
579*8044SWilliam.Kucharski@Sun.COM@end table
580*8044SWilliam.Kucharski@Sun.COM
581*8044SWilliam.Kucharski@Sun.COMHowever, other machine state should be left by the boot loader in
582*8044SWilliam.Kucharski@Sun.COM@dfn{normal working order}, i.e. as initialized by the @sc{bios} (or
583*8044SWilliam.Kucharski@Sun.COMDOS, if that's what the boot loader runs from). In other words, the
584*8044SWilliam.Kucharski@Sun.COMoperating system should be able to make @sc{bios} calls and such after
585*8044SWilliam.Kucharski@Sun.COMbeing loaded, as long as it does not overwrite the @sc{bios} data
586*8044SWilliam.Kucharski@Sun.COMstructures before doing so. Also, the boot loader must leave the
587*8044SWilliam.Kucharski@Sun.COM@sc{pic} programmed with the normal @sc{bios}/DOS values, even if it
588*8044SWilliam.Kucharski@Sun.COMchanged them during the switch to 32-bit mode.
589*8044SWilliam.Kucharski@Sun.COM
590*8044SWilliam.Kucharski@Sun.COM
591*8044SWilliam.Kucharski@Sun.COM@node Boot information format
592*8044SWilliam.Kucharski@Sun.COM@section Boot information format
593*8044SWilliam.Kucharski@Sun.COM
594*8044SWilliam.Kucharski@Sun.COMFIXME: Split this chapter like the chapter ``OS image format''.
595*8044SWilliam.Kucharski@Sun.COM
596*8044SWilliam.Kucharski@Sun.COMUpon entry to the operating system, the @code{EBX} register contains the
597*8044SWilliam.Kucharski@Sun.COMphysical address of a @dfn{Multiboot information} data structure,
598*8044SWilliam.Kucharski@Sun.COMthrough which the boot loader communicates vital information to the
599*8044SWilliam.Kucharski@Sun.COMoperating system. The operating system can use or ignore any parts of
600*8044SWilliam.Kucharski@Sun.COMthe structure as it chooses; all information passed by the boot loader
601*8044SWilliam.Kucharski@Sun.COMis advisory only.
602*8044SWilliam.Kucharski@Sun.COM
603*8044SWilliam.Kucharski@Sun.COMThe Multiboot information structure and its related substructures may be
604*8044SWilliam.Kucharski@Sun.COMplaced anywhere in memory by the boot loader (with the exception of the
605*8044SWilliam.Kucharski@Sun.COMmemory reserved for the kernel and boot modules, of course). It is the
606*8044SWilliam.Kucharski@Sun.COMoperating system's responsibility to avoid overwriting this memory until
607*8044SWilliam.Kucharski@Sun.COMit is done using it.
608*8044SWilliam.Kucharski@Sun.COM
609*8044SWilliam.Kucharski@Sun.COMThe format of the Multiboot information structure (as defined so far)
610*8044SWilliam.Kucharski@Sun.COMfollows:
611*8044SWilliam.Kucharski@Sun.COM
612*8044SWilliam.Kucharski@Sun.COM@example
613*8044SWilliam.Kucharski@Sun.COM@group
614*8044SWilliam.Kucharski@Sun.COM        +-------------------+
615*8044SWilliam.Kucharski@Sun.COM0       | flags             |    (required)
616*8044SWilliam.Kucharski@Sun.COM        +-------------------+
617*8044SWilliam.Kucharski@Sun.COM4       | mem_lower         |    (present if flags[0] is set)
618*8044SWilliam.Kucharski@Sun.COM8       | mem_upper         |    (present if flags[0] is set)
619*8044SWilliam.Kucharski@Sun.COM        +-------------------+
620*8044SWilliam.Kucharski@Sun.COM12      | boot_device       |    (present if flags[1] is set)
621*8044SWilliam.Kucharski@Sun.COM        +-------------------+
622*8044SWilliam.Kucharski@Sun.COM16      | cmdline           |    (present if flags[2] is set)
623*8044SWilliam.Kucharski@Sun.COM        +-------------------+
624*8044SWilliam.Kucharski@Sun.COM20      | mods_count        |    (present if flags[3] is set)
625*8044SWilliam.Kucharski@Sun.COM24      | mods_addr         |    (present if flags[3] is set)
626*8044SWilliam.Kucharski@Sun.COM        +-------------------+
627*8044SWilliam.Kucharski@Sun.COM28 - 40 | syms              |    (present if flags[4] or
628*8044SWilliam.Kucharski@Sun.COM        |                   |                flags[5] is set)
629*8044SWilliam.Kucharski@Sun.COM        +-------------------+
630*8044SWilliam.Kucharski@Sun.COM44      | mmap_length       |    (present if flags[6] is set)
631*8044SWilliam.Kucharski@Sun.COM48      | mmap_addr         |    (present if flags[6] is set)
632*8044SWilliam.Kucharski@Sun.COM        +-------------------+
633*8044SWilliam.Kucharski@Sun.COM52      | drives_length     |    (present if flags[7] is set)
634*8044SWilliam.Kucharski@Sun.COM56      | drives_addr       |    (present if flags[7] is set)
635*8044SWilliam.Kucharski@Sun.COM        +-------------------+
636*8044SWilliam.Kucharski@Sun.COM60      | config_table      |    (present if flags[8] is set)
637*8044SWilliam.Kucharski@Sun.COM        +-------------------+
638*8044SWilliam.Kucharski@Sun.COM64      | boot_loader_name  |    (present if flags[9] is set)
639*8044SWilliam.Kucharski@Sun.COM        +-------------------+
640*8044SWilliam.Kucharski@Sun.COM68      | apm_table         |    (present if flags[10] is set)
641*8044SWilliam.Kucharski@Sun.COM        +-------------------+
642*8044SWilliam.Kucharski@Sun.COM72      | vbe_control_info  |    (present if flags[11] is set)
643*8044SWilliam.Kucharski@Sun.COM76      | vbe_mode_info     |
644*8044SWilliam.Kucharski@Sun.COM80      | vbe_mode          |
645*8044SWilliam.Kucharski@Sun.COM82      | vbe_interface_seg |
646*8044SWilliam.Kucharski@Sun.COM84      | vbe_interface_off |
647*8044SWilliam.Kucharski@Sun.COM86      | vbe_interface_len |
648*8044SWilliam.Kucharski@Sun.COM        +-------------------+
649*8044SWilliam.Kucharski@Sun.COM@end group
650*8044SWilliam.Kucharski@Sun.COM@end example
651*8044SWilliam.Kucharski@Sun.COM
652*8044SWilliam.Kucharski@Sun.COMThe first longword indicates the presence and validity of other fields
653*8044SWilliam.Kucharski@Sun.COMin the Multiboot information structure. All as-yet-undefined bits must
654*8044SWilliam.Kucharski@Sun.COMbe set to zero by the boot loader. Any set bits that the operating
655*8044SWilliam.Kucharski@Sun.COMsystem does not understand should be ignored. Thus, the @samp{flags}
656*8044SWilliam.Kucharski@Sun.COMfield also functions as a version indicator, allowing the Multiboot
657*8044SWilliam.Kucharski@Sun.COMinformation structure to be expanded in the future without breaking
658*8044SWilliam.Kucharski@Sun.COManything.
659*8044SWilliam.Kucharski@Sun.COM
660*8044SWilliam.Kucharski@Sun.COMIf bit 0 in the @samp{flags} word is set, then the @samp{mem_*} fields
661*8044SWilliam.Kucharski@Sun.COMare valid. @samp{mem_lower} and @samp{mem_upper} indicate the amount of
662*8044SWilliam.Kucharski@Sun.COMlower and upper memory, respectively, in kilobytes. Lower memory starts
663*8044SWilliam.Kucharski@Sun.COMat address 0, and upper memory starts at address 1 megabyte. The maximum
664*8044SWilliam.Kucharski@Sun.COMpossible value for lower memory is 640 kilobytes. The value returned for
665*8044SWilliam.Kucharski@Sun.COMupper memory is maximally the address of the first upper memory hole
666*8044SWilliam.Kucharski@Sun.COMminus 1 megabyte. It is not guaranteed to be this value.
667*8044SWilliam.Kucharski@Sun.COM
668*8044SWilliam.Kucharski@Sun.COMIf bit 1 in the @samp{flags} word is set, then the @samp{boot_device}
669*8044SWilliam.Kucharski@Sun.COMfield is valid, and indicates which @sc{bios} disk device the boot
670*8044SWilliam.Kucharski@Sun.COMloader loaded the OS image from. If the OS image was not loaded from a
671*8044SWilliam.Kucharski@Sun.COM@sc{bios} disk, then this field must not be present (bit 3 must be
672*8044SWilliam.Kucharski@Sun.COMclear). The operating system may use this field as a hint for
673*8044SWilliam.Kucharski@Sun.COMdetermining its own @dfn{root} device, but is not required to. The
674*8044SWilliam.Kucharski@Sun.COM@samp{boot_device} field is laid out in four one-byte subfields as
675*8044SWilliam.Kucharski@Sun.COMfollows:
676*8044SWilliam.Kucharski@Sun.COM
677*8044SWilliam.Kucharski@Sun.COM@example
678*8044SWilliam.Kucharski@Sun.COM@group
679*8044SWilliam.Kucharski@Sun.COM+-------+-------+-------+-------+
680*8044SWilliam.Kucharski@Sun.COM| drive | part1 | part2 | part3 |
681*8044SWilliam.Kucharski@Sun.COM+-------+-------+-------+-------+
682*8044SWilliam.Kucharski@Sun.COM@end group
683*8044SWilliam.Kucharski@Sun.COM@end example
684*8044SWilliam.Kucharski@Sun.COM
685*8044SWilliam.Kucharski@Sun.COMThe first byte contains the @sc{bios} drive number as understood by the
686*8044SWilliam.Kucharski@Sun.COM@sc{bios} INT 0x13 low-level disk interface: e.g. 0x00 for the first
687*8044SWilliam.Kucharski@Sun.COMfloppy disk or 0x80 for the first hard disk.
688*8044SWilliam.Kucharski@Sun.COM
689*8044SWilliam.Kucharski@Sun.COMThe three remaining bytes specify the boot partition. @samp{part1}
690*8044SWilliam.Kucharski@Sun.COMspecifies the @dfn{top-level} partition number, @samp{part2} specifies a
691*8044SWilliam.Kucharski@Sun.COM@dfn{sub-partition} in the top-level partition, etc. Partition numbers
692*8044SWilliam.Kucharski@Sun.COMalways start from zero. Unused partition bytes must be set to 0xFF. For
693*8044SWilliam.Kucharski@Sun.COMexample, if the disk is partitioned using a simple one-level DOS
694*8044SWilliam.Kucharski@Sun.COMpartitioning scheme, then @samp{part1} contains the DOS partition
695*8044SWilliam.Kucharski@Sun.COMnumber, and @samp{part2} and @samp{part3} are both 0xFF. As another
696*8044SWilliam.Kucharski@Sun.COMexample, if a disk is partitioned first into DOS partitions, and then
697*8044SWilliam.Kucharski@Sun.COMone of those DOS partitions is subdivided into several BSD partitions
698*8044SWilliam.Kucharski@Sun.COMusing BSD's @dfn{disklabel} strategy, then @samp{part1} contains the DOS
699*8044SWilliam.Kucharski@Sun.COMpartition number, @samp{part2} contains the BSD sub-partition within
700*8044SWilliam.Kucharski@Sun.COMthat DOS partition, and @samp{part3} is 0xFF.
701*8044SWilliam.Kucharski@Sun.COM
702*8044SWilliam.Kucharski@Sun.COMDOS extended partitions are indicated as partition numbers starting from
703*8044SWilliam.Kucharski@Sun.COM4 and increasing, rather than as nested sub-partitions, even though the
704*8044SWilliam.Kucharski@Sun.COMunderlying disk layout of extended partitions is hierarchical in
705*8044SWilliam.Kucharski@Sun.COMnature. For example, if the boot loader boots from the second extended
706*8044SWilliam.Kucharski@Sun.COMpartition on a disk partitioned in conventional DOS style, then
707*8044SWilliam.Kucharski@Sun.COM@samp{part1} will be 5, and @samp{part2} and @samp{part3} will both be
708*8044SWilliam.Kucharski@Sun.COM0xFF.
709*8044SWilliam.Kucharski@Sun.COM
710*8044SWilliam.Kucharski@Sun.COMIf bit 2 of the @samp{flags} longword is set, the @samp{cmdline} field
711*8044SWilliam.Kucharski@Sun.COMis valid, and contains the physical address of the command line to
712*8044SWilliam.Kucharski@Sun.COMbe passed to the kernel. The command line is a normal C-style
713*8044SWilliam.Kucharski@Sun.COMzero-terminated string.
714*8044SWilliam.Kucharski@Sun.COM
715*8044SWilliam.Kucharski@Sun.COMIf bit 3 of the @samp{flags} is set, then the @samp{mods} fields
716*8044SWilliam.Kucharski@Sun.COMindicate to the kernel what boot modules were loaded along with the
717*8044SWilliam.Kucharski@Sun.COMkernel image, and where they can be found. @samp{mods_count} contains
718*8044SWilliam.Kucharski@Sun.COMthe number of modules loaded; @samp{mods_addr} contains the physical
719*8044SWilliam.Kucharski@Sun.COMaddress of the first module structure. @samp{mods_count} may be zero,
720*8044SWilliam.Kucharski@Sun.COMindicating no boot modules were loaded, even if bit 1 of @samp{flags} is
721*8044SWilliam.Kucharski@Sun.COMset. Each module structure is formatted as follows:
722*8044SWilliam.Kucharski@Sun.COM
723*8044SWilliam.Kucharski@Sun.COM@example
724*8044SWilliam.Kucharski@Sun.COM@group
725*8044SWilliam.Kucharski@Sun.COM        +-------------------+
726*8044SWilliam.Kucharski@Sun.COM0       | mod_start         |
727*8044SWilliam.Kucharski@Sun.COM4       | mod_end           |
728*8044SWilliam.Kucharski@Sun.COM        +-------------------+
729*8044SWilliam.Kucharski@Sun.COM8       | string            |
730*8044SWilliam.Kucharski@Sun.COM        +-------------------+
731*8044SWilliam.Kucharski@Sun.COM12      | reserved (0)      |
732*8044SWilliam.Kucharski@Sun.COM        +-------------------+
733*8044SWilliam.Kucharski@Sun.COM@end group
734*8044SWilliam.Kucharski@Sun.COM@end example
735*8044SWilliam.Kucharski@Sun.COM
736*8044SWilliam.Kucharski@Sun.COMThe first two fields contain the start and end addresses of the boot
737*8044SWilliam.Kucharski@Sun.COMmodule itself. The @samp{string} field provides an arbitrary string to
738*8044SWilliam.Kucharski@Sun.COMbe associated with that particular boot module; it is a zero-terminated
739*8044SWilliam.Kucharski@Sun.COMASCII string, just like the kernel command line. The @samp{string} field
740*8044SWilliam.Kucharski@Sun.COMmay be 0 if there is no string associated with the module. Typically the
741*8044SWilliam.Kucharski@Sun.COMstring might be a command line (e.g. if the operating system treats boot
742*8044SWilliam.Kucharski@Sun.COMmodules as executable programs), or a pathname (e.g. if the operating
743*8044SWilliam.Kucharski@Sun.COMsystem treats boot modules as files in a file system), but its exact use
744*8044SWilliam.Kucharski@Sun.COMis specific to the operating system. The @samp{reserved} field must be
745*8044SWilliam.Kucharski@Sun.COMset to 0 by the boot loader and ignored by the operating system.
746*8044SWilliam.Kucharski@Sun.COM
747*8044SWilliam.Kucharski@Sun.COM@strong{Caution:} Bits 4 & 5 are mutually exclusive.
748*8044SWilliam.Kucharski@Sun.COM
749*8044SWilliam.Kucharski@Sun.COMIf bit 4 in the @samp{flags} word is set, then the following fields in
750*8044SWilliam.Kucharski@Sun.COMthe Multiboot information structure starting at byte 28 are valid:
751*8044SWilliam.Kucharski@Sun.COM
752*8044SWilliam.Kucharski@Sun.COM@example
753*8044SWilliam.Kucharski@Sun.COM@group
754*8044SWilliam.Kucharski@Sun.COM        +-------------------+
755*8044SWilliam.Kucharski@Sun.COM28      | tabsize           |
756*8044SWilliam.Kucharski@Sun.COM32      | strsize           |
757*8044SWilliam.Kucharski@Sun.COM36      | addr              |
758*8044SWilliam.Kucharski@Sun.COM40      | reserved (0)      |
759*8044SWilliam.Kucharski@Sun.COM        +-------------------+
760*8044SWilliam.Kucharski@Sun.COM@end group
761*8044SWilliam.Kucharski@Sun.COM@end example
762*8044SWilliam.Kucharski@Sun.COM
763*8044SWilliam.Kucharski@Sun.COMThese indicate where the symbol table from an a.out kernel image can be
764*8044SWilliam.Kucharski@Sun.COMfound. @samp{addr} is the physical address of the size (4-byte unsigned
765*8044SWilliam.Kucharski@Sun.COMlong) of an array of a.out format @dfn{nlist} structures, followed
766*8044SWilliam.Kucharski@Sun.COMimmediately by the array itself, then the size (4-byte unsigned long) of
767*8044SWilliam.Kucharski@Sun.COMa set of zero-terminated @sc{ascii} strings (plus sizeof(unsigned long) in
768*8044SWilliam.Kucharski@Sun.COMthis case), and finally the set of strings itself. @samp{tabsize} is
769*8044SWilliam.Kucharski@Sun.COMequal to its size parameter (found at the beginning of the symbol
770*8044SWilliam.Kucharski@Sun.COMsection), and @samp{strsize} is equal to its size parameter (found at
771*8044SWilliam.Kucharski@Sun.COMthe beginning of the string section) of the following string table to
772*8044SWilliam.Kucharski@Sun.COMwhich the symbol table refers. Note that @samp{tabsize} may be 0,
773*8044SWilliam.Kucharski@Sun.COMindicating no symbols, even if bit 4 in the @samp{flags} word is set.
774*8044SWilliam.Kucharski@Sun.COM
775*8044SWilliam.Kucharski@Sun.COMIf bit 5 in the @samp{flags} word is set, then the following fields in
776*8044SWilliam.Kucharski@Sun.COMthe Multiboot information structure starting at byte 28 are valid:
777*8044SWilliam.Kucharski@Sun.COM
778*8044SWilliam.Kucharski@Sun.COM@example
779*8044SWilliam.Kucharski@Sun.COM@group
780*8044SWilliam.Kucharski@Sun.COM        +-------------------+
781*8044SWilliam.Kucharski@Sun.COM28      | num               |
782*8044SWilliam.Kucharski@Sun.COM32      | size              |
783*8044SWilliam.Kucharski@Sun.COM36      | addr              |
784*8044SWilliam.Kucharski@Sun.COM40      | shndx             |
785*8044SWilliam.Kucharski@Sun.COM        +-------------------+
786*8044SWilliam.Kucharski@Sun.COM@end group
787*8044SWilliam.Kucharski@Sun.COM@end example
788*8044SWilliam.Kucharski@Sun.COM
789*8044SWilliam.Kucharski@Sun.COMThese indicate where the section header table from an ELF kernel is, the
790*8044SWilliam.Kucharski@Sun.COMsize of each entry, number of entries, and the string table used as the
791*8044SWilliam.Kucharski@Sun.COMindex of names. They correspond to the @samp{shdr_*} entries
792*8044SWilliam.Kucharski@Sun.COM(@samp{shdr_num}, etc.) in the Executable and Linkable Format (@sc{elf})
793*8044SWilliam.Kucharski@Sun.COMspecification in the program header. All sections are loaded, and the
794*8044SWilliam.Kucharski@Sun.COMphysical address fields of the @sc{elf} section header then refer to where
795*8044SWilliam.Kucharski@Sun.COMthe sections are in memory (refer to the i386 @sc{elf} documentation for
796*8044SWilliam.Kucharski@Sun.COMdetails as to how to read the section header(s)). Note that
797*8044SWilliam.Kucharski@Sun.COM@samp{shdr_num} may be 0, indicating no symbols, even if bit 5 in the
798*8044SWilliam.Kucharski@Sun.COM@samp{flags} word is set.
799*8044SWilliam.Kucharski@Sun.COM
800*8044SWilliam.Kucharski@Sun.COMIf bit 6 in the @samp{flags} word is set, then the @samp{mmap_*} fields
801*8044SWilliam.Kucharski@Sun.COMare valid, and indicate the address and length of a buffer containing a
802*8044SWilliam.Kucharski@Sun.COMmemory map of the machine provided by the @sc{bios}. @samp{mmap_addr} is
803*8044SWilliam.Kucharski@Sun.COMthe address, and @samp{mmap_length} is the total size of the buffer. The
804*8044SWilliam.Kucharski@Sun.COMbuffer consists of one or more of the following size/structure pairs
805*8044SWilliam.Kucharski@Sun.COM(@samp{size} is really used for skipping to the next pair):
806*8044SWilliam.Kucharski@Sun.COM
807*8044SWilliam.Kucharski@Sun.COM@example
808*8044SWilliam.Kucharski@Sun.COM@group
809*8044SWilliam.Kucharski@Sun.COM        +-------------------+
810*8044SWilliam.Kucharski@Sun.COM-4      | size              |
811*8044SWilliam.Kucharski@Sun.COM        +-------------------+
812*8044SWilliam.Kucharski@Sun.COM0       | base_addr_low     |
813*8044SWilliam.Kucharski@Sun.COM4       | base_addr_high    |
814*8044SWilliam.Kucharski@Sun.COM8       | length_low        |
815*8044SWilliam.Kucharski@Sun.COM12      | length_high       |
816*8044SWilliam.Kucharski@Sun.COM16      | type              |
817*8044SWilliam.Kucharski@Sun.COM        +-------------------+
818*8044SWilliam.Kucharski@Sun.COM@end group
819*8044SWilliam.Kucharski@Sun.COM@end example
820*8044SWilliam.Kucharski@Sun.COM
821*8044SWilliam.Kucharski@Sun.COMwhere @samp{size} is the size of the associated structure in bytes, which
822*8044SWilliam.Kucharski@Sun.COMcan be greater than the minimum of 20 bytes. @samp{base_addr_low} is the
823*8044SWilliam.Kucharski@Sun.COMlower 32 bits of the starting address, and @samp{base_addr_high} is the
824*8044SWilliam.Kucharski@Sun.COMupper 32 bits, for a total of a 64-bit starting address. @samp{length_low}
825*8044SWilliam.Kucharski@Sun.COMis the lower 32 bits of the size of the memory region in bytes, and
826*8044SWilliam.Kucharski@Sun.COM@samp{length_high} is the upper 32 bits, for a total of a 64-bit
827*8044SWilliam.Kucharski@Sun.COMlength. @samp{type} is the variety of address range represented, where a
828*8044SWilliam.Kucharski@Sun.COMvalue of 1 indicates available @sc{ram}, and all other values currently
829*8044SWilliam.Kucharski@Sun.COMindicated a reserved area.
830*8044SWilliam.Kucharski@Sun.COM
831*8044SWilliam.Kucharski@Sun.COMThe map provided is guaranteed to list all standard @sc{ram} that should
832*8044SWilliam.Kucharski@Sun.COMbe available for normal use.
833*8044SWilliam.Kucharski@Sun.COM
834*8044SWilliam.Kucharski@Sun.COMIf bit 7 in the @samp{flags} is set, then the @samp{drives_*} fields
835*8044SWilliam.Kucharski@Sun.COMare valid, and indicate the address of the physical address of the first
836*8044SWilliam.Kucharski@Sun.COMdrive structure and the size of drive structures. @samp{drives_addr}
837*8044SWilliam.Kucharski@Sun.COMis the address, and @samp{drives_length} is the total size of drive
838*8044SWilliam.Kucharski@Sun.COMstructures. Note that @samp{drives_length} may be zero. Each drive
839*8044SWilliam.Kucharski@Sun.COMstructure is formatted as follows:
840*8044SWilliam.Kucharski@Sun.COM
841*8044SWilliam.Kucharski@Sun.COM@example
842*8044SWilliam.Kucharski@Sun.COM@group
843*8044SWilliam.Kucharski@Sun.COM        +-------------------+
844*8044SWilliam.Kucharski@Sun.COM0       | size              |
845*8044SWilliam.Kucharski@Sun.COM        +-------------------+
846*8044SWilliam.Kucharski@Sun.COM4       | drive_number      |
847*8044SWilliam.Kucharski@Sun.COM        +-------------------+
848*8044SWilliam.Kucharski@Sun.COM5       | drive_mode        |
849*8044SWilliam.Kucharski@Sun.COM        +-------------------+
850*8044SWilliam.Kucharski@Sun.COM6       | drive_cylinders   |
851*8044SWilliam.Kucharski@Sun.COM8       | drive_heads       |
852*8044SWilliam.Kucharski@Sun.COM9       | drive_sectors     |
853*8044SWilliam.Kucharski@Sun.COM        +-------------------+
854*8044SWilliam.Kucharski@Sun.COM10 - xx | drive_ports       |
855*8044SWilliam.Kucharski@Sun.COM        +-------------------+
856*8044SWilliam.Kucharski@Sun.COM@end group
857*8044SWilliam.Kucharski@Sun.COM@end example
858*8044SWilliam.Kucharski@Sun.COM
859*8044SWilliam.Kucharski@Sun.COMThe @samp{size} field specifies the size of this structure. The size
860*8044SWilliam.Kucharski@Sun.COMvaries, depending on the number of ports. Note that the size may not be
861*8044SWilliam.Kucharski@Sun.COMequal to (10 + 2 * the number of ports), because of an alignment.
862*8044SWilliam.Kucharski@Sun.COM
863*8044SWilliam.Kucharski@Sun.COMThe @samp{drive_number} field contains the BIOS drive number. The
864*8044SWilliam.Kucharski@Sun.COM@samp{drive_mode} field represents the access mode used by the boot
865*8044SWilliam.Kucharski@Sun.COMloader. Currently, the following modes are defined:
866*8044SWilliam.Kucharski@Sun.COM
867*8044SWilliam.Kucharski@Sun.COM@table @samp
868*8044SWilliam.Kucharski@Sun.COM@item 0
869*8044SWilliam.Kucharski@Sun.COMCHS mode (traditional cylinder/head/sector addressing mode).
870*8044SWilliam.Kucharski@Sun.COM
871*8044SWilliam.Kucharski@Sun.COM@item 1
872*8044SWilliam.Kucharski@Sun.COMLBA mode (Logical Block Addressing mode).
873*8044SWilliam.Kucharski@Sun.COM@end table
874*8044SWilliam.Kucharski@Sun.COM
875*8044SWilliam.Kucharski@Sun.COMThe three fields, @samp{drive_cylinders}, @samp{drive_heads} and
876*8044SWilliam.Kucharski@Sun.COM@samp{drive_sectors}, indicate the geometry of the drive detected by the
877*8044SWilliam.Kucharski@Sun.COM@sc{bios}. @samp{drive_cylinders} contains the number of the
878*8044SWilliam.Kucharski@Sun.COMcylinders. @samp{drive_heads} contains the number of the
879*8044SWilliam.Kucharski@Sun.COMheads. @samp{drive_sectors} contains the number of the sectors per
880*8044SWilliam.Kucharski@Sun.COMtrack.
881*8044SWilliam.Kucharski@Sun.COM
882*8044SWilliam.Kucharski@Sun.COMThe @samp{drive_ports} field contains the array of the I/O ports used
883*8044SWilliam.Kucharski@Sun.COMfor the drive in the @sc{bios} code. The array consists of zero or more
884*8044SWilliam.Kucharski@Sun.COMunsigned two-bytes integers, and is terminated with zero. Note that the
885*8044SWilliam.Kucharski@Sun.COMarray may contain any number of I/O ports that are not related to the
886*8044SWilliam.Kucharski@Sun.COMdrive actually (such as @sc{dma} controller's ports).
887*8044SWilliam.Kucharski@Sun.COM
888*8044SWilliam.Kucharski@Sun.COMIf bit 8 in the @samp{flags} is set, then the @samp{config_table} field
889*8044SWilliam.Kucharski@Sun.COMis valid, and indicates the address of the @sc{rom} configuration table
890*8044SWilliam.Kucharski@Sun.COMreturned by the @dfn{GET CONFIGURATION} @sc{bios} call. If the @sc{bios}
891*8044SWilliam.Kucharski@Sun.COMcall fails, then the size of the table must be @emph{zero}.
892*8044SWilliam.Kucharski@Sun.COM
893*8044SWilliam.Kucharski@Sun.COMIf bit 9 in the @samp{flags} is set, the @samp{boot_loader_name} field
894*8044SWilliam.Kucharski@Sun.COMis valid, and contains the physical address of the name of a boot
895*8044SWilliam.Kucharski@Sun.COMloader booting the kernel. The name is a normal C-style zero-terminated
896*8044SWilliam.Kucharski@Sun.COMstring.
897*8044SWilliam.Kucharski@Sun.COM
898*8044SWilliam.Kucharski@Sun.COMIf bit 10 in the @samp{flags} is set, the @samp{apm_table} field is
899*8044SWilliam.Kucharski@Sun.COMvalid, and contains the physical address of an @sc{apm} table defined as
900*8044SWilliam.Kucharski@Sun.COMbelow:
901*8044SWilliam.Kucharski@Sun.COM
902*8044SWilliam.Kucharski@Sun.COM@example
903*8044SWilliam.Kucharski@Sun.COM@group
904*8044SWilliam.Kucharski@Sun.COM        +----------------------+
905*8044SWilliam.Kucharski@Sun.COM0       | version              |
906*8044SWilliam.Kucharski@Sun.COM2       | cseg                 |
907*8044SWilliam.Kucharski@Sun.COM4       | offset               |
908*8044SWilliam.Kucharski@Sun.COM8       | cseg_16              |
909*8044SWilliam.Kucharski@Sun.COM10      | dseg                 |
910*8044SWilliam.Kucharski@Sun.COM12      | flags                |
911*8044SWilliam.Kucharski@Sun.COM14      | cseg_len             |
912*8044SWilliam.Kucharski@Sun.COM16      | cseg_16_len          |
913*8044SWilliam.Kucharski@Sun.COM18      | dseg_len             |
914*8044SWilliam.Kucharski@Sun.COM        +----------------------+
915*8044SWilliam.Kucharski@Sun.COM@end group
916*8044SWilliam.Kucharski@Sun.COM@end example
917*8044SWilliam.Kucharski@Sun.COM
918*8044SWilliam.Kucharski@Sun.COMThe fields @samp{version}, @samp{cseg}, @samp{offset}, @samp{cseg_16},
919*8044SWilliam.Kucharski@Sun.COM@samp{dseg}, @samp{flags}, @samp{cseg_len}, @samp{cseg_16_len},
920*8044SWilliam.Kucharski@Sun.COM@samp{dseg_len} indicate the version number, the protected mode 32-bit
921*8044SWilliam.Kucharski@Sun.COMcode segment, the offset of the entry point, the protected mode 16-bit
922*8044SWilliam.Kucharski@Sun.COMcode segment, the protected mode 16-bit data segment, the flags, the
923*8044SWilliam.Kucharski@Sun.COMlength of the protected mode 32-bit code segment, the length of the
924*8044SWilliam.Kucharski@Sun.COMprotected mode 16-bit code segment, and the length of the protected mode
925*8044SWilliam.Kucharski@Sun.COM16-bit data segment, respectively. Only the field @samp{offset} is 4
926*8044SWilliam.Kucharski@Sun.COMbytes, and the others are 2 bytes. See
927*8044SWilliam.Kucharski@Sun.COM@uref{http://www.microsoft.com/hwdev/busbios/amp_12.htm, Advanced Power
928*8044SWilliam.Kucharski@Sun.COMManagement (APM) BIOS Interface Specification}, for more information.
929*8044SWilliam.Kucharski@Sun.COM
930*8044SWilliam.Kucharski@Sun.COMIf bit 11 in the @samp{flags} is set, the graphics table is available.
931*8044SWilliam.Kucharski@Sun.COMThis must only be done if the kernel has indicated in the
932*8044SWilliam.Kucharski@Sun.COM@samp{Multiboot Header} that it accepts a graphics mode.
933*8044SWilliam.Kucharski@Sun.COM
934*8044SWilliam.Kucharski@Sun.COMThe fields @samp{vbe_control_info} and @samp{vbe_mode_info} contain
935*8044SWilliam.Kucharski@Sun.COMthe physical addresses of @sc{vbe} control information returned by the
936*8044SWilliam.Kucharski@Sun.COM@sc{vbe} Function 00h and @sc{vbe} mode information returned by the
937*8044SWilliam.Kucharski@Sun.COM@sc{vbe} Function 01h, respectively.
938*8044SWilliam.Kucharski@Sun.COM
939*8044SWilliam.Kucharski@Sun.COMThe field @samp{vbe_mode} indicates current video mode in the format
940*8044SWilliam.Kucharski@Sun.COMspecified in @sc{vbe} 3.0.
941*8044SWilliam.Kucharski@Sun.COM
942*8044SWilliam.Kucharski@Sun.COMThe rest fields @samp{vbe_interface_seg}, @samp{vbe_interface_off}, and
943*8044SWilliam.Kucharski@Sun.COM@samp{vbe_interface_len} contain the table of a protected mode interface
944*8044SWilliam.Kucharski@Sun.COMdefined in @sc{vbe} 2.0+. If this information is not available, those
945*8044SWilliam.Kucharski@Sun.COMfields contain zero. Note that @sc{vbe} 3.0 defines another protected
946*8044SWilliam.Kucharski@Sun.COMmode interface which is incompatible with the old one. If you want to
947*8044SWilliam.Kucharski@Sun.COMuse the new protected mode interface, you will have to find the table
948*8044SWilliam.Kucharski@Sun.COMyourself.
949*8044SWilliam.Kucharski@Sun.COM
950*8044SWilliam.Kucharski@Sun.COMThe fields for the graphics table are designed for @sc{vbe}, but
951*8044SWilliam.Kucharski@Sun.COMMultiboot boot loaders may simulate @sc{vbe} on non-@sc{vbe} modes, as
952*8044SWilliam.Kucharski@Sun.COMif they were @sc{vbe} modes.
953*8044SWilliam.Kucharski@Sun.COM
954*8044SWilliam.Kucharski@Sun.COM
955*8044SWilliam.Kucharski@Sun.COM@node Examples
956*8044SWilliam.Kucharski@Sun.COM@chapter Examples
957*8044SWilliam.Kucharski@Sun.COM
958*8044SWilliam.Kucharski@Sun.COM@strong{Caution:} The following items are not part of the specification
959*8044SWilliam.Kucharski@Sun.COMdocument, but are included for prospective operating system and boot
960*8044SWilliam.Kucharski@Sun.COMloader writers.
961*8044SWilliam.Kucharski@Sun.COM
962*8044SWilliam.Kucharski@Sun.COM@menu
963*8044SWilliam.Kucharski@Sun.COM* Notes on PC::
964*8044SWilliam.Kucharski@Sun.COM* BIOS device mapping techniques::
965*8044SWilliam.Kucharski@Sun.COM* Example OS code::
966*8044SWilliam.Kucharski@Sun.COM* Example boot loader code::
967*8044SWilliam.Kucharski@Sun.COM@end menu
968*8044SWilliam.Kucharski@Sun.COM
969*8044SWilliam.Kucharski@Sun.COM
970*8044SWilliam.Kucharski@Sun.COM@node Notes on PC
971*8044SWilliam.Kucharski@Sun.COM@section Notes on PC
972*8044SWilliam.Kucharski@Sun.COM
973*8044SWilliam.Kucharski@Sun.COMIn reference to bit 0 of the @samp{flags} parameter in the Multiboot
974*8044SWilliam.Kucharski@Sun.COMinformation structure, if the bootloader in question uses older
975*8044SWilliam.Kucharski@Sun.COM@sc{bios} interfaces, or the newest ones are not available (see
976*8044SWilliam.Kucharski@Sun.COMdescription about bit 6), then a maximum of either 15 or 63 megabytes of
977*8044SWilliam.Kucharski@Sun.COMmemory may be reported. It is @emph{highly} recommended that boot
978*8044SWilliam.Kucharski@Sun.COMloaders perform a thorough memory probe.
979*8044SWilliam.Kucharski@Sun.COM
980*8044SWilliam.Kucharski@Sun.COMIn reference to bit 1 of the @samp{flags} parameter in the Multiboot
981*8044SWilliam.Kucharski@Sun.COMinformation structure, it is recognized that determination of which
982*8044SWilliam.Kucharski@Sun.COM@sc{bios} drive maps to which device driver in an operating system is
983*8044SWilliam.Kucharski@Sun.COMnon-trivial, at best. Many kludges have been made to various operating
984*8044SWilliam.Kucharski@Sun.COMsystems instead of solving this problem, most of them breaking under
985*8044SWilliam.Kucharski@Sun.COMmany conditions. To encourage the use of general-purpose solutions to
986*8044SWilliam.Kucharski@Sun.COMthis problem, there are 2 @sc{bios} device mapping techniques
987*8044SWilliam.Kucharski@Sun.COM(@pxref{BIOS device mapping techniques}).
988*8044SWilliam.Kucharski@Sun.COM
989*8044SWilliam.Kucharski@Sun.COMIn reference to bit 6 of the @samp{flags} parameter in the Multiboot
990*8044SWilliam.Kucharski@Sun.COMinformation structure, it is important to note that the data structure
991*8044SWilliam.Kucharski@Sun.COMused there (starting with @samp{BaseAddrLow}) is the data returned by
992*8044SWilliam.Kucharski@Sun.COMthe INT 15h, AX=E820h --- Query System Address Map call. See @xref{Query
993*8044SWilliam.Kucharski@Sun.COMSystem Address Map, , Query System Address Map, grub.info, The GRUB
994*8044SWilliam.Kucharski@Sun.COMManual}, for more information. The interface here is meant to allow a
995*8044SWilliam.Kucharski@Sun.COMboot loader to work unmodified with any reasonable extensions of the
996*8044SWilliam.Kucharski@Sun.COM@sc{bios} interface, passing along any extra data to be interpreted by
997*8044SWilliam.Kucharski@Sun.COMthe operating system as desired.
998*8044SWilliam.Kucharski@Sun.COM
999*8044SWilliam.Kucharski@Sun.COM
1000*8044SWilliam.Kucharski@Sun.COM@node BIOS device mapping techniques
1001*8044SWilliam.Kucharski@Sun.COM@section BIOS device mapping techniques
1002*8044SWilliam.Kucharski@Sun.COM
1003*8044SWilliam.Kucharski@Sun.COMBoth of these techniques should be usable from any PC operating system,
1004*8044SWilliam.Kucharski@Sun.COMand neither require any special support in the drivers themselves. This
1005*8044SWilliam.Kucharski@Sun.COMsection will be flushed out into detailed explanations, particularly for
1006*8044SWilliam.Kucharski@Sun.COMthe I/O restriction technique.
1007*8044SWilliam.Kucharski@Sun.COM
1008*8044SWilliam.Kucharski@Sun.COMThe general rule is that the data comparison technique is the quick and
1009*8044SWilliam.Kucharski@Sun.COMdirty solution. It works most of the time, but doesn't cover all the
1010*8044SWilliam.Kucharski@Sun.COMbases, and is relatively simple.
1011*8044SWilliam.Kucharski@Sun.COM
1012*8044SWilliam.Kucharski@Sun.COMThe I/O restriction technique is much more complex, but it has potential
1013*8044SWilliam.Kucharski@Sun.COMto solve the problem under all conditions, plus allow access of the
1014*8044SWilliam.Kucharski@Sun.COMremaining @sc{bios} devices when not all of them have operating system
1015*8044SWilliam.Kucharski@Sun.COMdrivers.
1016*8044SWilliam.Kucharski@Sun.COM
1017*8044SWilliam.Kucharski@Sun.COM@menu
1018*8044SWilliam.Kucharski@Sun.COM* Data comparison technique::
1019*8044SWilliam.Kucharski@Sun.COM* I/O restriction technique::
1020*8044SWilliam.Kucharski@Sun.COM@end menu
1021*8044SWilliam.Kucharski@Sun.COM
1022*8044SWilliam.Kucharski@Sun.COM
1023*8044SWilliam.Kucharski@Sun.COM@node Data comparison technique
1024*8044SWilliam.Kucharski@Sun.COM@subsection Data comparison technique
1025*8044SWilliam.Kucharski@Sun.COM
1026*8044SWilliam.Kucharski@Sun.COMBefore activating @emph{any} of the device drivers, gather enough data
1027*8044SWilliam.Kucharski@Sun.COMfrom similar sectors on each of the disks such that each one can be
1028*8044SWilliam.Kucharski@Sun.COMuniquely identified.
1029*8044SWilliam.Kucharski@Sun.COM
1030*8044SWilliam.Kucharski@Sun.COMAfter activating the device drivers, compare data from the drives using
1031*8044SWilliam.Kucharski@Sun.COMthe operating system drivers. This should hopefully be sufficient to
1032*8044SWilliam.Kucharski@Sun.COMprovide such a mapping.
1033*8044SWilliam.Kucharski@Sun.COM
1034*8044SWilliam.Kucharski@Sun.COMProblems:
1035*8044SWilliam.Kucharski@Sun.COM
1036*8044SWilliam.Kucharski@Sun.COM@enumerate
1037*8044SWilliam.Kucharski@Sun.COM@item
1038*8044SWilliam.Kucharski@Sun.COMThe data on some @sc{bios} devices might be identical (so the part
1039*8044SWilliam.Kucharski@Sun.COMreading the drives from the @sc{bios} should have some mechanism to give
1040*8044SWilliam.Kucharski@Sun.COMup).
1041*8044SWilliam.Kucharski@Sun.COM
1042*8044SWilliam.Kucharski@Sun.COM@item
1043*8044SWilliam.Kucharski@Sun.COMThere might be extra drives not accessible from the @sc{bios} which are
1044*8044SWilliam.Kucharski@Sun.COMidentical to some drive used by the @sc{bios} (so it should be capable
1045*8044SWilliam.Kucharski@Sun.COMof giving up there as well).
1046*8044SWilliam.Kucharski@Sun.COM@end enumerate
1047*8044SWilliam.Kucharski@Sun.COM
1048*8044SWilliam.Kucharski@Sun.COM
1049*8044SWilliam.Kucharski@Sun.COM@node I/O restriction technique
1050*8044SWilliam.Kucharski@Sun.COM@subsection I/O restriction technique
1051*8044SWilliam.Kucharski@Sun.COM
1052*8044SWilliam.Kucharski@Sun.COMThis first step may be unnecessary, but first create copy-on-write
1053*8044SWilliam.Kucharski@Sun.COMmappings for the device drivers writing into @sc{pc} @sc{ram}. Keep the
1054*8044SWilliam.Kucharski@Sun.COMoriginal copies for the @dfn{clean @sc{bios} virtual machine} to be
1055*8044SWilliam.Kucharski@Sun.COMcreated later.
1056*8044SWilliam.Kucharski@Sun.COM
1057*8044SWilliam.Kucharski@Sun.COMFor each device driver brought online, determine which @sc{bios} devices
1058*8044SWilliam.Kucharski@Sun.COMbecome inaccessible by:
1059*8044SWilliam.Kucharski@Sun.COM
1060*8044SWilliam.Kucharski@Sun.COM@enumerate
1061*8044SWilliam.Kucharski@Sun.COM@item
1062*8044SWilliam.Kucharski@Sun.COMCreate a @dfn{clean @sc{bios} virtual machine}.
1063*8044SWilliam.Kucharski@Sun.COM
1064*8044SWilliam.Kucharski@Sun.COM@item
1065*8044SWilliam.Kucharski@Sun.COMSet the I/O permission map for the I/O area claimed by the device driver
1066*8044SWilliam.Kucharski@Sun.COMto no permissions (neither read nor write).
1067*8044SWilliam.Kucharski@Sun.COM
1068*8044SWilliam.Kucharski@Sun.COM@item
1069*8044SWilliam.Kucharski@Sun.COMAccess each device.
1070*8044SWilliam.Kucharski@Sun.COM
1071*8044SWilliam.Kucharski@Sun.COM@item
1072*8044SWilliam.Kucharski@Sun.COMRecord which devices succeed, and those which try to access the
1073*8044SWilliam.Kucharski@Sun.COM@dfn{restricted} I/O areas (hopefully, this will be an @dfn{xor}
1074*8044SWilliam.Kucharski@Sun.COMsituation).
1075*8044SWilliam.Kucharski@Sun.COM@end enumerate
1076*8044SWilliam.Kucharski@Sun.COM
1077*8044SWilliam.Kucharski@Sun.COMFor each device driver, given how many of the @sc{bios} devices were
1078*8044SWilliam.Kucharski@Sun.COMsubsumed by it (there should be no gaps in this list), it should be easy
1079*8044SWilliam.Kucharski@Sun.COMto determine which devices on the controller these are.
1080*8044SWilliam.Kucharski@Sun.COM
1081*8044SWilliam.Kucharski@Sun.COMIn general, you have at most 2 disks from each controller given
1082*8044SWilliam.Kucharski@Sun.COM@sc{bios} numbers, but they pretty much always count from the lowest
1083*8044SWilliam.Kucharski@Sun.COMlogically numbered devices on the controller.
1084*8044SWilliam.Kucharski@Sun.COM
1085*8044SWilliam.Kucharski@Sun.COM
1086*8044SWilliam.Kucharski@Sun.COM@node Example OS code
1087*8044SWilliam.Kucharski@Sun.COM@section Example OS code
1088*8044SWilliam.Kucharski@Sun.COM
1089*8044SWilliam.Kucharski@Sun.COMIn this distribution, the example Multiboot kernel @file{kernel} is
1090*8044SWilliam.Kucharski@Sun.COMincluded. The kernel just prints out the Multiboot information structure
1091*8044SWilliam.Kucharski@Sun.COMon the screen, so you can make use of the kernel to test a
1092*8044SWilliam.Kucharski@Sun.COMMultiboot-compliant boot loader and for reference to how to implement a
1093*8044SWilliam.Kucharski@Sun.COMMultiboot kernel. The source files can be found under the directory
1094*8044SWilliam.Kucharski@Sun.COM@file{docs} in the GRUB distribution.
1095*8044SWilliam.Kucharski@Sun.COM
1096*8044SWilliam.Kucharski@Sun.COMThe kernel @file{kernel} consists of only three files: @file{boot.S},
1097*8044SWilliam.Kucharski@Sun.COM@file{kernel.c} and @file{multiboot.h}. The assembly source
1098*8044SWilliam.Kucharski@Sun.COM@file{boot.S} is written in GAS (@pxref{Top, , GNU assembler, as.info,
1099*8044SWilliam.Kucharski@Sun.COMThe GNU assembler}), and contains the Multiboot information structure to
1100*8044SWilliam.Kucharski@Sun.COMcomply with the specification. When a Multiboot-compliant boot loader
1101*8044SWilliam.Kucharski@Sun.COMloads and execute it, it initialize the stack pointer and @code{EFLAGS},
1102*8044SWilliam.Kucharski@Sun.COMand then call the function @code{cmain} defined in @file{kernel.c}. If
1103*8044SWilliam.Kucharski@Sun.COM@code{cmain} returns to the callee, then it shows a message to inform
1104*8044SWilliam.Kucharski@Sun.COMthe user of the halt state and stops forever until you push the reset
1105*8044SWilliam.Kucharski@Sun.COMkey. The file @file{kernel.c} contains the function @code{cmain},
1106*8044SWilliam.Kucharski@Sun.COMwhich checks if the magic number passed by the boot loader is valid and
1107*8044SWilliam.Kucharski@Sun.COMso on, and some functions to print messages on the screen. The file
1108*8044SWilliam.Kucharski@Sun.COM@file{multiboot.h} defines some macros, such as the magic number for the
1109*8044SWilliam.Kucharski@Sun.COMMultiboot header, the Multiboot header structure and the Multiboot
1110*8044SWilliam.Kucharski@Sun.COMinformation structure.
1111*8044SWilliam.Kucharski@Sun.COM
1112*8044SWilliam.Kucharski@Sun.COM@menu
1113*8044SWilliam.Kucharski@Sun.COM* multiboot.h::
1114*8044SWilliam.Kucharski@Sun.COM* boot.S::
1115*8044SWilliam.Kucharski@Sun.COM* kernel.c::
1116*8044SWilliam.Kucharski@Sun.COM* Other Multiboot kernels::
1117*8044SWilliam.Kucharski@Sun.COM@end menu
1118*8044SWilliam.Kucharski@Sun.COM
1119*8044SWilliam.Kucharski@Sun.COM
1120*8044SWilliam.Kucharski@Sun.COM@node multiboot.h
1121*8044SWilliam.Kucharski@Sun.COM@subsection multiboot.h
1122*8044SWilliam.Kucharski@Sun.COM
1123*8044SWilliam.Kucharski@Sun.COMThis is the source code in the file @file{multiboot.h}:
1124*8044SWilliam.Kucharski@Sun.COM
1125*8044SWilliam.Kucharski@Sun.COM@example
1126*8044SWilliam.Kucharski@Sun.COM@include multiboot.h.texi
1127*8044SWilliam.Kucharski@Sun.COM@end example
1128*8044SWilliam.Kucharski@Sun.COM
1129*8044SWilliam.Kucharski@Sun.COM
1130*8044SWilliam.Kucharski@Sun.COM@node boot.S
1131*8044SWilliam.Kucharski@Sun.COM@subsection boot.S
1132*8044SWilliam.Kucharski@Sun.COM
1133*8044SWilliam.Kucharski@Sun.COMIn the file @file{boot.S}:
1134*8044SWilliam.Kucharski@Sun.COM
1135*8044SWilliam.Kucharski@Sun.COM@example
1136*8044SWilliam.Kucharski@Sun.COM@include boot.S.texi
1137*8044SWilliam.Kucharski@Sun.COM@end example
1138*8044SWilliam.Kucharski@Sun.COM
1139*8044SWilliam.Kucharski@Sun.COM
1140*8044SWilliam.Kucharski@Sun.COM@node kernel.c
1141*8044SWilliam.Kucharski@Sun.COM@subsection kernel.c
1142*8044SWilliam.Kucharski@Sun.COM
1143*8044SWilliam.Kucharski@Sun.COMAnd, in the file @file{kernel.c}:
1144*8044SWilliam.Kucharski@Sun.COM
1145*8044SWilliam.Kucharski@Sun.COM@example
1146*8044SWilliam.Kucharski@Sun.COM@include kernel.c.texi
1147*8044SWilliam.Kucharski@Sun.COM@end example
1148*8044SWilliam.Kucharski@Sun.COM
1149*8044SWilliam.Kucharski@Sun.COM
1150*8044SWilliam.Kucharski@Sun.COM@node Other Multiboot kernels
1151*8044SWilliam.Kucharski@Sun.COM@subsection Other Multiboot kernels
1152*8044SWilliam.Kucharski@Sun.COM
1153*8044SWilliam.Kucharski@Sun.COMOther useful information should be available in Multiboot kernels, such
1154*8044SWilliam.Kucharski@Sun.COMas GNU Mach and Fiasco @url{http://os.inf.tu-dresden.de/fiasco/}. And,
1155*8044SWilliam.Kucharski@Sun.COMit is worth mentioning the OSKit
1156*8044SWilliam.Kucharski@Sun.COM@url{http://www.cs.utah.edu/projects/flux/oskit/}, which provides a
1157*8044SWilliam.Kucharski@Sun.COMlibrary supporting the specification.
1158*8044SWilliam.Kucharski@Sun.COM
1159*8044SWilliam.Kucharski@Sun.COM
1160*8044SWilliam.Kucharski@Sun.COM@node Example boot loader code
1161*8044SWilliam.Kucharski@Sun.COM@section Example boot loader code
1162*8044SWilliam.Kucharski@Sun.COM
1163*8044SWilliam.Kucharski@Sun.COMThe GNU GRUB (@pxref{Top, , GRUB, grub.info, The GRUB manual}) project
1164*8044SWilliam.Kucharski@Sun.COMis a full Multiboot-compliant boot loader, supporting all required and
1165*8044SWilliam.Kucharski@Sun.COMoptional features present in this specification. A public release has
1166*8044SWilliam.Kucharski@Sun.COMnot been made, but the test release is available from:
1167*8044SWilliam.Kucharski@Sun.COM
1168*8044SWilliam.Kucharski@Sun.COM@url{ftp://alpha.gnu.org/gnu/grub}
1169*8044SWilliam.Kucharski@Sun.COM
1170*8044SWilliam.Kucharski@Sun.COMSee the webpage @url{http://www.gnu.org/software/grub/grub.html}, for
1171*8044SWilliam.Kucharski@Sun.COMmore information.
1172*8044SWilliam.Kucharski@Sun.COM
1173*8044SWilliam.Kucharski@Sun.COM
1174*8044SWilliam.Kucharski@Sun.COM@node History
1175*8044SWilliam.Kucharski@Sun.COM@chapter The change log of this specification
1176*8044SWilliam.Kucharski@Sun.COM
1177*8044SWilliam.Kucharski@Sun.COM@table @asis
1178*8044SWilliam.Kucharski@Sun.COM@item 0.7
1179*8044SWilliam.Kucharski@Sun.COM@itemize @bullet
1180*8044SWilliam.Kucharski@Sun.COM@item
1181*8044SWilliam.Kucharski@Sun.COM@dfn{Multiboot Standard} is renamed to @dfn{Multiboot Specification}.
1182*8044SWilliam.Kucharski@Sun.COM
1183*8044SWilliam.Kucharski@Sun.COM@item
1184*8044SWilliam.Kucharski@Sun.COMGraphics fields are added to Multiboot header.
1185*8044SWilliam.Kucharski@Sun.COM
1186*8044SWilliam.Kucharski@Sun.COM@item
1187*8044SWilliam.Kucharski@Sun.COMBIOS drive information, BIOS configuration table, the name of a boot
1188*8044SWilliam.Kucharski@Sun.COMloader, APM information, and graphics information are added to Multiboot
1189*8044SWilliam.Kucharski@Sun.COMinformation.
1190*8044SWilliam.Kucharski@Sun.COM
1191*8044SWilliam.Kucharski@Sun.COM@item
1192*8044SWilliam.Kucharski@Sun.COMRewritten in Texinfo format.
1193*8044SWilliam.Kucharski@Sun.COM
1194*8044SWilliam.Kucharski@Sun.COM@item
1195*8044SWilliam.Kucharski@Sun.COMRewritten, using more strict words.
1196*8044SWilliam.Kucharski@Sun.COM
1197*8044SWilliam.Kucharski@Sun.COM@item
1198*8044SWilliam.Kucharski@Sun.COMThe maintainer changes to the GNU GRUB maintainer team
1199*8044SWilliam.Kucharski@Sun.COM@email{bug-grub@@gnu.org}, from Bryan Ford and Erich Stefan Boleyn.
1200*8044SWilliam.Kucharski@Sun.COM@end itemize
1201*8044SWilliam.Kucharski@Sun.COM
1202*8044SWilliam.Kucharski@Sun.COM@item 0.6
1203*8044SWilliam.Kucharski@Sun.COM@itemize @bullet
1204*8044SWilliam.Kucharski@Sun.COM@item
1205*8044SWilliam.Kucharski@Sun.COMA few wording changes.
1206*8044SWilliam.Kucharski@Sun.COM
1207*8044SWilliam.Kucharski@Sun.COM@item
1208*8044SWilliam.Kucharski@Sun.COMHeader checksum.
1209*8044SWilliam.Kucharski@Sun.COM
1210*8044SWilliam.Kucharski@Sun.COM@item
1211*8044SWilliam.Kucharski@Sun.COMClasification of machine state passed to an operating system.
1212*8044SWilliam.Kucharski@Sun.COM@end itemize
1213*8044SWilliam.Kucharski@Sun.COM
1214*8044SWilliam.Kucharski@Sun.COM@item 0.5
1215*8044SWilliam.Kucharski@Sun.COM@itemize @bullet
1216*8044SWilliam.Kucharski@Sun.COM@item
1217*8044SWilliam.Kucharski@Sun.COMName change.
1218*8044SWilliam.Kucharski@Sun.COM@end itemize
1219*8044SWilliam.Kucharski@Sun.COM
1220*8044SWilliam.Kucharski@Sun.COM@item 0.4
1221*8044SWilliam.Kucharski@Sun.COM@itemize @bullet
1222*8044SWilliam.Kucharski@Sun.COM@item
1223*8044SWilliam.Kucharski@Sun.COMMajor changes plus HTMLification.
1224*8044SWilliam.Kucharski@Sun.COM@end itemize
1225*8044SWilliam.Kucharski@Sun.COM@end table
1226*8044SWilliam.Kucharski@Sun.COM
1227*8044SWilliam.Kucharski@Sun.COM
1228*8044SWilliam.Kucharski@Sun.COM@node Index
1229*8044SWilliam.Kucharski@Sun.COM@unnumbered Index
1230*8044SWilliam.Kucharski@Sun.COM
1231*8044SWilliam.Kucharski@Sun.COM@printindex cp
1232*8044SWilliam.Kucharski@Sun.COM
1233*8044SWilliam.Kucharski@Sun.COM@contents
1234*8044SWilliam.Kucharski@Sun.COM@bye
1235