diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2008-03-11 20:38:33 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2008-03-11 20:38:33 -0400 |
commit | 7a558e4417c74a0d7f2896178636b1d020d3fae9 (patch) | |
tree | b725bb96feffa807da77e35b2b7d5169a85150ae | |
parent | 64c718d27a0b9e8570968eed749782b170e32645 (diff) | |
download | seabios-7a558e4417c74a0d7f2896178636b1d020d3fae9.tar.gz |
Don't save/restore flags and ebp on external calls - saves on stack space.
It isn't necessary to save ebp - just mark it as clobbered.
The only important flag to save/restore is irqs - manually fixup all callers.
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | src/boot.c | 4 | ||||
-rw-r--r-- | src/clock.c | 1 | ||||
-rw-r--r-- | src/mouse.c | 7 | ||||
-rw-r--r-- | src/romlayout.S | 4 | ||||
-rw-r--r-- | src/util.h | 9 |
6 files changed, 14 insertions, 14 deletions
@@ -1,4 +1,5 @@ -Audit all sti/cli calls. +Audit all sti/cli calls. Audit all call16 calls to make sure flags is +setup properly with respect to irqs. Audit statements where a 32bit intermediary changes meaning of a 16bit comparison. @@ -63,7 +63,10 @@ print_boot_failure(u16 type, u8 reason) static void try_boot(u16 seq_nr) { + irq_enable(); + SET_IPL(sequence, seq_nr); + u16 bootseg; u8 bootdrv = 0; u16 bootdev, bootip; @@ -210,7 +213,6 @@ begin_boot() { if (CONFIG_ATA) ata_detect(); - irq_enable(); struct bregs br; memset(&br, 0, sizeof(br)); call16_int(0x19, &br); diff --git a/src/clock.c b/src/clock.c index c653c1f3..b9d75a3c 100644 --- a/src/clock.c +++ b/src/clock.c @@ -356,6 +356,7 @@ handle_70() struct bregs br; memset(&br, 0, sizeof(br)); call16_int(0x4a, &br); + irq_disable(); } if (!(registerC & 0x40)) goto done; diff --git a/src/mouse.c b/src/mouse.c index 569488b7..6c214997 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -397,8 +397,6 @@ int74_function() u32 func = GET_EBDA(far_call_pointer); asm volatile( - "pushl %%ebp\n" - "pushfl\n" "pushl %0\n" "pushw %w1\n" // status "pushw %w2\n" // X @@ -406,11 +404,10 @@ int74_function() "pushw $0\n" // Z "lcallw *8(%%esp)\n" "addl $12, %%esp\n" - "popfl\n" - "popl %%ebp\n" + "cld\n" : "+a" (func), "+b" (status), "+c" (X), "+d" (Y) : - : "esi", "edi" + : "esi", "edi", "ebp", "cc" ); } diff --git a/src/romlayout.S b/src/romlayout.S index 9f0541a7..d5253457 100644 --- a/src/romlayout.S +++ b/src/romlayout.S @@ -50,6 +50,8 @@ post16: set_entry32: pushl $0xf0000000 + cld + // Fall through to transition32 function below @@ -92,8 +94,6 @@ transition32: movw %ax, %fs movw %ax, %gs - cld - retl // Call a 16bit function from 32bit mode. @@ -45,6 +45,7 @@ static inline void hlt(void) // XXX - move this to a c file and use PANIC PORT. #define BX_PANIC(fmt, args...) do { \ bprintf(0, fmt , ##args); \ + irq_disable(); \ for (;;) \ hlt(); \ } while (0) @@ -83,22 +84,20 @@ eoi_both_pics() eoi_master_pic(); } +// Call a function with a specified register state. Note that on +// return, the interrupt enable/disable flag may be altered. static inline void call16(struct bregs *callregs) { asm volatile( - "pushl %%ebp\n" // Save state - "pushfl\n" #ifdef MODE16 "calll __call16\n" #else "calll __call16_from32\n" #endif - "popfl\n" // Restore state - "popl %%ebp\n" : "+a" (callregs), "+m" (*callregs) : - : "ebx", "ecx", "edx", "esi", "edi"); + : "ebx", "ecx", "edx", "esi", "edi", "ebp", "cc"); } static inline |