Age | Commit message (Collapse) | Author | Files | Lines |
|
Instead of always "far calling" to 16bit mode, use a regular call.
When actually needing to "far call", transition to the 16bit C code
that does far calling. This reduces the overhead to the check_irqs
and wait_irq code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Since SeaBIOS has been updated to use "_cfuncx_" prefixes when calling
cross-mode C functions, there is no reason to restrict an exported C
function to only the given mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Add a mechanism (VARLOW declaration) to make a variable reside in the
low memory (e-segment) area. This is useful for runtime variables
that need to be accessed from 16bit code and need to be modifiable
during runtime.
Move the 16bit "extra stack" from the EBDA to the low memory area
using this declaration mechanism. Also increase the size of this
stack from 512 bytes to 2048 bytes.
This also reworks tools/layoutrom.py a bit.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Create a ".code16gcc" directive in src/code16gcc.s and use
-Wa,src/code16gcc.s to tell gcc to compile directly to 16bit code.
This eliminates the need to compile the C code to assembler and
include in romlayout.S and vgaentry.S. This also allows those two
assembler files to be compiled with debugging (-g) enabled.
Also, includes some Makefile cleanups.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Use call32() to jump into handle_pmm(). This reduces the amount of
16bit code needed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Use a more consistent naming that matches entry_xxx to handle_xxx
where possible.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Detect a resume/reboot by inspecting HaveRunPost instead of inspecting
the cmos reset code. Inspecting a global variable is both simpler and
safer.
Move the reboot logic from post.c to resume.c - this makes the code in
post.c simpler as it is now only called once on machine startup. This
also makes it easier to ensure all POST initialization code resides in
the relocatable "init" sections.
Also, rename _start() to handle_post() so that it is more in keeping
with the entry_xxx() and handle_xxx() function naming.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
Don't require the build directory to be the "out/" directory of the
SeaBIOS source.
|
|
|
|
The compiler can get confused when referencing a C function in a
different mode. (It reasonably assumes that the C function in the
current mode is desired.) To avoid this compiler confusion, introduce
symbol prefixes (_cfunc16_, _cfunc32flat_, _cfunc32seg_) that must be
used on C function symbols that are referenced from other compilation
modes.
This makes it less likely compiler confusion will occur. It will also
makes it easier to implement and use vtable like operation structures.
|
|
It's difficult to have a uniform view of the stack when transition
modes, so pass the return address in a register. As a result, the
transition functions only access memory via the %cs selector now.
|
|
Kvm has some limitations with code addresses in big real mode, so
avoid doing that.
|
|
Add APM code to 32bit segmented code.
Use 32bit APM code instead of jumping into 16bit mode.
|
|
Create a new code blob (code32seg) with support for 32bit functions
that need to utilize explicit segment accesses.
This code blob uses global variables relative to %gs and with a
dynamic code offset (determined by get_global_offset()).
Add BIOS32 structure and code.
Add code for 32bit PCI BIOS code.
|
|
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).
|
|
Add a transition16 call that just jumps into 16bit mode.
__call16_from32 (and call16big) just uses transition16 and __call16.
|
|
Introduce 'struct segoff_s' to more places.
|
|
Add initial code for Post Memory Manager - it's just the stubs for now.
Also, fix PnP entry point not clearing irqs and direction flags.
|
|
Implement -ffunction-sections and -fdata-sections in both 32bit and
16bit code.
Make sure all sections have unique names (even asm and discarded
sections).
Enhance tools/layoutrom.py script to find all sections reachable from
exported 16bit code - prune all other sections.
Mark sections with "export" if they can be visible outside of code -
these sections wont be dropped when pruning unused sections.
|
|
|
|
Use linking magic to eliminate the need for the _code32_ prefix.
|
|
|
|
Save/restore %ebp on irq entry.
Support saving and restoring %ebp on call16.
Enable display of %ebp in register dumps.
|
|
The irq entry points now push the handler address and jump to a
function that does parameter setup. This reduces the code size
because the entry setup isn't repeated for every handler.
|
|
This allows the entry macros to be used in other assembler code.
|
|
Almost nothing really wants A20 off today - so add a config option
(and default it off) to control turning A20 off during 16bit
bootup.
|
|
|
|
This moves the irq clear into transition32.
Also, disable nmi before loading gdt - this prevents a race with an nmi.
|
|
|
|
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.
|
|
Always disable irqs at start of each entry point.
Be consistent with clearing direction flag after disabling interrupts.
|
|
The Ubuntu gcc compiler apparently miscompiles code when %ebp is in an
assembler clobber list.
Also, don't clobber %eax in transition32 - a minor cleanup.
|
|
The only caller is now in the 0xf0000 segment - so no need for it.
|
|
|
|
Should be slightly more compatible with protected mode accesses.
|
|
Setting %ss/%esp in sequence is guaranteed to be atomic. So, always
set them in this order to ensure irqs and nmis see a consistent
stack.
|
|
The rom layouts can be dynamic, so don't try to "fall through" to the
next function.
|
|
Don't manually place assembler functions into the fixed area - allow
the layout script to do it.
|
|
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.
|
|
|
|
Enhance layoutrom.py script to find and locate sections into fixed area.
Have layoutrom.py create output file instead of using redirect from make.
Don't use freespace2 for bios tables in f segment - freespace in fixed
area is now automatically filled.
Change checkrom script to test final_code16_end instead of _start -
this improves catching of alignment errors.
Don't align gdt to 8 bytes - it causes whole section to be aligned,
which causes entry point to be misaligned.
Explicitly reserve space for variables in fixed area so that the space
for them is not auto-filled.
|
|
The fixed offset requirements of the 16bit code can be done using
multiple sections and a linker script. Using the linker allows
for more flexibility.
Also, have the 16bit code generate sections for every function and
variable definition.
|
|
Change license of contributions from Kevin O'Connor from GPLv3 to
LGPLv3 (or later). Since the work as a whole is based on Kevin's
contributions and the "bochs bios" which has a license of LGPL (v2 or
later), this effectively makes the work as a whole available under
LGPLv3 (or later).
|
|
This reduces stack usage (old dos programs don't provide much space).
|
|
This commit provides just enough PnP support for gPXE to not hook int19.
|
|
Introduce two default handlers (hwpic1 and hwpic2) and register them
accordingly. This ensures the proper pic always gets an eoi.
Also, use DEBUG_ISR_hwpic1/2 to determine debugging level.
|
|
Also, rearrange the layout in the fixed area to make more room in post area.
|
|
The BIOS_CONFIG_TABLE must be aligned to 1 (or gcc may change it).
Consistently use __aligned(x) wrapper throughout C code.
Register the official fixed address handlers - even if it is only a
jump to the real handler.
Declare .type of data objects - it improves disassembler output.
Put labels at all fixed addresses - it improves disassembler output.
entry_hwirq should be calling 'cli' - use regular entry macro.
int1D is a data table, not code - so don't put an iretw there.
|
|
Detect a non-standard CMOS shutdown code during post and run a
separate resume handler.
Set aside space in the EBDA for the resume handler stack.
Add support for several of the code supported in bochs bios.
|