aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-03-01 12:31:57 -0500
committerKevin O'Connor <kevin@koconnor.net>2009-03-01 12:31:57 -0500
commit4ebc0b70305c6d6a14eb03c355fda0d8dc829bc5 (patch)
tree53911bc0800e8390b78a290dcc8e468c542d7494 /src
parent11ac162bf1536d4f2eaac9fedec1eec746b4512d (diff)
downloadseabios-hppa-4ebc0b70305c6d6a14eb03c355fda0d8dc829bc5.zip
seabios-hppa-4ebc0b70305c6d6a14eb03c355fda0d8dc829bc5.tar.gz
seabios-hppa-4ebc0b70305c6d6a14eb03c355fda0d8dc829bc5.tar.bz2
Consistently disable irqs at start of each assembler entry point.
Always disable irqs at start of each entry point. Be consistent with clearing direction flag after disabling interrupts.
Diffstat (limited to 'src')
-rw-r--r--src/mouse.c6
-rw-r--r--src/romlayout.S43
-rw-r--r--src/util.c2
3 files changed, 27 insertions, 24 deletions
diff --git a/src/mouse.c b/src/mouse.c
index 2f997c1..e6abbb9 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -313,8 +313,9 @@ process_mouse(u8 data)
u32 func = GET_EBDA2(ebda_seg, far_call_pointer);
- irq_enable();
asm volatile(
+ "sti\n"
+
"pushl %0\n"
"pushw %w1\n" // status
"pushw %w2\n" // X
@@ -322,12 +323,13 @@ process_mouse(u8 data)
"pushw $0\n" // Z
"lcallw *8(%%esp)\n"
"addl $12, %%esp\n"
+
+ "cli\n"
"cld\n"
:
: "r"(func), "r"(status), "r"(X), "r"(Y)
: "cc"
);
- irq_disable();
}
// INT74h : PS/2 mouse hardware interrupt
diff --git a/src/romlayout.S b/src/romlayout.S
index 319d7b4..e5e82e4 100644
--- a/src/romlayout.S
+++ b/src/romlayout.S
@@ -28,6 +28,7 @@
// call into C. It sets up %ds, backs up %es, and backs up
// those registers that are call clobbered by the C compiler.
.macro ENTRY cfunc
+ cli // In case something far-calls instead of using "int"
cld
pushl %eax // Save registers clobbered by C code
pushl %ecx
@@ -52,6 +53,7 @@
// to point to the backup. On return, the registers are
// restored from the structure.
.macro ENTRY_ARG cfunc
+ cli
cld
pushl %eax // Save registers (matches struct bregs)
pushl %ecx
@@ -80,6 +82,7 @@
// As above, but don't mangle %esp
.macro ENTRY_ARG_ESP cfunc
+ cli
cld
pushl %eax // Save registers (matches struct bregs)
pushl %ecx
@@ -103,13 +106,14 @@
popl %eax
.endm
- // Macro to reset the 16bit stack
+ // Reset stack, transition to 32bit mode, and call a C function.
// Clobbers %ax
- .macro RESET_STACK
+ .macro ENTRY_INTO32 cfunc
xorw %ax, %ax
movw %ax, %ss
movl $ BUILD_STACK_ADDR , %esp
- cld
+ pushl $ \cfunc
+ jmp transition32
.endm
// Declare a function
@@ -125,11 +129,15 @@
DECLFUNC entry_post
entry_post:
- // enable cache
+ // Enable cache
movl %cr0, %eax
andl $~(CR0_CD|CR0_NW), %eax
movl %eax, %cr0
+ // Disable interrupts
+ cli
+ cld
+
// Check for restart indicator.
movl $CMOS_RESET_CODE, %eax
outb %al, $PORT_CMOS_INDEX
@@ -138,9 +146,7 @@ entry_post:
jnz 1f
// Normal entry point
- RESET_STACK
- pushl $_code32__start
- jmp transition32
+ ENTRY_INTO32 _code32__start
// Entry point when a post call looks like a resume.
1:
@@ -164,8 +170,6 @@ entry_post:
// Call handler.
movl %ebx, %eax
- cld
- cli
jmp handle_resume
@@ -175,13 +179,11 @@ entry_post:
// Place CPU into 32bit mode from 16bit mode.
// Clobbers: flags, segment registers, cr0, idt/gdt
+// Require: interrupts must be disabled
DECLFUNC transition32
transition32:
pushl %eax
- // Disable irqs
- cli
-
// enable a20
inb $PORT_A20, %al
orb $A20_ENABLE_BIT, %al
@@ -331,6 +333,7 @@ __call16:
popl %eax
popl %ebp
+ cli
cld
retl
@@ -432,7 +435,6 @@ post32:
.macro IRQ_ENTRY num
.global entry_\num
entry_\num :
- cli // In case something far-calls instead of using "int"
ENTRY handle_\num
iretw
.endm
@@ -441,7 +443,6 @@ post32:
.macro IRQ_ENTRY_ARG num
.global entry_\num
entry_\num :
- cli // In case something far-calls instead of using "int"
ENTRY_ARG handle_\num
iretw
.endm
@@ -466,18 +467,18 @@ post32:
DECL_IRQ_ENTRY hwpic1
DECL_IRQ_ENTRY hwpic2
- // int 18/19 are special - they reset the stack and do not return.
+ // int 18/19 are special - they reset stack and call into 32bit mode.
DECLFUNC entry_19
entry_19:
- RESET_STACK
- pushl $_code32_handle_19
- jmp transition32
+ cli
+ cld
+ ENTRY_INTO32 _code32_handle_19
DECLFUNC entry_18
entry_18:
- RESET_STACK
- pushl $_code32_handle_18
- jmp transition32
+ cli
+ cld
+ ENTRY_INTO32 _code32_handle_18
/****************************************************************
diff --git a/src/util.c b/src/util.c
index 7358040..ae00d6c 100644
--- a/src/util.c
+++ b/src/util.c
@@ -62,8 +62,8 @@ call16_simpint(int nr, u32 *eax, u32 *flags)
"int %2\n"
"pushfl\n"
"popl %1\n"
- "cld\n"
"cli\n"
+ "cld\n"
: "+a"(*eax), "=r"(*flags)
: "i"(nr)
: "cc", "memory");