diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2014-11-05 09:05:36 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2014-11-12 12:17:57 -0500 |
commit | aa66d6539cb11720477f2219a5821a9de1916384 (patch) | |
tree | 5e0cd3c967b3096142c39bf105a3b34aa1a0dc04 /src/asm-offsets.c | |
parent | b4eb6fc5cc051e18d07f9483c093c9c32cece2f7 (diff) | |
download | seabios-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/asm-offsets.c')
-rw-r--r-- | src/asm-offsets.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/src/asm-offsets.c b/src/asm-offsets.c index 576bf343..b98f3b5a 100644 --- a/src/asm-offsets.c +++ b/src/asm-offsets.c @@ -20,5 +20,4 @@ void foo(void) OFFSET(BREGS_edi, bregs, edi); OFFSET(BREGS_flags, bregs, flags); OFFSET(BREGS_code, bregs, code); - DEFINE(BREGS_size, sizeof(struct bregs)); } |