aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-03-01 14:56:07 -0500
committerKevin O'Connor <kevin@koconnor.net>2008-03-01 14:56:07 -0500
commitb8aacb065b0b1e11604805f459b2f73d4f09bfe9 (patch)
tree26778791c87c73b882c27c35ea10da78db7c744b
parent3a47a310edd92bef0136ff3a97672d6fb45922fe (diff)
downloadseabios-rel-0.1.3.tar.gz
Reduce stack usage in call16().rel-0.1.3
Tell gcc that registers are clobbered instead of using push/popal.
-rw-r--r--TODO7
-rw-r--r--src/util.h12
2 files changed, 9 insertions, 10 deletions
diff --git a/TODO b/TODO
index 08aaf91d..fa013925 100644
--- a/TODO
+++ b/TODO
@@ -1,10 +1,7 @@
Find out why ubuntu compiles are failing. Find work around.
-See if it is better to tell gcc that call16 clobbers all registers
-instead of having the code call pushal/popal.
-
-The __call16 code does a long jump to the interrupt handlers - this is
-unnecessary.
+The __call16 code does a long jump to the interrupt trampolines - this
+is unnecessary.
Fix makefiles so that they rebuild the required files automatically.
diff --git a/src/util.h b/src/util.h
index 7de577bb..6c707bd5 100644
--- a/src/util.h
+++ b/src/util.h
@@ -65,16 +65,18 @@ static inline
void call16(struct bregs *callregs)
{
asm volatile(
- "pushfl\n" // Save flags
- "pushal\n" // Save registers
+ "pushl %%ebp\n" // Save state
+ "pushfl\n"
#ifdef MODE16
"calll __call16\n"
#else
"calll __call16_from32\n"
#endif
- "popal\n"
- "popfl\n"
- : : "a" (callregs), "m" (*callregs));
+ "popfl\n" // Restore state
+ "popl %%ebp\n"
+ : "=a" (callregs), "=m" (*callregs)
+ : "a" (callregs), "m" (*callregs)
+ : "ebx", "ecx", "edx", "esi", "edi");
}
static inline