aboutsummaryrefslogtreecommitdiff
path: root/src/stacks.c
AgeCommit message (Collapse)AuthorFilesLines
2012-05-20Add mechanism to declare variables as "low mem" and use for extra stack.Kevin O'Connor1-6/+9
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>
2011-07-16Run option rom visible PMM code in 32bit mode instead of 16bit mode.Kevin O'Connor1-1/+1
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-10Simplify POST entry code by moving reboot logic from post.c to resume.c.Kevin O'Connor1-5/+0
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>
2010-12-05Require a "_cfuncXX_" symbol prefix for inter-mode c function references.Kevin O'Connor1-4/+2
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-25Enhance call32() to pass a parameter to called function.Kevin O'Connor1-9/+9
Support passing a parameter to the 32bit function, as well as returning the result of the function back to the 16bit code. Also, make call32 available outside of stacks.c.
2010-11-25Don't pass return address to transition(32,16,16big) on stack.Kevin O'Connor1-2/+2
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-09-25Cleanup - it's no longer necessary to manually reset global variables.Kevin O'Connor1-11/+4
Now that a soft-reboot forces a hard-reboot, it is no longer necessary to manually reset global variables.
2010-09-15Separate out init code from the rest of the 32bit flat code.Kevin O'Connor1-2/+2
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.
2010-05-23Allow wait_irq to be called in 32bit code.Kevin O'Connor1-10/+73
If wait_irq() is called from 32bit code, then jump to 16bit mode for the wait. Have wait_irq check for threads, and have it use yield if threads are pending. This ensures threads aren't delayed if anything calls wait_irq. Use wait_irq() in 32bit mode during a failed boot.
2010-05-01Further parallelize init when using CONFIG_THREAD_OPTIONROMS.Kevin O'Connor1-1/+3
When optionrom threading is enabled, allow hardware init to run in parallel with boot menu key press delay and with the smp detection. Also, run qemu_cfg_port_probe() before ram_probe().
2010-04-02Some improvements to optionrom preemption support.Kevin O'Connor1-7/+14
Enable preemption during VGA mode switch call - this call can take several milliseconds on real hardware. Call yield() in finish_preempt() - when preemption is configured it allows threads in wait_preempt() to run; when not configured it gives an opportunity for threads to execute after the implicit delay from optionrom execution. Don't penalize priority in run_thread(). The run_thread() code would implicitly yield because it created the new thread on the list after the current thread and then jumped to it. When in a preemption event, a yield effectively waits approximately one millisecond (to the next rtc irq). The implicit yielding in run_thread thus limited the number of threads one could launch during preemption to 1 per millisecond. So, change the code so that the new thread is created prior to the current thread - thus eliminating the effective yield from run_thread().
2010-03-20Force use of indirect function calls in inline assembler.Kevin O'Connor1-7/+6
For indirect calls, place function address in a register and call it. This is less optimal when gcc can inline the code and the destination address is known at compile time. However, older gcc compilers don't do as well with inlining, and they then mess up the code generation. There doesn't seem to be a way to tell gcc how to emit the code correctly for both immediate addresses and register addresses, so fall back to a safe way. Also, reduce params to stack_hop to avoid register assignment issues.
2010-03-20Don't move EBDA while an optionrom is running (CONFIG_THREAD_OPTIONROMS).Kevin O'Connor1-0/+12
Moving the ebda while an optionrom is running could confuse it. So, avoid doing that.
2010-02-28Introduce simple "mutex" locking code.Kevin O'Connor1-0/+20
Locks are not normally necessary because SeaBIOS uses a cooperative multitasking system. However, occasionally it is necessary to be able to lock a resource across yield calls. This patch introduces a simple mechanism for doing that.
2010-01-03Be sure to add "void" to all function prototypes that take no args.Kevin O'Connor1-10/+10
Omitting "void" leads to a K&R style declaration which was not intended.
2009-12-26Introduce MODESEGMENT define; rename VISIBLE32 to VISIBLE32FLAT.Kevin O'Connor1-5/+5
Prepare for support of segmented 32bit code. Add new MODESEGMENT definition, and clarify existing 32bit mode defs.
2009-12-20Fix yield() so it works from boot code.Kevin O'Connor1-1/+4
In boot code, the f-segment is read-only, so make sure yield() doesn't rely on writes. Easiest way to do this is to avoid stack switches when not needed.
2009-12-13Extract out new call32() function from check_preempt() code in stacks.c.Kevin O'Connor1-61/+72
2009-12-13Enhance experimental option rom "threading" - enable preemption.Kevin O'Connor1-13/+137
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-10Move stack manipulation code from util.c to new file stacks.c.Kevin O'Connor1-0/+163
Move the threading and stack_hop code to a new file.