diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2008-03-01 14:56:07 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2008-03-01 14:56:07 -0500 |
commit | b8aacb065b0b1e11604805f459b2f73d4f09bfe9 (patch) | |
tree | 26778791c87c73b882c27c35ea10da78db7c744b | |
parent | 3a47a310edd92bef0136ff3a97672d6fb45922fe (diff) | |
download | seabios-b8aacb065b0b1e11604805f459b2f73d4f09bfe9.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-- | TODO | 7 | ||||
-rw-r--r-- | src/util.h | 12 |
2 files changed, 9 insertions, 10 deletions
@@ -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. @@ -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 |