aboutsummaryrefslogtreecommitdiffstats
path: root/src/misc.c
Commit message (Collapse)AuthorAgeFilesLines
* add serial console supportGerd Hoffmann2017-09-221-8/+0
| | | | | | | | | Redirect int10 calls to serial console output. Parse serial input and queue key events. The serial console can work both as primary display and in parallel to another vga display (splitmode). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Fix typos found by codespellStefan Weil2015-10-091-1/+1
| | | | | Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Get fixed address variables from 32bit compile pass (not 16bit)Kevin O'Connor2014-06-111-9/+9
| | | | | | | | | Update the layoutrom.py build script so that fixed address sections can come from the 32bit compiled C code. Update the C code so that all VAR16FIXED variables instead use the new VARFSEGFIXED which is defined in 32bit mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move most of the VAR16FIXED() defs to misc.c.Kevin O'Connor2014-06-041-0/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Remove old Bochs bios fixed address string at 0xfff00.Kevin O'Connor2014-06-041-3/+0
| | | | | | | There is no indication that the address 0xff00 is a BIOS standard, so don't emit the old Bochs copyright string at that fixed address. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* If an int 1587 call is made from an option rom, stay in bigreal mode.Kevin O'Connor2014-05-061-0/+9
| | | | | | | | | | | Modify the int 1587 handler to check if the POST phase is still running. If it is, use bigreal mode segment limits so that the caller remains in bigreal mode when the 1587 handler completes. This helps with SeaVGABIOS' use of "direct" framebuffer accesses (an option rom may attempt to display text during its option rom execution which can cause SeaVGABIOS to make the int 1587 calls). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Remove ioport.h; disperse its contents to other header files.Kevin O'Connor2013-09-281-0/+2
| | | | | | | Move the inb(), insb(), etc. code from ioport.h to x86.h. Move the PORT_* definitions to their appropriate hardware files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move function definitions for output.c from util.h to new file output.h.Kevin O'Connor2013-09-181-2/+2
| | | | | | Also, sort the order of include files in the c files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move stacks.c definitions from util.h to new file stacks.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Rename util.c to string.c and introduce string.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move code centered around specific hardware devices to src/hw/Kevin O'Connor2013-09-021-1/+1
| | | | | | Move many C files from the src/ directory to the new src/hw/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* PIC code cleanups.Kevin O'Connor2013-07-141-1/+1
| | | | | | | | | | | | Preface PIC functions with a pic_ to provide a more consistent naming. Convert the irqmask code to a more consistent pic_irqmask_read/write/mask form. Move code from pic.h to pic.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Use CONFIG_ prefix for Kconfig variables; use BUILD_ for others.Kevin O'Connor2013-02-201-4/+4
| | | | | | | Rename remaining "build" settings in config.h that used the CONFIG_ prefix to use a BUILD_ prefix. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Calculate "RamSize" needed by 16bit interface dynamically.Kevin O'Connor2013-02-191-5/+0
| | | | | | | | | | Calculate a LegacyRamSize directly from the e820 map for use by handle_1588() and handle_15e801() (the only two external interfaces that require "RamSize"). All other users of the existing RamSize (and RamSizeOver4G) variables are specific to QEMU, so move the declarations to paravirt.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Convert VAR16VISIBLE, VAR16EXPORT, and VAR32VISIBLE to VARFSEG.Kevin O'Connor2013-02-181-12/+8
| | | | | | | | | | | Convert all users of the alternative variable exports to VARFSEG. There isn't a significant distinction between the existing types of exports, so it's simpler to just use one type going forward. The new VARFSEG declaration is only emitting when in 32bit mode, so update and move some variables as needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* The mathcp setup touches the PIC and thus move to the "setup" phase.Kevin O'Connor2013-02-121-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Add runningOnQEMU() and runningOnXen() for runtime platform detection.Kevin O'Connor2013-02-101-0/+2
| | | | | | | Introduce standard for performing and inspecting the run-time detection of para-virtualized environments. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Normalize POST initialization function name suffixes.Kevin O'Connor2013-02-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The POST phase has to invoke many initialization functions, and these functions can have complex inter-dependencies. Try to categorize the functions into 4 classes: preinit - functions called very early in POST where function ordering is very important and the code has limited access to other interfaces. init - functions that initialize internal interfaces and standard external interfaces. This code is generally not dependent on particular hardware and typically does not communicate directly with any hardware devices. setup - functions which access hardware or are dependent on particular hardware or platform devices. prepboot - functions that finalize internal interfaces and that prepare for the boot phase. This patch attempts to normalize the suffixes - functions that used _init(), _setup(), _finalize(), or similar that did not follow the above pattern were renamed. Other than function name changes, there should be no code impact to this patch. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Minor - remove CLEARBITS_BDA and SETBITS_BDA macros.Kevin O'Connor2012-06-101-1/+1
| | | | | | | Remove these infrequently used macros and replace with explicit GET_BDA/SET_BDA calls. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Fix winxp boot regression introduced in ecdc655a.Kevin O'Connor2012-06-021-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | The winxp boot loader does something curious - it sets an int 0x1c handler, records the stack location, and then spins in place with irqs enabled. The 0x1c handler alters the memory just past the stack pointer so that when the timer irq returns the code jumps to a new location and stop spinning. The winxp code relies on the fact that a hw irq will always place 6 bytes at a specific location and that it can alter those bytes. The ecdc655a patch does a full backup/restore of the register state. Unfortunately, the restore overwrites the changes made by the winxp 0x1c handler. This patch reverts much of ecdc655a. Hardware irqs are still handled on the extra stack, but only the essential register state is backed up and restored. Also, stack_hop_back is changed to only use %sp when changing states - this enables the entry code to store just %esp instead of both %esp and %sp. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Run all hardware irq handlers on the extra stack.Kevin O'Connor2012-05-301-6/+8
| | | | | | | | | | | | | | | | | | | | Jump into the extra stack for all hardware irq handlers. This reduces the overall stack requirements of SeaBIOS. Replace all users of call16_simpint with call16_int. Only the hardware irq handlers used the old call, and they need to use the new call to ensure the extra stack is properly re-entrant. Also, pass in a 'struct bregs' to the hardware irq handlers now. It was not done previously to save stack space. Now that the extra stack is used, that is no longer an issue. Note that should an old OS invoke a hardware irq in 16bit protected mode, then this patch could break that OS. However, the chances of this causing a regression seem small as several existing hardware irq handlers already do not work in 16bit protected mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Add FUNC16() helper macro for converting a 16bit func to a segoff_s.Kevin O'Connor2010-07-281-1/+1
|
* Minor - introduce GDT_GRANLIMIT macro.Kevin O'Connor2010-07-251-4/+4
| | | | Add macro to improve readability of GDT limit definitions.
* Avoid code addresses >64K in big real mode.Kevin O'Connor2010-07-251-2/+2
| | | | | Kvm has some limitations with code addresses in big real mode, so avoid doing that.
* Add int1589 support.Kevin O'Connor2010-01-041-1/+1
| | | | | Int1589 switches into protected mode for the caller. Also, consistently use BUILD_BIOS_ADDR/SIZE in GDT macros.
* Be sure to add "void" to all function prototypes that take no args.Kevin O'Connor2010-01-031-3/+3
| | | | Omitting "void" leads to a K&R style declaration which was not intended.
* Enhance experimental option rom "threading" - enable preemption.Kevin O'Connor2009-12-131-5/+0
| | | | | | | | | | | | | When experimental support for parallelizing option roms and hardware init (default disabled) is selected, add support for checking on hardware init progress from the RTC irq handler. Enable ability for RTC to be turned on for additional users. Allow regular option roms (not just vga option roms) to run in parallel with hardware init. Don't use stack in transition32 / transition16 until new mode is entered. Also, cleanup leaking of data handlers in usb code. Also, decrease frequency of iomemcpy checks (every 2K instead of 1K).
* Rename VAR16_32 to VAR16VISIBLE.Kevin O'Connor2009-09-091-7/+7
| | | | | Sometimes VAR16_32 is used to export a definition to assembler, so clarify its naming.
* Add helper macros for defining GDT descriptors.Kevin O'Connor2009-08-101-6/+6
|
* Add Post Memory Manager (PMM) support.Kevin O'Connor2009-08-011-1/+1
| | | | | | | | | | | | Complete the initial implementation of PMM. Default new PMM code to be enabled. Move malloc code from memmap.c to pmm.c. Define new malloc zones for PMM (ZoneTmpLow and ZoneTmpHigh). Change default READ/WRITE_SEG macros to use 32bit pointers (the 16bit PMM code use "big real" mode and requires 32bit accesses). Allow pmm allocations to occur during bcv executions also. Add low-memory clearing before boot. Also, align the default f-seg memory.
* Add malloc_high/fseg() and rework bios table creation to use them.Kevin O'Connor2009-07-251-2/+1
| | | | | | | | Add malloc like functions for memory management instead of open-coding memory reservation in all callers. Add ability for unused high ram to be returned for general purpose use. Break up acpi table creation into multiple functions. Also, move smbios tables into high ram (instead of f-segment).
* Register int02 handler (nmi); disable NMI by default.Kevin O'Connor2009-03-071-3/+3
| | | | | | | Rename handle_nmi to handle_02 to be more consistent with other handlers. Actually register handle_02. Don't panic in nmi handler - just log by default. Set the disable nmi bit when accessing the cmos index register.
* Minor - rename BX_PANIC to panic.Kevin O'Connor2009-02-081-1/+1
|
* Rename MAKE_FARPTR (and similar) to MAKE_FLATPTR.Kevin O'Connor2009-01-191-3/+3
| | | | | | | | The term "far pointer" is used in many 16bit specs, and it is different from what MAKE_FARPTR creates. So, use the term "flat pointer" in the code to distinguish between the two meanings. Also, use the suffix "_fl" consistently when working with "flat pointers".
* Reserve space for buffers in f-segment; don't allocate from freespace.Kevin O'Connor2009-01-171-0/+3
| | | | | | | Define the e820list as a regular array. Define a buffer for run-time built bios tables. Reserving the space in advance should help prevent run-time errors when space becomes tight.
* Move variables from assembler to C code.Kevin O'Connor2009-01-171-0/+193
Define macro VAR16FIXED for declaring a variable at a fixed location. Introduce new file src/misc.c, and move non int15 calls from system.c to it. Implement all fixed location variables in C code. Move IDT/GDT defs to misc.c. Remove unused gdt entry 1.