aboutsummaryrefslogtreecommitdiffstats
path: root/src/types.h
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Eliminate FUNCFSEG - only force portions of inline asm to f-segmentKevin O'Connor2014-12-031-4/+0
| | | | | | | | | | The FUNCFSEG macro was introduced to force a C function into the f-segment. This was needed for some C functions that used inline assembler that contained some 16bit code. Instead of forcing the entire C function into the f-segment, just force the small subset of inline assembler into the f-segment. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Support declaring 32bit C functions that must reside in the f-segmentKevin O'Connor2014-10-111-0/+4
| | | | | | | | Add support for a FUNCFSEG macro that will force a "32bit flat" C function to be located in the f-segment. This is useful for 32bit code with inline assembler that thunks to 16bit mode. 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-4/+4
| | | | | | | | | 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 definition of struct segoff_s from farptr.h to types.h.Kevin O'Connor2013-09-181-0/+11
| | | | | | | The segoff_s definition is used by a number of header files that would not otherwise need farptr.h, so move it to a more central location. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Introduce and convert pmm code to use standard list helpers.Kevin O'Connor2013-06-081-0/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Add VARVERIFY32INIT attribute for variables only available during "init".Kevin O'Connor2013-03-081-0/+4
| | | | | | | | | Add a build check to verify certain variables are only reachable via the 32bit "init" code. This can be used as a mechanism to enforce certain data (and code that accesses that data) as only available during POST. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Don't relocate "varlow" variable references at runtime.Kevin O'Connor2013-02-191-1/+1
| | | | | | | | | Since the final location of the "varlow" variables are known at build time, link the final locations into the binary during the build. The 16bit code was already done at link time - update the build so the 32bit code is also done at link time. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Convert VAR16VISIBLE, VAR16EXPORT, and VAR32VISIBLE to VARFSEG.Kevin O'Connor2013-02-181-14/+2
| | | | | | | | | | | 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>
* Introduce VARFSEG for variables that will reside in the f-segment.Kevin O'Connor2013-02-181-0/+4
| | | | | | | Introduce a variable declaration that will force variables (that are compiled in 32bit mode) to be emitted into the f-segment. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Clarify build generated "zone low" values.Kevin O'Connor2013-02-171-1/+1
| | | | | | | | | Rename datalow_base (and similar) to zonelow_base, and datalow_start (and similar) to varlow_start. This helps distinguish between the bounds for the runtime dynamic memory pool and the compile time global variables. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Fix 'union u64_u32_u' member names.Kevin O'Connor2012-09-151-1/+1
| | | | | | | Use 'lo' to mean the low bits and 'hi' to mean the high bits of a 64bit value. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Don't restrict VISIBLEx C functions to only x mode.Kevin O'Connor2012-05-281-8/+8
| | | | | | | | 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 mechanism to declare variables as "low mem" and use for extra stack.Kevin O'Connor2012-05-201-0/+4
| | | | | | | | | | | | | | | 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>
* Require a "_cfuncXX_" symbol prefix for inter-mode c function references.Kevin O'Connor2010-12-051-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.
* Separate out init code from the rest of the 32bit flat code.Kevin O'Connor2010-09-151-3/+7
| | | | | | | | Enhance tools/layoutrom.py code so that it can detect which sections are used from the "32bit flat" runtime code. All other "32bit flat" sections can then be assured to be initialization code only. This is in preparation for relocating the 32bit initialization code.
* Add __attribute__((__malloc__)) declaration to internal malloc funcs.Kevin O'Connor2010-04-171-0/+1
|
* Don't move EBDA while an optionrom is running (CONFIG_THREAD_OPTIONROMS).Kevin O'Connor2010-03-201-0/+3
| | | | | Moving the ebda while an optionrom is running could confuse it. So, avoid doing that.
* Reduce #ifs by weeding out some cross-chunk function definitions.Kevin O'Connor2010-01-031-6/+6
| | | | | | | | | | Reduce the need for placing #if guards around functions that are marked as VISIBLE in another code chunk by declaring the functions as "weak" when they are not needed. It's still necessary to ensure that no C code references the data from a different chunk (or an -fwhole-program compile might try to keep a local reference).
* 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.
* Force a link error if a function is used from the wrong code chunk.Kevin O'Connor2010-01-011-12/+16
| | | | | | Force functions intended for other code segments to be discarded during link - this will cause a link error if it used. Clean up rom layout code to ensure discarded sections are not used.
* Add __noreturn define for __attribute__((noreturn)).Kevin O'Connor2010-01-011-2/+3
|
* Add support for 32bit PCI BIOS entry.Kevin O'Connor2009-12-301-2/+24
| | | | | | | | | 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.
* Introduce MODESEGMENT define; rename VISIBLE32 to VISIBLE32FLAT.Kevin O'Connor2009-12-261-8/+15
| | | | | Prepare for support of segmented 32bit code. Add new MODESEGMENT definition, and clarify existing 32bit mode defs.
* Replace clock conversion constants with defines.Kevin O'Connor2009-09-271-0/+4
| | | | Simplify and name the clock multiplier constants.
* Rename VAR16_32 to VAR16VISIBLE.Kevin O'Connor2009-09-091-6/+6
| | | | | Sometimes VAR16_32 is used to export a definition to assembler, so clarify its naming.
* Cleanups for malloc code.Kevin O'Connor2009-08-301-1/+2
| | | | | | Fix bug where zones over 2gig may fail to allocate. Add memalign_high() and use for acpi facs allocation. Misc code cleanups.
* Add Post Memory Manager (PMM) support.Kevin O'Connor2009-08-011-1/+7
| | | | | | | | | | | | 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.
* Unify mode16/32 compiler checks.Kevin O'Connor2009-06-151-0/+1
| | | | | | | Add ASSERT16/ASSERT32 macros to farptr.h. Use those macros in place of open-coded checks. Add "noreturn" attribute to functions to reduce compiler warnings. Add ASSERT32 to smp_probe() to eliminate 16bit assembler warnings.
* Add support for gcc v3.x compilers.Kevin O'Connor2009-06-101-1/+9
| | | | | | | | Suppress __attribute__((externally_visible)) when no -fwhole-program Add switch hack for compilers without -fno-jump-tables Define memcpy() function (for compilers without -minline-all-stringops). Define call16_simpint as a macro (a param needs to be inlined). Make sure s3_resume is only defined in 32bit mode.
* Do garbage collection of unused sections.Kevin O'Connor2009-06-101-5/+17
| | | | | | | | | | | 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.
* Move variables from assembler to C code.Kevin O'Connor2009-01-171-0/+3
| | | | | | | | 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.
* Layout fixed area using linker instead of assembler.Kevin O'Connor2009-01-171-2/+2
| | | | | | | | 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 from GPLv3 to LGPLv3.Kevin O'Connor2009-01-151-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).
* Add more linker protections around variables accessed from 16bit mode.Kevin O'Connor2008-12-291-2/+5
| | | | | | | Rename VAR16 to VAR16_32 -- that macro supports accesses from both 16bit and 32bit mode. Introduce a new macro VAR16 that must be present on all global variables accessed from 16bit mode.
* Add linker magic to ensure 16bit variables aren't repeated in 32bit code.Kevin O'Connor2008-12-281-4/+11
| | | | | | Add VAR16 macro to enable a variable to be available in both 32bit and 16bit code. This reduces the occurrences of "#if MODE16". Also add ASM16 macro to reduce occurrences of "#if MODE16".
* Improve support for old 16bit resume handlers.Kevin O'Connor2008-12-101-0/+1
| | | | | | | 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.
* Always define macro MODE16 - that way it can be used in C conditionals.Kevin O'Connor2008-07-131-1/+1
| | | | When in 32bit mode - just define it to 0.
* Move acpi code out of rombios32.c; clean up use of fixed memory addresses.Kevin O'Connor2008-06-111-0/+2
| | | | | | | | Move acpi code from rombios32.c to acpi.c. Move all fixed memory addresses used by the code to config.h and consistently use a "BUILD_" prefix on the definitions. Move some pci defs to pci.h - allows access from acpi.c and rombios32.c. Introduce ALIGN() macro - remove old align function.
* Auto detect EBDA_SIZE from size of data structure.Kevin O'Connor2008-05-181-0/+1
|
* Add full support for drives with more that 2<<32 sectors.Kevin O'Connor2008-05-141-0/+5
| | | | Use 64bit integers for sector and lba values.
* Reduce ide stack usage by reorganizing ata calls.Kevin O'Connor2008-05-131-0/+1
| | | | Break up some functions and play with inlining to reduce stack usage.
* Use __always_inline to force inlining.Kevin O'Connor2008-04-131-1/+1
| | | | Before, inline was enough to force inlining.
* Add s64 type to types.h.Kevin O'Connor2008-04-051-1/+2
|
* Update interger types in rombios32 code.Kevin O'Connor2008-03-121-0/+1
| | | | | | | - Make rombios32.c to use the interger types already defined in types.h - Add u64 typedef Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
* Add FIELD_SIZEOF macro to types.hKevin O'Connor2008-03-111-0/+1
|
* Force functions marked as inline to always be inlined.Kevin O'Connor2008-03-111-0/+2
| | | | | | | | Inline alters stack usage, so don't let gcc uninline. Also, gcc seems to include multiple copies of uninlined functions when using -combine. With inlining forced on, the no null check optimization causes problems, so disable it.
* Port rombios32 code from bochs-bios.Kevin O'Connor2008-03-081-0/+5
| | | | | | | | | | | | This adds acpi, smbios, pci init, etc. Changes from original rombios32.c code: * Header file translation. * Use common functions already in code (eg, outb, memset, bios_printf, usleep) * Implement trampoline for disabling bios shadowing (rombios32 code actually runs in the 0xf0000 area). * Copy asm code from rombios32start.S to an asm() statement in C code.
* Revert "This patch adds the BIOS support for SMP, ACPI, PCI, SMM, SMBIOS."Kevin O'Connor2008-03-081-1/+0
| | | | | | | | This reverts commit 3d029417164e9a6dffee491fb061de3de6d85595. Conflicts: src/post.c
* Rename VISIBLE macro for better control.Kevin O'Connor2008-03-051-1/+10
| | | | | VISIBLE16 is used to mark functions externally available in 16bit code. VISIBLE32 is for 32bit functions.