aboutsummaryrefslogtreecommitdiffstats
path: root/src/entryfuncs.S
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2014-11-05 09:05:36 -0500
committerKevin O'Connor <kevin@koconnor.net>2014-11-12 12:17:57 -0500
commitaa66d6539cb11720477f2219a5821a9de1916384 (patch)
tree5e0cd3c967b3096142c39bf105a3b34aa1a0dc04 /src/entryfuncs.S
parentb4eb6fc5cc051e18d07f9483c093c9c32cece2f7 (diff)
downloadseabios-aa66d6539cb11720477f2219a5821a9de1916384.tar.gz
Use an aligned stack offset when entering on the extra stack
The size of 'struct bregs' is not evenly divisible by four and where the assembler placed a 'struct bregs' on the extra stack as part of entering into the C functions it caused the C functions to run with a non-aligned stack. It's technically not correct to use an unaligned stack and it is certainly less efficient. This patch avoids using BREGS_size (the sizeof struct bregs) and instead introduces PUSHBREGS_size (the size of the general purpose registers in struct bregs) in the assembler. Where the code actually did use the %cs:%ip and flags, an extra 8 (instead of 6) bytes are added to maintain a sane alignment. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/entryfuncs.S')
-rw-r--r--src/entryfuncs.S2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/entryfuncs.S b/src/entryfuncs.S
index cc1f4332..7368bb6d 100644
--- a/src/entryfuncs.S
+++ b/src/entryfuncs.S
@@ -9,6 +9,8 @@
* Macros for save and restore of 'struct bregs' registers
****************************************************************/
+#define PUSHBREGS_size 32
+
// Save registers (matches struct bregs) to stack
.macro PUSHBREGS
pushl %eax