Commit Graph

2239 Commits

Author SHA1 Message Date
Roman Divacky
ae1f5a71f2 Mark getc() as inline, this has no effect on gcc but helps clang.
Approved by:    jhb
2011-04-06 17:29:40 +00:00
Yoshihiro Takahashi
c3e05ae05d MFi386: revision 220337
Build boot2 with -mregparm=3.
2011-04-05 13:48:53 +00:00
Roman Divacky
57ac2e1286 Build boot2 with -mregparm=3, ie. pass upto 3 arguments via registers.
This modifies CFLAGS and tweaks sio.S to use the new calling convention.
The sio_init() and sio_putc() prototypes are modified so that other
users of this code know the correct calling convention.

This makes the code smaller when compiled with clang.

Reviewed by:    jhb
Tested by:      me and Freddie Cash <fjwcash gmail com>
2011-04-04 18:23:55 +00:00
Marcel Moolenaar
0a215cf2d8 Fix a long standing bug where file_load() passes down the global loadaddr
to the l_load() method in the file_formats structure, while being passed
an address as an argument (dest). With file_load() calling arch_loadaddr()
now, this bug is a little bit more significant.

Spotted by: nyan@ (nice catch!)
2011-04-04 16:59:46 +00:00
Marcel Moolenaar
76ceb3c6ee Use the new arch_loadaddr I/F to align ELF objects to PBVM page
boundaries. For good measure, align all other objects to cache
lines boundaries.

Use the new arch_loadseg I/F to keep track of kernel text and
data so that we can wire as much of it as is possible. It is
the responsibility of the kernel to link critical (read IVT
related) code and data at the front of the respective segment
so that it's covered by TRs before the kernel has a chance to
add more translations.

Use a better way of determining whether we're loading a legacy
kernel or not. We can't check for the presence of the PBVM page
table, because we may have unloaded that kernel and loaded an
older (legacy) kernel after that. Simply use the latest load
address for it.
2011-04-03 23:49:20 +00:00
Marcel Moolenaar
0cca5d3d90 Add 2 new archsw interfaces:
1.  arch_loadaddr - used by platform code to adjust the address at which
    the object gets loaded. Implement PC98 using this new interface instead
    of using conditional compilation. For ELF objects the ELF header is
    passed as the data pointer. For raw files it's the filename. Note that
    ELF objects are first considered as raw files.
2.  arch_loadseg - used by platform code to keep track of actual segments,
    so that (instruction) caches can be flushed or translations can be
    created. Both the ELF header as well as the program header are passed
    to allow platform code to treat the kernel proper differently from any
    additional modules and to have all the relevant details of the loaded
    segment (e.g. protection).
2011-04-03 22:31:51 +00:00
Marcel Moolenaar
429d5c051f Revert rev 165325. The arch_maphint interface hasn't been in use for
more than 4 years.
2011-04-03 05:09:25 +00:00
Marcel Moolenaar
66ddefc574 Make the ski loader functional again after the previous set of changes. 2011-04-03 03:26:12 +00:00
Yoshihiro Takahashi
9d55f5499b MFi386: the part of 219452
- bunch of variables are turned into uint8_t.
  - the setting and reading of "fmt" in load() is removed.
  - buf in printf() is made static to save space.
2011-03-24 15:09:36 +00:00
Andrey V. Elsukov
b00a71345c The size of zfsboot2 grown up to 64 Kbytes in r219089.
Increase NSECT up to 128 sectors too.

Reviewed by:	jhb, pjd
2011-03-16 20:19:48 +00:00
Andrey V. Elsukov
fa3c0ecda2 Set control flags in putc(). This should fix zfsboot hangs in drvread().
PR:		kern/153552
Reviewed by:	jhb
MFC after:	1 week
2011-03-16 20:04:56 +00:00
Marcel Moolenaar
18d9407a9f MFaltix:
Add support for Pre-Boot Virtual Memory (PBVM) to the loader.

PBVM allows us to link the kernel at a fixed virtual address without
having to make any assumptions about the physical memory layout. On
the SGI Altix 350 for example, there's no usuable physical memory
below 192GB. Also, the PBVM allows us to control better where we're
going to physically load the kernel and its modules so that we can
make sure we load the kernel in memory that's close to the BSP.

The PBVM is managed by a simple page table. The minimum size of the
page table is 4KB (EFI page size) and the maximum is currently set
to 1MB. A page in the PBVM is 64KB, as that's the maximum alignment
one can specify in a linker script. The bottom line is that PBVM is
between 64KB and 8GB in size.

The loader maps the PBVM page table at a fixed virtual address and
using a single translations. The PBVM itself is also mapped using a
single translation for a maximum of 32MB.

While here, increase the heap in the EFI loader from 512KB to 2MB
and set the stage for supporting relocatable modules.
2011-03-16 03:53:18 +00:00
Marcel Moolenaar
e681e3cd56 Revert previous commit: EFI_STATUS is a 64-bit integral on ia64. Fix the
compile warning on i386 (where EFI_STATUS is a 32-bit integral) by casting
the status argument to u_long instead.

Pointy hat: brucec
MFC after: 3 days
2011-03-16 00:08:10 +00:00
Marcel Moolenaar
155438b4bd Merge svn+ssh://svn.freebsd.org/base/head@219680 2011-03-15 23:28:15 +00:00
Marcel Moolenaar
ebad0c04a2 Round the size, not the top address. This makes the code less
sensitive to compiler bugs (32-bit truncation).
2011-03-15 06:04:13 +00:00
David Christensen
dd46ab31de - Initial release of bxe(4) to support Broadcom NetXtreme II 10GbE.
(BCM57710, BCM57711, BCM57711E)

MFC after:	One month
2011-03-14 22:42:41 +00:00
Marcel Moolenaar
69be896a5e Change the sz argumnt to mmu_wire() from u_int to vm_size_t. It's a
size in bytes...
2011-03-14 05:13:52 +00:00
Marcel Moolenaar
72e1680189 o Make sure the page table has a size that is mappable. Certain page
sizes are not supported.
o   Map the PBVM page table.
o   Map the PBVM using the largest possible power of 2 that is less than
    the amount of PBVM used and round down to a valid page size. Note
    that the current kernel is between 8MB and 16MB in size, which would
    mean that 8MB would be the typical size of the mapping, if only 8MB
    wasn't an invalid page size. In practice, we end up mapping the first
    4MB of PBVM in most cases.
2011-03-13 22:04:19 +00:00
Marcel Moolenaar
db06a6f4ef Merge svn+ssh://svn.freebsd.org/base/head@219553 2011-03-12 01:26:04 +00:00
Marcel Moolenaar
6097660fbc Bump the version information to account for PBVM support. 2011-03-11 22:16:05 +00:00
Marcel Moolenaar
76dd035301 Implement Pre-Boot Virtual Memory (PBVM). There's no 1-to-1 mapping
between kernel virtual address and physical address anymore. This so
that we can link the kernel at some virtual address without having
to worry whether the corresponding physical memory exists and is
available. The PBVM uses 64KB pages that are mapped to physical
addresses using a page table. The page table is at least 1 EFI page
in size, but can grow up to 1MB. This effectively gives us a memory
size between 32MB and 8GB -- i.e. enough to load a DVD image if one
wants to.

The loader assigns physical memory based on the EFI memory map and
makes sure that all physical memory is naturally aligned and a power
of 2. At this time there's no consideration for allocating physical
memory that is close to the BSP.

The kernel is informed about the physical address of the page table
and its size and can locate all PBVM pages through it.

The loader does not wire the PBVM page table yet. Instead it wires
all of the PBVM with a single translation. This is fine for now,
but a follow-up commit will fix it. We cannot handle more than 32MB
right now.

Note that the loader will map as much of the loaded kernel and
modules as possible, but it's up to the kernel to handle page faults
for references that aren't mapped. To make that easier, the page
table is mapped at a fixed virtual address.
2011-03-11 22:14:02 +00:00
Marcel Moolenaar
974ed2e88a Bump the heap size to 2MB. We typically have the memory for it, so there's
no point in being stingy.
2011-03-11 21:52:47 +00:00
John Baldwin
0d1f2bf58f Remove all object files during 'make clean'.
PR:		kern/154888
Submitted by:	arundel
MFC after:	1 week
2011-03-11 13:11:15 +00:00
Roman Divacky
300fe58441 Some more shrinking.
o    bunch of variables are turned into uint8_t

   o    initial setting of namep[] in lookup() is removed
        as it's only overwritten a few lines down

   o    kname is explicitly initialized in main() as BSS
        in boot2 is not zeroed

   o    the setting and reading of "fmt" in load() is removed

   o    buf in printf() is made static to save space

Reviewed by:    jhb
Tested by:      me and Fabian Keil <freebsd-listen fabiankeil de>
2011-03-10 16:40:13 +00:00
Yoshihiro Takahashi
2fe4ce3bd8 MFi386: revision 219186
This patch shrinks boot2 a little.

  o    It switches kname to be just a pointer instead of an array.
  o    It changes ioctl to unsigned from uint8_t.
  o    It changes the second keyhit limit to 3 seconds from 5.
  o    It removes bi_basemem/bi_extmem/bi_memsizes_valid setting.
2011-03-03 11:45:54 +00:00
Roman Divacky
66f01f2e79 This patch shrinks boot2 a little.
o    It switches kname to be just a pointer instead of an array
     thus avoiding a couple of memcpy()s.

o    It changes ioctl to unsigned from uint8_t.

o    It changes the second keyhit limit to 3 seconds from 5
     so that constant propagation can take place.

o    It changes the ticks overflow computation as suggested by bde@.

o    It removes bi_basemem/bi_extmem/bi_memsizes_valid setting from
     bootinfo as it is unused.

Reviewed by: jhb
2011-03-02 18:53:12 +00:00
Rebecca Cran
ac095af538 Remove duplicate "in".
Suggested by:	Rob Farmer <rfarmer at predatorlabs.net>
MFC after:	3 days
2011-03-01 11:47:51 +00:00
Rebecca Cran
b633aa9451 Revert some of r177626. "in in" is valid in certain sentences.
PR:		121490
MFC after:	3 days
2011-02-28 10:03:48 +00:00
Pawel Jakub Dawidek
10b9d77bf1 Finally... Import the latest open-source ZFS version - (SPA) 28.
Few new things available from now on:

- Data deduplication.
- Triple parity RAIDZ (RAIDZ3).
- zfs diff.
- zpool split.
- Snapshot holds.
- zpool import -F. Allows to rewind corrupted pool to earlier
  transaction group.
- Possibility to import pool in read-only mode.

MFC after:	1 month
2011-02-27 19:41:40 +00:00
Pawel Jakub Dawidek
b3f3e1cb6a Rename bcpy() macro to bcopy(). 2011-02-27 12:25:47 +00:00
Dimitry Andric
b1b28f51de Clang's integrated assembler can now handle sys/boot/i386/boot2/sio.S.
It used to choke on the notation "inb (%dx),%al" for "inb %dx,%al"; GNU
as accepts both forms.  Which notation is more 'correct' is an open
question. :)
2011-02-27 02:06:09 +00:00
Rebecca Cran
ce52330412 Handle memory allocation failures in include().
PR:		i386/85652
Submitted by:	Ben Thomas <bthomas at virtualiron.com>
MFC after:	3 days
2011-02-23 17:17:05 +00:00
Yoshihiro Takahashi
fb260f4f74 MFi386: revision 218926
In sys/boot/i386/boot2/boot2.c, change the type of the 'opts' variable
  from uint16_t back to uint32_t.  The actual option bitmasks (RB_* and
  RBX_*) assume at least a 32 bit variable.

  Submitted by:	rdivacky
2011-02-22 13:52:03 +00:00
Dimitry Andric
199ba798b3 In sys/boot/i386/boot2/boot2.c, change the type of the 'opts' variable
from uint16_t back to uint32_t.  The actual option bitmasks (RB_* and
RBX_*) assume at least a 32 bit variable.

Submitted by:	rdivacky
2011-02-21 19:46:02 +00:00
Rebecca Cran
6bccea7c2b Fix typos - remove duplicate "the".
PR:	bin/154928
Submitted by:	Eitan Adler <lists at eitanadler.com>
MFC after: 	3 days
2011-02-21 09:01:34 +00:00
Dimitry Andric
2754fe609d Upgrade our copy of llvm/clang to r126079, from upstream's trunk.
This contains many improvements, primarily better C++ support, an
integrated assembler for x86 and support for -pg.
2011-02-20 19:33:47 +00:00
Marcel Moolenaar
24fa8d5f76 Merge svn+ssh://svn.freebsd.org/base/head@218875 2011-02-20 03:35:59 +00:00
Yoshihiro Takahashi
709f6be098 MFi386: revision 218745
Remove reading of symbols from a.out loaded files.
2011-02-19 10:32:12 +00:00
Marcel Moolenaar
9b4fcf851a Merge svn+ssh://svn.freebsd.org/base/head@218816 2011-02-18 21:39:09 +00:00
Dimitry Andric
ce8fb93178 Merge binutils 2.17.50 to head. This brings a number of improvements to
x86 CPU support, better support for powerpc64, some new directives, and
many other things.  Bump __FreeBSD_version, and add a note to UPDATING.

Thanks to the many people that have helped to test this.

Obtained from:	projects/binutils-2.17
2011-02-18 20:54:12 +00:00
Daniel Gerzo
8d2cbd0a1a - add missing if_ devices which were missing and are available as loadable
modules too

Reviewed by:	brucec
2011-02-18 17:43:22 +00:00
Warner Losh
33c45e47f4 Remove reading of symbols from a.out loaded files. Since we are tight
on space for clang and a.out support is only needed for /boot/loader,
they are excess bytes that serve no useful purpose other than to
support really old kernels (FreeBSD < 3.2 or so).  Prefer clang
support over support for these old kernels and remove this code.  We
gain about 100 bytes of space this way.

Reviewed by:	rdivacky@
2011-02-16 18:05:10 +00:00
Yoshihiro Takahashi
894cbf138e MFi386: revision 218713
Apply a few small optimizations to boot2's code, to make it shrink a
  little further.
2011-02-16 15:20:37 +00:00
Dimitry Andric
80b9f8b017 In sys/boot/common/ufsread.c, use uint8_t instead of u_int8_t.
Submitted by:	mdf
2011-02-15 21:01:13 +00:00
Dimitry Andric
97bba30626 Apply a few small optimizations to boot2's code, to make it shrink a
little further.  This gets us further on the way to be able to build it
successfully with clang.  Using in-tree gcc, this shrinks boot2.bin with
60 bytes, the in-tree clang shaves off 72 bytes, and ToT clang 84 bytes.

Submitted by:	rdivacky
Reviewed by:	imp
2011-02-15 20:18:52 +00:00
Yoshihiro Takahashi
ea71add53e Fix build. 2011-02-12 06:22:23 +00:00
Yoshihiro Takahashi
1033bb5394 Add the pc98boot image which concatenates boot0 and boot0.5.
It's required by the gpart to write bootcode.
2011-02-11 13:14:17 +00:00
Marcel Moolenaar
03a6d9a1bf Add PEX0 and select the first serial port as console. 2011-02-04 01:09:02 +00:00
Sergey Kandaurov
03139a7106 Add kern.msgbufsize default setting to /boot/defaults/loader.conf.
Suggested by:	Alex Kozlov <spam rm-rf.kiev.ua> (via private mail)
Approved by:	kib (mentor)
2011-01-21 12:15:21 +00:00
Sergey Kandaurov
4053b05b91 Make MSGBUF_SIZE kernel option a loader tunable kern.msgbufsize.
Submitted by:	perryh pluto.rain.com (previous version)
Reviewed by:	jhb
Approved by:	kib (mentor)
Tested by:	universe
2011-01-21 10:26:26 +00:00