summaryrefslogtreecommitdiffstats
path: root/pc-bios/optionrom
Commit message (Collapse)AuthorAgeFilesLines
* linuxboot: fix loading old kernelsPaolo Bonzini2014-12-151-10/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | Old kernels that used high memory only allowed the initrd to be in the first 896MB of memory. If you load the initrd above, they complain that "initrd extends beyond end of memory". In order to fix this, while not breaking machines with small amounts of memory fixed by cdebec5 (linuxboot: compute initrd loading address, 2014-10-06), we need to distinguish two cases. If pc.c placed the initrd at end of memory, use the new algorithm based on the e801 memory map. If instead pc.c placed the initrd at the maximum address specified by the bzImage, leave it there. The only interesting part is that the low-memory info block is now loaded very early, in real mode, and thus the 32-bit address has to be converted into a real mode segment. The initrd address is also patched in the info block before entering real mode, it is simpler that way. This fixes booting the RHEL4.8 32-bit installation image with 1GB of RAM. Cc: qemu-stable@nongnu.org Cc: mst@redhat.com Cc: jsnow@redhat.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* linuxboot: compute initrd loading addressPaolo Bonzini2014-10-092-7/+61
| | | | | | | | | | | | | | | | | | | | | | | | Even though hw/i386/pc.c tries to compute a valid loading address for the initrd, close to the top of RAM, this does not take into account other data that is malloced into that memory by SeaBIOS. Luckily we can easily look at the memory map to find out how much memory is used up there. This patch places the initrd in the first four gigabytes, below the first hole (as returned by INT 15h, AX=e801h). Without this patch: [ 0.000000] init_memory_mapping: [mem 0x07000000-0x07fdffff] [ 0.000000] RAMDISK: [mem 0x0710a000-0x07fd7fff] With this patch: [ 0.000000] init_memory_mapping: [mem 0x07000000-0x07fdffff] [ 0.000000] RAMDISK: [mem 0x07112000-0x07fdffff] So linuxboot is able to use the 64k that were added as padding for QEMU <= 2.1. Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* Fix QEMU build on OpenBSD on x86 archsBrad2014-02-171-1/+2
| | | | | | | | | | | | | | | | | This resolves the build issue with building the ROMs on OpenBSD on x86 archs. As of OpenBSD 5.3 the compiler builds PIE binaries by default and thus the whole OS/packages and so forth. The ROMs need to have PIE disabled. Check in configure whether the compiler supports the flags for disabling PIE, and if it does then use them for building the ROMs. This fixes the following buildbot failure: >From the OpenBSD buildbots.. Building optionrom/multiboot.img ld: multiboot.o: relocation R_X86_64_16 can not be used when making a shared object; recompile with -fPIC Signed-off by: Brad Smith <brad@comstyle.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* multiboot: Calculate upper_mem in the ROMKevin Wolf2013-06-281-0/+40
| | | | | | | | | | | | | | | | | | The upper_mem field of the Multiboot information struct doesn't really contain the RAM size - 1 MB like we used to calculate it, but only the memory from 1 MB up to the first (upper) memory hole. In order to correctly retrieve this information, the multiboot ROM now looks at the mmap it creates anyway and tries to find the size of contiguous usable memory from 1 MB. Drop the multiboot.c definition of lower_mem and upper_mem because both are queried at runtime now. Signed-off-by: Kevin Wolf <mail@kevin-wolf.de> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1372018066-21822-3-git-send-email-mail@kevin-wolf.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* multiboot: Don't forget last mmap entryKevin Wolf2013-06-281-18/+17
| | | | | | | | | | | | | | | | | When the BIOS returns ebx = 0, the current entry is still valid and needs to be included in the Multiboot memory map. Fixing this meant that using bx as the entry index doesn't work any more because it's 0 on the last entry (and it was SeaBIOS-specific anyway), so the whole loop had to change a bit and should be more generic as a result (ebx can be an arbitrary continuation number now, and the entry size returned by the BIOS is used instead of hard-coding 20 bytes). Signed-off-by: Kevin Wolf <mail@kevin-wolf.de> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1372018066-21822-2-git-send-email-mail@kevin-wolf.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* hw: move headers to include/Paolo Bonzini2013-04-081-1/+1
| | | | | | | | | Many of these should be cleaned up with proper qdev-/QOM-ification. Right now there are many catch-all headers in include/hw/ARCH depending on cpu.h, and this makes it necessary to compile these files per-target. However, fixing this does not belong in these patches. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* multiboot: fix e801 memory mapPaolo Bonzini2012-11-301-0/+7
| | | | | | | | | | | | The e801 memory sizes in the multiboot structures hard-code the available low memory to 640. However, the value should not include the size of the EBDA. Fill the value in the option ROM, getting the size of low memory from the BIOS. Cc: Alexander Graf <agraf@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* signrom: Rewrite as python scriptJan Kiszka2012-04-161-1/+1
| | | | | | | | Now that we have a hard dependency on python anyway, we can replace the slow shell script to calculate the option ROM checksum with a fast AND portable python version. Tested both with python 2.7 and 3.1. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
* kvmvapic: Use optionrom helpersJan Kiszka2012-02-181-10/+8
| | | | | | | | Use OPTION_ROM_START/END from the common header file, add comment to init code. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* optionsrom: Reserve space for checksumJan Kiszka2012-02-181-1/+2
| | | | | | | | Always add a byte before the final 512-bytes alignment to reserve the space for the ROM checksum. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* kvmvapic: Simplify mp/up_set_tprJan Kiszka2012-02-181-5/+1
| | | | | | | | The CH registers is only written, never read. So we can remove these operations and, in case of up_set_tpr, also the ECX push/pop. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* kvmvapic: Add option ROMJan Kiszka2012-02-182-1/+342
| | | | | | | | | This imports and builds the original VAPIC option ROM of qemu-kvm. Its interaction with QEMU is described in the commit that introduces the corresponding device model. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* optionroms: Silence intermediate file removalJan Kiszka2012-02-011-0/+3
| | | | | | | | | The build process of optionroms spits out an "rm ..." line. Moreover, it removes all .o files that can be handy for debugging purposes. So disable automatic intermediate removal. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix spelling in comments, documentation and messagesStefan Weil2011-12-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | accidently->accidentally annother->another choosen->chosen consideres->considers decriptor->descriptor developement->development paramter->parameter preceed->precede preceeding->preceding priviledge->privilege propogation->propagation substraction->subtraction throught->through upto->up to usefull->useful Fix also grammar in posix-aio-compat.c Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* fix linuxboot.bin and multiboot.bin to not hijack int19Gleb Natapov2011-03-223-15/+29
| | | | | | | | | | | Currently linuxboot.bin and multiboot.bin option roms override int19 vector to intercept boot process. No sane option rom should do that. Provide bev entry instead that will be called by BIOS if option rom is selected for booting. Signed-off-by: Gleb Natapov <gleb@redhat.com> Acked-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Add scripts directoryBlue Swirl2011-01-202-46/+1
| | | | | | Move build and user scripts into scripts directory. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* optionrom: fix bugs in signrom.shAvi Kivity2010-11-211-4/+3
| | | | | | | | | | | | | | | | signrom.sh has multiple bugs: - the last byte is considered when calculating the existing checksum, but not when computing the correction - apprently the 'expr' expression overflows and produces incorrect results with larger roms - if the checksum happened to be zero, we calculated the correction byte to be 256 Instead of rewriting this in half a line of python, this patch fixes the bugs. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix multiboot compilationAlexander Graf2010-06-092-12/+28
| | | | | | | | | | | | | | | | | | | | | | Commit dd4239d6574ca41c94fc0d0f77ddc728510ffc57 broke multiboot. It replaced the instruction "rep insb (%dx), %es:(%edi)" by the binary output of "addr32 rep insb (%dx), %es:(%di)". Linuxboot calls the respective helper function in a code16 section. So the original instruction was automatically translated to its "addr32" equivalent. For multiboot, we're running in code32 so gcc didn't add the "addr32" which breaks the instruction. This patch splits that helper function in one which uses addr32 and one which does not, so everyone's happy. The good news is that nobody probably cared so far. The bundled multiboot.bin binary was built before the change and is thus correct. Please also put this patch into -stable. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* linuxboot: fix gdt address calculationAvi Kivity2010-01-081-2/+3
| | | | | | | | | | | | The gdt address calculation in linuxboot.bin is broken in two ways: first it loads %cs into %eax, but that instruction leaves the high bits of %eax undefined and we did not clear them. Secondly, we completely ignore the incorrect %eax, and use the undefined %ebx instead. With these issues fixed, linuxboot works again. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Use vpath directivePaolo Bonzini2010-01-081-1/+2
| | | | | | | | | | | | | The vpath directive has two advantages over the VPATH variable: 1) it allows to skip searching of .o files; 2) the default semantics are to append to the vpath, so there is no confusion between "VPATH=xyz" and "VPATH+=xyz". Since "vpath %.c %.h PATH" is not valid, I'm introducing a wrapper macro to append one or more directories to the vpath. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix thinko in linuxboot.SPaolo Bonzini2009-12-181-12/+8
| | | | | | | | The %gs segment that was used was not matching the comments. I just moved the GDT descriptor on the stack instead. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* multiboot: Fix module loading and setting of mmap.Adam Lackorzynski2009-12-031-1/+4
| | | | | | Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de> Acked-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Make -kernel for linux work with bochsbiosAlexander Graf2009-12-031-5/+5
| | | | | | | | | | | | | | While trying to run -kernel with -bios pc-bios/pcbios.bin, I realized that I was actually writing data to %es, but only set up %ds to a 32-bit segment we want to write to. So at the end of the day the data hasn't actually been copied. Oops. So here's a fix to set ES instead of DS, which makes -kernel work with BOCHS bios again (and actually makes the code do the correct thing)! Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Allow build of linuxboot.S with old assemblersJuergen Lock2009-11-211-1/+4
| | | | | | | | | In the spirit of ff56954baf9cfab5cbbe18d10b4a09e4a17f39a8, fix the build of linuxboot.S with old as(1) (as found in some BSD base systems) by emitting the bytes of the insn it doesn't like instead. Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Convert linux bootrom to external rom and fw_cfgAlexander Graf2009-11-172-1/+141
| | | | | | | | | | | | | | We already have a working multiboot implementation that uses fw_cfg to get its kernel module etc. data in int19 runtime now. So what's missing is a working linux boot option rom. While at it I figured it would be a good idea to take the opcode generator out of pc.c and instead use a proper option rom, like we do with multiboot. So here it is - an fw_cfg using option rom for -kernel with linux! Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Move common option rom code to header fileAlexander Graf2009-11-172-76/+110
| | | | | | | | | | We will have a linux boot option rom soon, so let's take all functionality that might be useful for both to a header file that both roms can include. That way we only have to write fw_cfg access code once. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Convert multiboot to fw_cfg backed data storageAlexander Graf2009-11-171-17/+60
| | | | | | | | | | | | | | Right now we load the guest kernel to RAM, fire off the BIOS, hope it doesn't clobber memory and run an option rom that jumps into the kernel. That breaks with SeaBIOS, as that clears memory. So let's read all kernel, module etc. data using the fw_cfg interface when in the int19 handler. This patch implements said mechanism for multiboot. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* multiboot.S patch for old as(1) (was: Re: [Qemu-devel] Some OpenBSD/amd64 ↵Juergen Lock2009-10-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | build fixes) On Wed, Sep 23, 2009 at 10:55:02PM +0200, Juergen Lock wrote: > On Wed, Sep 23, 2009 at 09:31:16PM +0100, Laurence Tratt wrote: >[...] > > then the above error doesn't occur, but > > pc-bios/optionrom/multiboot.S dies as follows: > > > > $ > > AS optionrom/multiboot.o > > multiboot.S: Assembler messages: > > multiboot.S:116: Error: `%es:-4(%edi)' is not a valid 16 bit base/index > > expression > > $ > > > > What little Intel assembler I ever knew has long since departed from my > > brain, so I don't know why that error occurs, nor what a fix might be. > > > It occurs because of too old binutils (as(1) in this case), on FreeBSD > we now have a port for newer ones, > http://www.freshports.org/devel/binutils > so I depend on that and have the optionrom Makefile use the new as > like this: (the first change wrt CFLAGS is unrelated and has probably > been fixed in the meantime; it caused gmake to complain about > recursive use of CFLAGS.) > > Index: qemu/pc-bios/optionrom/Makefile > @@ -9,10 +9,13 @@ > > CFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin > CFLAGS += -I$(SRC_PATH) > -CFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector,"") > +CFLAGS := $(CFLAGS) $(call cc-option, $(CFLAGS), -fno-stack-protector,"") > > build-all: multiboot.bin > > +%.o: %.S > + $(CC) -E $(CFLAGS) -o - -c $< |${LOCALBASE}/bin/as -V -Qy -o $@ > + > %.img: %.o > $(call quiet-command,$(LD) -Ttext 0 -e _start -s -o $@ $<," Building $(TARGET_DIR)$@") > That patch didn't seem to help on OpenBSD so I now finally got around making another one that just emits the bytes of the offending insn instead so people can keep using old assemblers: Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* optionrom: create .PHONY variableJuan Quintela2009-10-061-0/+1
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* optionrom: remove use of implicit RM variableJuan Quintela2009-10-061-1/+1
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* restore CFLAGS check for conflict and fix recursive CFLAGS issueThomas Monjalon2009-10-051-2/+2
| | | | | | | | | | | cc-option uses more make-syntax to replace the shell "if/else". Issue with recursive += is fixed by doing the first assignment simply-expanded, as explained in http://www.gnu.org/software/make/manual/html_node/Appending.html Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* optionrom: make clean should remove raw and .dJuan Quintela2009-09-091-1/+1
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* otionrom: Use local CFLAGS no global oneJuan Quintela2009-09-091-0/+1
| | | | | | | It is needed by %.o : %.c rule. Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Remove CFLAGS parameter in cc-optionJuan Quintela2009-09-091-1/+1
| | | | | | | With cc-option we are testing if gcc just accept a particular option, we don't need CFLAGS at all. And this fixes the recursive problem with CFLAGS Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Rename CPPFLAGS to QEMU_CFLAGSJuan Quintela2009-08-101-3/+3
| | | | | | | | | | | | | | | | | Now we have to variables: QEMU_CFLAGS: flags without which we can't compile CFLAGS: "-g -O2" We can now run: make CFLAGS="-fbar" foo.o make CFLAGS="" foo.o make CFLAGS="-O3" foo.o And it all should work. Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
* Fix checksum writing in signboot.shAlexander Graf2009-08-101-1/+2
| | | | | | | | | | | | | | | | | | The printf command takes an octal value after \, so we have to convert our decimal representation to octal first and then write it. This unbreaks extboot signing. Multiboot wasn't affected yet because the checksum was < 8. Spotted and first patch by Glauber Costa <glommer@redhat.com>. Printf idea by Paolo Bonzini <bonzini@gnu.org>. Signed-off-by: Alexander Graf <agraf@suse.de> CC: Glauber Costa <glommer@redhat.com> CC: Paolo Bonzini <bonzini@gnu.org> CC: Jan Ondrej <ondrejj@salstar.sk> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
* Do not try to invoke shebang scripts directly (NFS issues)malc2009-08-101-1/+1
| | | | Signed-off-by: malc <av1474@comtv.ru>
* Option rom makefile fixesPaul Brook2009-07-311-0/+2
| | | | | | Fix toplevel option rom makefile rules. Signed-off-by: Paul Brook <paul@codesourcery.com>
* Fix out of tree build broken by 791e08c753a9f9be3c3880b4ea83b6dfa4b6ccadBlue Swirl2009-07-271-1/+1
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* use cc-option for optionromJuan Quintela2009-07-271-21/+1
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Use quiet-command for building optionromJuan Quintela2009-07-271-9/+7
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* signrom.sh: portability fixChristoph Egger2009-07-221-2/+3
| | | | | | | | | Attached patch makes signrom.sh working on NetBSD. The output of the 'od' command leads to a syntax error which breaks the build. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Update to a hopefully more future proof FSF addressBlue Swirl2009-07-162-4/+2
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Don't copy multiboot.bin into pc-bios after builtAnthony Liguori2009-07-161-1/+0
| | | | | | That dirties the working directory of the tree. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix multiboot.bin build on mingw32Anthony Liguori2009-07-161-3/+5
| | | | | | This combination of ld/object was suggested by Bartlomiej Celary Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Replace signrom with shell script v3Alexander Graf2009-07-093-85/+48
| | | | | | | | | | | | | In order to not execute code we just compiled, let's replace signrom with a shell script that does the same thing while staying compatible to pretty much every system available. This should make cross-compilation for windows easier. aliguori: fix build when objdir != srcdir Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Work around Solaris gas problemBlue Swirl2009-07-031-1/+1
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Multiboot build system v4Alexander Graf2009-06-292-0/+127
| | | | | | | | | | | | | | | In order to build the multiboot option rom, we need a Makefile and a tool to sign the rom with. Both are provided by this patch and mostly taken from the extboot source, written by Anthony Liguori. Once built, the resulting binary gets copied to pc-bios automatically. Building also occurs automatically when on an x86 host. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Multiboot support v5Alexander Graf2009-06-291-0/+209
This patch implements support for Multiboot on x86 for -kernel. Multiboot is a "new" approach to get rid of different bootloaders, providing a unified interface for the kernel. It supports command line options and kernel modules. The two probably best known projects using multiboot are Xen and GNU Hurd. This implementation should be mostly feature-complete. It is missing VBE extensions, but as no system uses them currently it does not really hurt. To use multiboot, specify the kernel as -kernel option. Modules should be given as -initrd options, seperated by a comma (,). -append also works. Please bear in mind that grub also does gzip decompression, which qemu does not do yet. To run existing images, please ungzip them first. The guest multiboot loader code is implemented as option rom using int 19. Parts of the work are based on efforts by Rene Rebe, who originally ported my code to int 19. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud