summaryrefslogtreecommitdiffstats
path: root/sys/boot/common/load_elf.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r295356 (Partial)smh2016-02-111-1/+1
| | | | | | | Fix EFI platform build failures on arm.armeb Approved by: re (marius) Sponsored by: Multiplay
* MFC r281169, r293724, r293796, r294029, r294041, r294058smh2016-01-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | MFC r281169 (by andrew): Make global variabled only used in this file static MFC r294058: Make common boot file_loadraw name parameter const MFC r294041: Remove unused reg param from fdt_fixup_memory MFC r293724: Enable warnings in EFI boot code MFC r293796: Fix typo in libefi.c MFC r294029: Only build EFI components on supported compilers Sponsored by: Multiplay
* MFC r277215, r277291, r277418, r280953 and r280954:royger2016-01-201-51/+214
| | | | | | | | | loader: implement multiboot support for Xen Dom0 Note that only the subset of the multiboot specification needed in order to boot a Xen Dom0 is implemented. Sponsored by: Citrix Systems R&D
* MFC r277962, r277988, r282661, r282727, r282731, r283013, r283035:ian2015-05-251-36/+50
| | | | | | | | | | | | | | | | | Add support for booting relocatable kernels on PowerPC. Add code to support loading relocatable kernels at offsets that are not zero. Move ubldr text section to the start of the output file, so that when you create a stripped .bin file from it the entry point is the first byte of the file. (Will allow "load $addr $file ; go $addr" in u-boot.) Create a relocatable instance of ubldr for ARM (ubldr.bin). Re-link ubldr when any of its libraries change. An ARM kernel can be loaded at any 2MB boundary, make ubldr aware of that.
* MFC r274407grehan2014-11-241-0/+22
| | | | | | | | | | Fix incorrect reading of 32-bit modinfo by 64-bit loaders. The various structures in the mod_metadata set of a FreeBSD kernel and modules contain pointers. The FreeBSD loader correctly deals with a mismatch in loader and kernel pointer size (e.g. 32-bit i386/ppc loader, loading 64-bit amd64/ppc64 kernels), but wasn't dealing with the inverse case where a 64-bit loader was loading a 32-bit kernel.
* Attach the elf section headers to the loaded kernel as metadata, soian2013-03-101-0/+2
| | | | | | | | | | | they can easily be used by later post-processing. When searching for a compiled-in fdt blob, use the section headers to get the size and location of the .dynsym section to do a symbol search. This fixes a problem where the search could overshoot the symbol table and wander into the string table. Sometimes that was harmless and sometimes it lead to spurious panic messages about an offset bigger than the module size.
* Since ubldr doesn't necessarily load a kernel at the physical address in theian2013-03-091-5/+6
| | | | | | | | | | elf headers, mask out the high nibble of that address. This effectly makes the entry point the offset from the load address, and it gets adjusted for the actual load address before jumping to it. Masking the high nibble makes assumptions about memory layout that are true for all the arm platforms we support right now, but it makes me uneasy. This needs to be revisited.
* Fix a typo that prevented booting a kernel that had virtual addresses inian2013-02-271-1/+1
| | | | the elf headers.
* Adjust the arm kernel entry point address properly regardless of whether theian2013-02-261-6/+17
| | | | | e_entry field holds a physical or a virtual address. Add a comment block that explains the assumptions being made by the adjustment code.
* Fix loading of kernel modules at boot time for powerpc64.andreast2012-09-081-3/+3
| | | | | Reported by: Mathias Breuninger MFC after: 1 week
* Don't return an error if a kld does not contain any modules (e.g. ajhb2012-06-201-1/+1
| | | | | | | kld that only contained a sysctl). The kernel linker allows such modules, so the boot loader should not reject them. MFC after: 2 weeks
* Add a version of the FreeBSD bootloader which can run in userland, packageddfr2011-06-301-1/+1
| | | | | as a shared library. This is intended to be used by BHyVe to load FreeBSD kernels into new virtual machines.
* Add 2 new archsw interfaces:marcel2011-04-031-9/+10
| | | | | | | | | | | | | | 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).
* Give a bit of a hint of the failure (read != expected) but don't makeemaste2010-11-251-1/+1
| | | | | | the error message needlessly more verbose. Discussed with: attilio
* Make this printfoutput more verbose.attilio2010-11-231-1/+2
| | | | | | Sponsored by: Sandvine Incorporated Submitted by: Sandvine Incorporated MFC after: 3 days
* Initial support of loader(8) for ARM machines running U-Boot.raj2008-10-141-1/+10
| | | | | | | | | | This uses the common U-Boot support lib (sys/boot/uboot, already used on FreeBSD/powerpc), and assumes the underlying firmware has the modern API for stand-alone apps enabled in the config (CONFIG_API). Only netbooting is supported at the moment. Obtained from: Marvell, Semihalf
* Add __elfN(relocation_offset). It holds the offset between the virtualmarcel2008-02-231-1/+27
| | | | | | | | | | (link) address and the physical (load) address. Ideally, the mapping between link and load addresses should be abstracted by the copyin(), copyout() and readin() functions, so that we don't have to add kluges in __elfN(loadimage)(). Then, we could also have paged virtual memory for the kernel. This can be important under EFI, where you need to allocate physical memory form the firmware if you want to work in all scenarios.
* Unbreak compile with ELF_VERBOSE defined, and fix format warnings.ru2006-11-021-3/+4
|
* Revert the last change. Masking only 2 MSBs of the virtual addressru2006-11-021-1/+1
| | | | | | | | | | | | | to get the physical address doesn't work for all values of KVA_PAGES, while masking 8 MSBs works for all values of KVA_PAGES that are multiple of 4 for non-PAE and 8 for PAE. (This leaves us limited with 12MB for non-PAE kernels and 14MB for PAE kernels.) To get things right, we'd need to subtract the KERNBASE from the virtual address (but KERNBASE is not easy to figure out from here), or have physical addresses set properly in the ELF headers. Discussed with: jhb
* Because the BTX mini-kernel now uses flat memory mode and clientsru2006-10-291-1/+1
| | | | | | | | | | | | | | | | are no longer limited to a virtual address space of 16 megabytes, only mask high two bits of a virtual address. This allows to load larger kernels (up to 1 gigabyte). Not masking addresses at all was a bad idea on machines with less than >3G of memory -- kernels are linked at 0xc0xxxxxx, and that would attempt to load a kernel at above 3G. By masking only two highest bits we stay within the safe limits while still allowing to boot larger kernels. (This is a safer reimplmentation of sys/boot/i386/boot2/boot.2.c rev. 1.71.) Prodded by: jhb Tested by: nyan (pc98)
* Remove more Alpha bits from the boot code including fixing severaljhb2006-05-121-1/+1
| | | | stale comments.
* Make our ELF64 type definitions match standards. In particular thismarcel2005-12-181-1/+1
| | | | | | | | | | | | | means: o Remove Elf64_Quarter, o Redefine Elf64_Half to be 16-bit, o Redefine Elf64_Word to be 32-bit, o Add Elf64_Xword and Elf64_Sxword for 64-bit entities, o Use Elf_Size in MI code to abstract the difference between Elf32_Word and Elf64_Word. o Add Elf_Ssize as the signed counterpart of Elf_Size. MFC after: 2 weeks
* Separate out the ELF relocation code from the ELF loader, and addiedowse2004-08-281-33/+70
| | | | | | | | | better relocation support for the amd64 and i386 platforms. This should not result in any change in functionality, but moves a step towards supporting the relocatable object file modules on amd64. The same hack/trick as load_elf*.c uses is used here to simultaneously support both elf32 and elf64 on amd64 and i386.
* Add a few helper functions for zeroing kernel space and readingiedowse2004-08-281-37/+11
| | | | from specified file offsets. Make use of these in load_elf.c.
* Fixed a misspelling of 0 as NULL.bde2004-03-111-1/+1
|
* Use __FBSDID().obrien2003-08-251-2/+3
| | | | Also some minor style cleanups.
* Fix lookup of module metadata on amd64 systems. While this is inpeter2003-05-121-5/+25
| | | | | | | | common code, the non-trivial part is #ifdef'ed and only executes when loading amd64 kernels. The rest is trivial but needed for the the amd64 case. (Two variables changed from char ** to Elf_Addr). Approved by: re (amd64 "low-risk" stuff)
* Enable the i386 loader to load and run an amd64 kernel. If this putspeter2003-05-011-53/+64
| | | | | | | | | | | | | | | things over floppy size limits, I can exclude it for release builds or something like that. Most of the changes are to get the load_elf.c file into a seperate elf32_ or elf64_ namespace so that you can have two ELF loaders present at once. Note that for 64 bit kernels, it actually starts up the kernel already in 64 bit mode with paging enabled. This is really easy because we have a known minimum feature set. Of note is that for amd64, we have to pass in the bios int 15 0xe821 memory map because once in long mode, you absolutely cannot make VM86 calls. amd64 does not use 'struct bootinfo' at all. It is a pure loader metadata startup, just like sparc64 and powerpc. Much of the infrastructure to support this was adapted from sparc64.
* Libdisk does not need to include <sys/diskslice.h> any more.phk2003-04-041-1/+0
| | | | | | | | | Move the remaining bits of <sys/diskslice.h> to <i386/include/bootinfo.h> Move i386/pc98 specific bits from <sys/reboot.h> to <i386/include/bootinfo.h> as well. Adjust includes in sys/boot accordingly.
* Fix module dependency (pre)loading on sparc64 by relocating the variablesjake2003-01-211-6/+57
| | | | | | | | read from the raw kld files. Submitted by: Hartmut Brandt <brandt@fokus.gmd.de> PR: 46870 Tested on: alpha (obrien), i386, sparc64
* We don't need bootinfo any more, and sparc64 doesn't have it anyways.obrien2002-05-101-1/+0
|
* Fix another unsigned long used to index the symbol table which should bejake2002-04-091-1/+1
| | | | Elf_Hashelt.
* Use the correct elf hash table entry type. This matches a similar fixpeter2002-04-061-6/+6
| | | | | in the kernel side of things some time ago. The hash table entries are always 32 bits wide, even on 64 bit machines.
* Implement the long-awaited module->file cache database. A userlandpeter2001-09-111-24/+16
| | | | | | | tool (kldxref(8)) keeps a cache of what modules and versions are inside what .ko files. I have tested this on both Alpha and i386. Submitted by: bp
* Get rid of some constness warnings.dwmalone2001-06-241-6/+7
|
* Convert the elf loader to the new linker set layout for elf files.peter2001-06-191-6/+7
| | | | | | This should make dependencies at load time work like before. Oops. Noticed by: markm
* Fix some of the worst formatting bug (seperate commit)peter2001-06-191-2/+4
|
* Cleanup warnings. Most of these are signed/unsigned warnings, as well asjhb2000-08-031-19/+25
| | | | some added const's.
* Remove residual printf.dcs2000-06-071-1/+0
| | | | Prodded by: msmith
* long != int on Alphas.bp2000-05-121-1/+2
|
* Update loader logic to distinguish modules vs. files.bp2000-05-011-83/+255
| | | | | | | Add support for module metadata. The old way of dependancy handling will be supported for a while. Reviewed by: peter
* Fix the loader to handle module dependencies properly. More fixesbp2000-02-251-39/+8
| | | | | | | will be provided after modmetadata appears in the kernel. Reviewed by: msmith Approved by: jkh
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Enable load of i386 ELF kernels with larger KVA range (e.g. starting attegge1999-02-151-2/+2
| | | | 0xe0100000u or 0xc0100000u instead of the usual 0xf0100000u).
* Don't forget a trailing \n when loading a kernel that has been stripped.peter1999-01-041-7/+8
| | | | | (This might make ELF_VERBOSE look funny, but I'm tempted to delete that anyway)
* Load the first page of the file and use the headers in it. This shouldpeter1998-10-171-52/+48
| | | | | avoid the need to seek back to offset zero which is causing trouble on the Alpha with a gzipped kernel.
* "fix" the gzipped kernel load problem by having the loader check that itpeter1998-10-161-22/+33
| | | | | | | can seek back to the first PT_LOAD and doing a close/reopen if it cannot. This is because the first PT_LOAD section includes the ELF headers. This fixes gzipped kernels on the i386, it should solve mike's problem for the Alpha.
* Change some printfs so that ELF_VERBOSE prints meaningful values on the alpha.dfr1998-10-151-3/+3
|
* Tweak the output one more time again. The kernel or module pathnamepeter1998-10-141-2/+3
| | | | is useful, and usually fits all on one line with the load sizes.
* Make the ELF load messages cleaner.peter1998-10-131-8/+17
|
OpenPOWER on IntegriCloud