[SeaBIOS] [PATCH 00/13] Enhance extra stack and reduce overall 16bit stack usage

Kevin O'Connor kevin at koconnor.net
Tue May 29 06:06:49 CEST 2012


This patch series reduces the overall stack usage of the 16bit code.

The biggest change is the enhancment of the "extra stack" in the
e-segment to be re-entrant.  The "extra stack" was previously used
only by the resume code and disk code.  It has been made more flexible
so that it can be used by other callers.  After this series, SeaBIOS
will never expose the extra stack to any external code - on any irq
enable or external call point SeaBIOS will jump back to the original
stack first.  Because the extra stack is only used by SeaBIOS code
now, the stack space in use can be tracked and re-entrant callers can
be handled safely.

All of the hardware irq handlers have been updated to jump into the
extra stack upon being called.  This makes the stack space used by
SeaBIOS based hardware irq handlers virtually zero.

-Kevin


Kevin O'Connor (13):
  Rename wait_irq to yield_toirq.
  Don't restrict VISIBLEx C functions to only x mode.
  Rename call16 to farcall16.
  Move farcall16 code from util.c to stacks.c and reorg stacks.c.
  Replace 32bit->16bit farcall system with regular calls.
  Make the extra stack re-entrant and "hop back" to check for irqs.
  Automatically hop off the extra stack when far calling 16bit code.
  Run all hardware irq handlers on the extra stack.
  Use the extra stack for 16bit USB and PS2 keyboard/mouse commands.
  Remove "noinline" declarations from keyboard/mouse driver code.
  Set noinline on kbd.c interface functions that take stack variable
    pointers.
  Make sure to set dependency to segment registers in inline asm.
  Rework disk.c:fillLCHS to avoid using pointer parameters.

 src/apm.c           |   15 +--
 src/asm-offsets.c   |    1 +
 src/boot.c          |    6 +-
 src/clock.c         |   22 +++--
 src/disk.c          |   40 ++++----
 src/disk.h          |    1 +
 src/floppy.c        |    8 +-
 src/kbd.c           |   30 +++---
 src/misc.c          |   14 ++-
 src/mouse.c         |   63 ++++++-----
 src/optionroms.c    |    2 +-
 src/output.c        |    9 --
 src/post.c          |    3 +
 src/ps2port.c       |    8 +-
 src/resume.c        |    2 +-
 src/romlayout.S     |  153 ++++++++++++++++++---------
 src/stacks.c        |  285 ++++++++++++++++++++++++++++++++++-----------------
 src/system.c        |    6 +-
 src/types.h         |   16 ++--
 src/usb-hid.c       |    2 +-
 src/usb.c           |    2 +-
 src/util.c          |   62 ++----------
 src/util.h          |   47 +++------
 tools/checkstack.py |    2 +-
 24 files changed, 439 insertions(+), 360 deletions(-)

-- 
1.7.6.5




More information about the SeaBIOS mailing list