aboutsummaryrefslogtreecommitdiff
path: root/src/romlayout.S
AgeCommit message (Collapse)AuthorFilesLines
2012-05-28Replace 32bit->16bit farcall system with regular calls.Kevin O'Connor1-8/+8
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>
2012-05-28Rename call16 to farcall16.Kevin O'Connor1-9/+9
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-05-28Don't restrict VISIBLEx C functions to only x mode.Kevin O'Connor1-2/+2
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>
2012-05-20Add mechanism to declare variables as "low mem" and use for extra stack.Kevin O'Connor1-5/+3
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>
2012-02-11Direct compile 16bit C code instead of including via .S files.Kevin O'Connor1-9/+2
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>
2011-07-16Run option rom visible PMM code in 32bit mode instead of 16bit mode.Kevin O'Connor1-2/+4
Use call32() to jump into handle_pmm(). This reduces the amount of 16bit code needed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-07-10Rename the apm, pcibios, and elf entry points.Kevin O'Connor1-11/+11
Use a more consistent naming that matches entry_xxx to handle_xxx where possible. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-07-10Simplify POST entry code by moving reboot logic from post.c to resume.c.Kevin O'Connor1-48/+11
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>
2011-01-29Support non-local build directory - allow "make OUT=abc/" to work.Kevin O'Connor1-2/+2
Don't require the build directory to be the "out/" directory of the SeaBIOS source.
2011-01-22Minor comment / code layout improvement to romlayout.S.Kevin O'Connor1-17/+18
2010-12-05Require a "_cfuncXX_" symbol prefix for inter-mode c function references.Kevin O'Connor1-6/+6
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.
2010-11-25Don't pass return address to transition(32,16,16big) on stack.Kevin O'Connor1-4/+10
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.
2010-07-25Avoid code addresses >64K in big real mode.Kevin O'Connor1-1/+1
Kvm has some limitations with code addresses in big real mode, so avoid doing that.
2010-01-01Implement native 32bit APM support.Kevin O'Connor1-44/+13
Add APM code to 32bit segmented code. Use 32bit APM code instead of jumping into 16bit mode.
2009-12-30Add support for 32bit PCI BIOS entry.Kevin O'Connor1-0/+55
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.
2009-12-13Enhance experimental option rom "threading" - enable preemption.Kevin O'Connor1-7/+7
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).
2009-12-10Refactor __call16_from32 - introduce transition16.Kevin O'Connor1-16/+28
Add a transition16 call that just jumps into 16bit mode. __call16_from32 (and call16big) just uses transition16 and __call16.
2009-09-09Replace common segment/offset pairs with struct segoff_s.Kevin O'Connor1-1/+1
Introduce 'struct segoff_s' to more places.
2009-07-26Add PMM stubs.Kevin O'Connor1-0/+31
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.
2009-06-10Do garbage collection of unused sections.Kevin O'Connor1-1/+1
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.
2009-05-30Fix typo in irqentryarg declaration.Kevin O'Connor1-1/+1
2009-05-23Eliminate "_code32_" prefix on 32bit symbols referenced from 16bit code.Kevin O'Connor1-4/+4
Use linking magic to eliminate the need for the _code32_ prefix.
2009-05-17Verify ebda segment looks sane before using during resume.Kevin O'Connor1-2/+7
2009-05-16Support %ebp register in 'struct bregs'.Kevin O'Connor1-0/+2
Save/restore %ebp on irq entry. Support saving and restoring %ebp on call16. Enable display of %ebp in register dumps.
2009-05-16Define unified entry points for irq handlers.Kevin O'Connor1-8/+40
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.
2009-05-06Move assembler entry macros in romlayout.S into new file entryfuncs.S.Kevin O'Connor1-135/+7
This allows the entry macros to be used in other assembler code.
2009-04-13Add option CONFIG_DISABLE_A20 to control disabling A20 on boot.Kevin O'Connor1-0/+2
Almost nothing really wants A20 off today - so add a config option (and default it off) to control turning A20 off during 16bit bootup.
2009-04-13Minor - reset data segments in post32 entry point.Kevin O'Connor1-0/+6
2009-04-13Clear irqs in transition32 instead of callers.Kevin O'Connor1-13/+9
This moves the irq clear into transition32. Also, disable nmi before loading gdt - this prevents a race with an nmi.
2009-04-13Minor - reorganize romlayout.S to better group entry points.Kevin O'Connor1-67/+72
2009-03-07Register int02 handler (nmi); disable NMI by default.Kevin O'Connor1-3/+8
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.
2009-03-01Consistently disable irqs at start of each assembler entry point.Kevin O'Connor1-21/+22
Always disable irqs at start of each entry point. Be consistent with clearing direction flag after disabling interrupts.
2009-02-27Save/restore %ebp in __call16 instead of in caller (call16).Kevin O'Connor1-6/+11
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.
2009-02-07Minor - remove permanent_halt function.Kevin O'Connor1-10/+0
The only caller is now in the 0xf0000 segment - so no need for it.
2009-01-29Don't declare a handler for int 0x1c - the default handler is sufficient.Kevin O'Connor1-1/+0
2009-01-19Minor - call16 should not assume %cs==SEG_BIOS.Kevin O'Connor1-1/+1
Should be slightly more compatible with protected mode accesses.
2009-01-19Minor - always set %esp immediately after setting %ss.Kevin O'Connor1-1/+1
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.
2009-01-17Don't assume __call16_from32 and __call16 are linear in romlayout.S.Kevin O'Connor1-3/+5
The rom layouts can be dynamic, so don't try to "fall through" to the next function.
2009-01-17Put each assembler function into its own section.Kevin O'Connor1-71/+95
Don't manually place assembler functions into the fixed area - allow the layout script to do it.
2009-01-17Move variables from assembler to C code.Kevin O'Connor1-105/+13
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.
2009-01-17Remove some unused IRQ_TRAMPOLINE definitions.Kevin O'Connor1-3/+0
2009-01-17Try to automatically fit sections into open spaces in the fixed area.Kevin O'Connor1-5/+4
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.
2009-01-17Layout fixed area using linker instead of assembler.Kevin O'Connor1-2/+1
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.
2009-01-15Change license from GPLv3 to LGPLv3.Kevin O'Connor1-1/+1
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).
2009-01-01Switch to new stack when calling ATA function in 16bit mode.Kevin O'Connor1-1/+1
This reduces stack usage (old dos programs don't provide much space).
2008-12-21Initial PnP bios call support.Kevin O'Connor1-10/+29
This commit provides just enough PnP support for gPXE to not hook int19.
2008-12-20Rework default hwirq handler so there is no confusion on which pic to eoi.Kevin O'Connor1-1/+2
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.
2008-12-18Make sure %ss==%ds in resume handler call.Kevin O'Connor1-42/+48
Also, rearrange the layout in the fixed area to make more room in post area.
2008-12-13Cleanup of fixed space addresses.Kevin O'Connor1-49/+75
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.
2008-12-10Improve support for old 16bit resume handlers.Kevin O'Connor1-1/+31
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.