Skip to content

Commit

Permalink
Reduce stack usage in call16().
Browse files Browse the repository at this point in the history
Tell gcc that registers are clobbered instead of using push/popal.
  • Loading branch information
KevinOConnor committed Mar 1, 2008
1 parent 3a47a31 commit b8aacb0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
7 changes: 2 additions & 5 deletions 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.

Expand Down
12 changes: 7 additions & 5 deletions src/util.h
Expand Up @@ -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
Expand Down

0 comments on commit b8aacb0

Please sign in to comment.