The NetBSD Project

CVS log for src/sys/arch/i386/i386/multiboot.c

[BACK] Up to [] / src / sys / arch / i386 / i386

Request diff between arbitrary revisions

Default branch: MAIN
Current tag: MAIN

Revision 1.23 / (download) - annotate - [select for diffs], Mon May 30 17:45:26 2016 UTC (2 years ago) by dholland
Branch: MAIN
CVS Tags: tls-maxphys-base-20171202, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-base, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, nick-nhusb-base-20170825, nick-nhusb-base-20170204, nick-nhusb-base-20161204, nick-nhusb-base-20161004, nick-nhusb-base-20160907, netbsd-8-base, netbsd-8-0-RC1, netbsd-8, matt-nb8-mediatek-base, matt-nb8-mediatek, localcount-20160914, jdolecek-ncq-base, jdolecek-ncq, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan, HEAD
Changes since 1.22: +3 -3 lines
Diff to previous 1.22 (colored)

PR 51187 David Binderman: simplify redundant conditional

Revision 1.22 / (download) - annotate - [select for diffs], Fri Dec 7 04:49:08 2012 UTC (5 years, 6 months ago) by msaitoh
Branch: MAIN
CVS Tags: yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, rmind-smpnet-nbase, rmind-smpnet-base, rmind-smpnet, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, nick-nhusb-base-20160529, nick-nhusb-base-20160422, nick-nhusb-base-20160319, nick-nhusb-base-20151226, nick-nhusb-base-20150921, nick-nhusb-base-20150606, nick-nhusb-base-20150406, nick-nhusb-base, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, khorben-n900, agc-symver-base, agc-symver
Branch point for: nick-nhusb
Changes since 1.21: +3 -3 lines
Diff to previous 1.21 (colored)

Fix off by one.

Revision 1.21 / (download) - annotate - [select for diffs], Tue Jan 11 12:24:37 2011 UTC (7 years, 5 months ago) by gsutre
Branch: MAIN
CVS Tags: yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, uebayasi-xip-base7, rmind-uvmplock-nbase, rmind-uvmplock-base, netbsd-6-base, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, jym-xensuspend-nbase, jym-xensuspend-base, jruoho-x86intr-base, jruoho-x86intr, jmcneill-usbmp-pre-base2, jmcneill-usbmp-base9, jmcneill-usbmp-base8, jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base5, jmcneill-usbmp-base4, jmcneill-usbmp-base3, jmcneill-usbmp-base2, jmcneill-usbmp-base10, jmcneill-usbmp-base, jmcneill-usbmp, jmcneill-audiomp3-base, jmcneill-audiomp3, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Branch point for: yamt-pagecache, tls-maxphys, netbsd-6-0, netbsd-6
Changes since 1.20: +12 -5 lines
Diff to previous 1.20 (colored)

As said in the comment (lines 327-336), we must make sure that
we don't overwrite valid data when moving the symbol and string

Assume for instance that the boot-loader left us with:

  +--------------+   +--------+     +--------------+
  | string table |   | kernel |     | symbol table |
  +--------------+   +--------+     +--------------+

The new addresses computed by lines 338-359 (here, it's really
lines 344-345) will move the tables so that they end up as:

                     | kernel | symbol table | string table |

The current version (rev. 1.20) will, however, first copy the
string table and then the symbol table.  But the copy of the
string table will overwrite the symbol table (see the pictures).

The old code (rev. 1.19) uses the right order of table copy to
make sure that we don't overwrite one table when moving the
other.  Here, we simply restore this behavior.  This makes
multibooting from GRUB2 work again (for MONOLITHIC).

ok jmcneill@

Revision 1.20 / (download) - annotate - [select for diffs], Sat Jul 24 00:45:55 2010 UTC (7 years, 11 months ago) by jym
Branch: MAIN
CVS Tags: yamt-nfs-mp-base11, yamt-nfs-mp-base10, uebayasi-xip-base6, uebayasi-xip-base5, uebayasi-xip-base4, uebayasi-xip-base3, uebayasi-xip-base2, matt-mips64-premerge-20101231
Changes since 1.19: +22 -29 lines
Diff to previous 1.19 (colored)

Welcome PAE inside i386 current.

This patch is inspired by work previously done by Jeremy Morse, ported by me
to -current, merged with the work previously done for port-xen, together with
additionals fixes and improvements.

PAE option is disabled by default in GENERIC (but will be enabled in ALL in
the next few days).

In quick, PAE switches the CPU to a mode where physical addresses become
36 bits (64 GiB). Virtual address space remains at 32 bits (4 GiB). To cope
with the increased size of the physical address, they are manipulated as
64 bits variables by kernel and MMU.

When supported by the CPU, it also allows the use of the NX/XD bit that
provides no-execution right enforcement on a per physical page basis.


- reworked locore.S

- introduce cpu_load_pmap(), used to switch pmap for the curcpu. Due to the
different handling of pmap mappings with PAE vs !PAE, Xen vs native, details
are hidden within this function. This helps calling it from assembly,
as some features, like BIOS calls, switch to pmap_kernel before mapping
trampoline code in low memory.

- some changes in bioscall and kvm86_call, to reflect the above.

- the L3 is "pinned" per-CPU, and is only manipulated by a
reduced set of functions within pmap. To track the L3, I added two
elements to struct cpu_info, namely ci_l3_pdirpa (PA of the L3), and
ci_l3_pdir (the L3 VA). Rest of the code considers that it runs "just
like" a normal i386, except that the L2 is 4 pages long (PTP_LEVELS is
still 2).

- similar to the ci_pae_l3_pdir{,pa} variables, amd64's xen_current_user_pgd
becomes an element of cpu_info (slowly paving the way for MP world).

- bootinfo_source struct declaration is modified, to cope with paddr_t size
change with PAE (it is not correct to assume that bs_addr is a paddr_t when
compiled with PAE - it should remain 32 bits). bs_addrs is now a
void * array (in bootloader's code under i386/stand/, the bs_addrs
is a physaddr_t, which is an unsigned long).

- fixes in multiboot code (same reason as bootinfo): paddr_t size
change. I used Elf32_* types, use RELOC() where necessary, and move the
memcpy() functions out of the if/else if (I do not expect sym and str tables
to overlap with ELF).

- 64 bits atomic functions for pmap

- all pmap_pdirpa access are now done through the pmap_pdirpa macro. It
hides the L3/L2 stuff from PAE, as well as the pm_pdirpa change in
struct pmap (it now becomes a PDP_SIZE array, with or without PAE).

- manipulation of recursive mappings ( PDIR_SLOT_{,A}PTEs ) is done via
loops on PDP_SIZE.

See also

No objection raised on port-i386@ and port-xen@R for about a week.

XXX kvm(3) will be fixed in another patch to properly handle both PAE and !PAE
kernel dumps (VA => PA macros are slightly different, and need proper 64 bits
PA support in kvm_i386).

XXX Mixing PAE and !PAE modules may lead to unwanted/unexpected results. This
cannot be solved easily, and needs lots of thinking before being declared
safe (paddr_t/bus_addr_t size handling, PD/PT macros abstractions).

Revision 1.19 / (download) - annotate - [select for diffs], Sun Feb 22 18:05:42 2009 UTC (9 years, 4 months ago) by ahoka
Branch: MAIN
CVS Tags: yamt-nfs-mp-base9, yamt-nfs-mp-base8, yamt-nfs-mp-base7, yamt-nfs-mp-base6, yamt-nfs-mp-base5, yamt-nfs-mp-base4, yamt-nfs-mp-base3, uebayasi-xip-base1, uebayasi-xip-base, nick-hppapmap-base4, nick-hppapmap-base3, nick-hppapmap-base2, nick-hppapmap-base, matt-premerge-20091211, jymxensuspend-base
Branch point for: uebayasi-xip, rmind-uvmplock
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored)

Add a missing opt_multiboot.h into sys/arch/i386/i386/machdep.c.
Also do the missed rename of multiboot_ksyms_init to
multiboot_ksyms_addsyms_elf to compile with MULTIBOOT set.

This caused a minor and a more serious bug in the past:
- dmesg did not contain the information about the loader
- /dev/ksyms did not work when the kernel was booted with a
  multiboot bootloader (grub for example)

Ok by jmcneill, joerg.

Revision 1.18 / (download) - annotate - [select for diffs], Sun Nov 30 18:21:34 2008 UTC (9 years, 6 months ago) by martin
Branch: MAIN
CVS Tags: mjf-devfs2-base, haad-nbase2, haad-dm-base2, haad-dm-base, ad-audiomp2-base, ad-audiomp2
Branch point for: jym-xensuspend
Changes since 1.17: +3 -3 lines
Diff to previous 1.17 (colored)

As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.

Revision 1.17 / (download) - annotate - [select for diffs], Sat Oct 11 11:06:19 2008 UTC (9 years, 8 months ago) by joerg
Branch: MAIN
CVS Tags: netbsd-5-base, netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, netbsd-5, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-base2, haad-dm-base1
Branch point for: nick-hppapmap
Changes since 1.16: +4 -2 lines
Diff to previous 1.16 (colored)

Add "multiboot" command to boot multiboot compliant kernels like Xen.
Patch provided by Robert Swindell with fixes for the command line
parsing and addition of passing module options from me. The kernel now
always gets the full string for modules like for the command line,
everything before the first space/tab is the path name of the module.

Revision 1.16 / (download) - annotate - [select for diffs], Mon Apr 28 20:23:24 2008 UTC (10 years, 1 month ago) by martin
Branch: MAIN
CVS Tags: yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-nfs-mp-base2, wrstuden-revivesa-base-4, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, wrstuden-revivesa, simonb-wapbl-nbase, simonb-wapbl-base, simonb-wapbl, hpcarm-cleanup-nbase
Branch point for: haad-dm
Changes since 1.15: +2 -9 lines
Diff to previous 1.15 (colored)

Remove clause 3 and 4 from TNF licenses

Revision 1.15 / (download) - annotate - [select for diffs], Sat Mar 22 16:50:17 2008 UTC (10 years, 3 months ago) by jmmv
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base, yamt-nfs-mp-base, yamt-lazymbuf-base15, yamt-lazymbuf-base14, ad-socklock-base1
Branch point for: yamt-pf42, yamt-nfs-mp
Changes since 1.14: +4 -3 lines
Diff to previous 1.14 (colored)

Fix esym calculation to match comments.  Reported by Gao Ya'nan in
PR port-i386/38170.

Revision 1.14 / (download) - annotate - [select for diffs], Fri Feb 29 10:45:50 2008 UTC (10 years, 3 months ago) by jmmv
Branch: MAIN
CVS Tags: matt-armv6-nbase, keiichi-mipv6-nbase, keiichi-mipv6-base
Changes since 1.13: +13 -5 lines
Diff to previous 1.13 (colored)

Discard invalid console parameters, which cause initialization failures
later on.  Reported by njoly@.

Revision 1.13 / (download) - annotate - [select for diffs], Fri Feb 29 10:23:53 2008 UTC (10 years, 3 months ago) by jmmv
Branch: MAIN
Changes since 1.12: +3 -3 lines
Diff to previous 1.12 (colored)

Drop trailing whitespace.

Revision 1.12 / (download) - annotate - [select for diffs], Wed Mar 7 21:43:45 2007 UTC (11 years, 3 months ago) by thorpej
Branch: MAIN
CVS Tags: yamt-x86pmap-base4, yamt-x86pmap-base3, yamt-x86pmap-base2, yamt-x86pmap-base, yamt-x86pmap, yamt-kmem-base3, yamt-kmem-base2, yamt-kmem-base, yamt-kmem, yamt-idlelwp-base8, vmlocking2-base3, vmlocking2-base2, vmlocking2-base1, vmlocking2, vmlocking-nbase, vmlocking-base, vmlocking, thorpej-atomic-base, thorpej-atomic, reinoud-bufcleanup-nbase, reinoud-bufcleanup-base, reinoud-bufcleanup, ppcoea-renovation-base, ppcoea-renovation, nick-net80211-sync-base, nick-net80211-sync, nick-csl-alignment-base5, nick-csl-alignment-base, nick-csl-alignment, mjf-ufs-trans-base, mjf-ufs-trans, mjf-devfs-base, mjf-devfs, matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, matt-armv6-base, jmcneill-pm-base, jmcneill-pm, jmcneill-base, hpcarm-cleanup-base, hpcarm-cleanup, cube-autoconf-base, cube-autoconf, bouyer-xeni386-nbase, bouyer-xeni386-merge1, bouyer-xeni386-base, bouyer-xeni386, bouyer-xenamd64-base2, bouyer-xenamd64-base, bouyer-xenamd64
Branch point for: mjf-devfs2, matt-armv6, keiichi-mipv6
Changes since 1.11: +7 -7 lines
Diff to previous 1.11 (colored)

TRUE -> true, FALSE -> false

Revision 1.11 / (download) - annotate - [select for diffs], Sun Mar 4 05:59:57 2007 UTC (11 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.10: +7 -7 lines
Diff to previous 1.10 (colored)

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.

Revision 1.10 / (download) - annotate - [select for diffs], Wed Feb 21 22:59:44 2007 UTC (11 years, 4 months ago) by thorpej
Branch: MAIN
CVS Tags: ad-audiomp-base, ad-audiomp
Changes since 1.9: +7 -7 lines
Diff to previous 1.9 (colored)

Replace the Mach-derived boolean_t type with the C99 bool type.  A
future commit will replace use of TRUE and FALSE with true and false.

Revision 1.9 / (download) - annotate - [select for diffs], Mon Nov 6 13:35:35 2006 UTC (11 years, 7 months ago) by jmmv
Branch: MAIN
CVS Tags: yamt-splraiseipl-base5, yamt-splraiseipl-base4, yamt-splraiseipl-base3, wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, post-newlock2-merge, newlock2-nbase, newlock2-base, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4, matt-nb4-arm-base, matt-nb4-arm
Branch point for: yamt-idlelwp
Changes since 1.8: +15 -3 lines
Diff to previous 1.8 (colored)

Pass a simple ELF header to ksyms_init_explicit with the minimum contents
required to initialize ksyms_hdr.  Otherwise LKMs do not work when using
ksyms_init_explicit instead of ksyms_init, as is the case of booting an
i386 kernel using Multiboot.

Revision 1.8 / (download) - annotate - [select for diffs], Wed Oct 25 13:56:16 2006 UTC (11 years, 7 months ago) by jmmv
Branch: MAIN
Changes since 1.7: +94 -129 lines
Diff to previous 1.7 (colored)

Remove the usage of Multiboot's "a.out kludge" to tell the boot loader to
reserve some more space for the BSS section than the binary says.  This
trick was used to leave room after the kernel's image to copy the symbol
table following the format required by ksyms_init.  (It was also used to
workaround a bug in the physical address fields of the binary, but this has
been long fixed.)  Yes, the MULTIBOOT_SYMTAB_SPACE option goes away; yay!

Instead, copy the required data after the kernel in a way that avoids having
to reserve space and use the new ksyms_init_explicit function to avoid the
need to construct a minimal ELF image.

Fixes ksyms when using an "unpatched" GRUB (one that does not contain the
fix to honour the "a.out kludge" for ELF images, even when present) -- i.e.
ddb and lkms.  As a side effect, the new code is much clearer to read and

Closes PR port-i386/32865.

Revision 1.7 / (download) - annotate - [select for diffs], Thu Oct 12 01:30:42 2006 UTC (11 years, 8 months ago) by christos
Branch: MAIN
CVS Tags: yamt-splraiseipl-base2
Changes since 1.6: +3 -3 lines
Diff to previous 1.6 (colored)

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386

Revision 1.6 / (download) - annotate - [select for diffs], Mon Jul 31 20:59:07 2006 UTC (11 years, 10 months ago) by mrg
Branch: MAIN
CVS Tags: yamt-splraiseipl-base, yamt-pdpolicy-base9, yamt-pdpolicy-base8, yamt-pdpolicy-base7, rpaulo-netinet-merge-pcb-base, abandoned-netbsd-4-base, abandoned-netbsd-4
Branch point for: yamt-splraiseipl, rpaulo-netinet-merge-pcb, newlock2
Changes since 1.5: +15 -4 lines
Diff to previous 1.5 (colored)

add a new "biosmem_implicit" variable that is set when a bootloader
info parser sets "biosbasemem" and "biosextmem" from.  check for this
when probing memory size, rather than biosbasemem/biosextmem being
zero which is no longer true.  also, make the REALBASEMEM/REALEXTMEM
options work properly with multiboot-booted kernels.  fixes PR#33918.

Revision 1.5 / (download) - annotate - [select for diffs], Sun Jul 16 21:16:22 2006 UTC (11 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.4: +7 -2 lines
Diff to previous 1.4 (colored)

PR/34007: Noriyuki Shiota: vmstat fails on the multiboot kernel booted by
GRUB-0.97. Initialize some previously unititiazed ELF header fields.

Revision 1.4 / (download) - annotate - [select for diffs], Sat Feb 4 11:28:54 2006 UTC (12 years, 4 months ago) by jmmv
Branch: MAIN
CVS Tags: yamt-uio_vmspace-base5, yamt-pdpolicy-base6, yamt-pdpolicy-base5, yamt-pdpolicy-base4, yamt-pdpolicy-base3, yamt-pdpolicy-base2, yamt-pdpolicy-base, simonb-timecounters-base, peter-altq-base, peter-altq, gdamore-uart-base, gdamore-uart, elad-kernelauth-base, elad-kernelauth, chap-midi-nbase, chap-midi-base, chap-midi
Branch point for: yamt-uio_vmspace, yamt-pdpolicy, yamt-lazymbuf
Changes since 1.3: +14 -15 lines
Diff to previous 1.3 (colored)

Now that my idea to fix the detection of the boot device cannot work, reword
the 'XXX' comment and remove the marker.  Also, in case there is no match,
fall back to wd0 instead of nothing.

Revision 1.3 / (download) - annotate - [select for diffs], Sat Feb 4 11:24:42 2006 UTC (12 years, 4 months ago) by jmmv
Branch: MAIN
Changes since 1.2: +12 -30 lines
Diff to previous 1.2 (colored)

Revert yesterday's change that attempted to fix the detection of the
boot device when using a Multiboot boot loader.  It couldn't work because
these boot loaders do not pass a checksum of the disk so matchbiosdisk()
cannot really find any matches.  I should have gone to sleep before

Found by xtraeme@.

Revision 1.2 / (download) - annotate - [select for diffs], Fri Feb 3 23:33:30 2006 UTC (12 years, 4 months ago) by jmmv
Branch: MAIN
Branch point for: simonb-timecounters
Changes since 1.1: +32 -14 lines
Diff to previous 1.1 (colored)

When booting an i386 kernel with Multiboot, properly detect the boot device
by looking it up in the x86_alldisks table (instead of trying to match it
to 'wd*' manually).

In order to do this, move the cpu_rootconf function from x86 common code
to amd64 and i386 specific one.  This way, i386 can do an extra step (call
the appropriate Multiboot code) in the appropriate place (after
x86_matchbiosdisks and before findroot()).

Revision 1.1 / (download) - annotate - [select for diffs], Fri Feb 3 11:08:24 2006 UTC (12 years, 4 months ago) by jmmv
Branch: MAIN

Implement support for 'The Multiboot Specification' so that i386 kernels
can be booted directly from Multiboot-compliant boot loaders (e.g. GRUB).
See the added multiboot(8) manual page for more information.

No objections in tech-kern@; only positive comments.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

CVSweb <>