From 3bbcbd5e834ed51fc40a2a2f2b1476b1e655df76 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Mon, 18 May 2009 16:29:30 -0700 Subject: [PATCH] Don't run to comboot API with interrupts off We have historically run the comboot API with interrupts off due to concerns about stack overflow. However, this is a really bad idea: we can easily spend a fair bit of time servicing one of these routines, especially when doing things like waiting for I/O. In particular, do_idle should *never* be run with interrupts disabled. Switch to running with interrupts enabled everywhere unless we have specific reasons not to do so. Signed-off-by: H. Peter Anvin --- core/comboot.inc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/core/comboot.inc b/core/comboot.inc index bbb0ad7..cdba16d 100644 --- a/core/comboot.inc +++ b/core/comboot.inc @@ -143,7 +143,7 @@ is_comboot_image: ; Note: this gets invoked both via INT 21h and directly via INT 20h. ; We don't need to cld explicitly here, because comboot_exit does that ; when invoking RESET_STACK_AND_SEGS. -comboot_return: cli ; Don't trust anyone +comboot_return: cli ; May not have a safe stack push enter_command ; Normal return to command prompt jmp comboot_exit @@ -222,7 +222,7 @@ comboot_vectors: section .text ; INT 21h: generic DOS system call -comboot_int21: cli +comboot_int21: sti push ds push es push fs @@ -265,8 +265,7 @@ comboot_bad_int21: ; Attempted to execute invalid DOS system call ; The interrupt number is on the stack. -comboot_bogus: cli ; Don't trust anyone - pop dx ; Interrupt number +comboot_bogus: pop dx ; Interrupt number pop edi ; CS:IP mov cx,err_notdos push comboot_bogus_tail @@ -294,7 +293,7 @@ comboot_exit: xor cx,cx comboot_exit_msg: pop bx ; Return address - RESET_STACK_AND_SEGS SI ; Contains cld + RESET_STACK_AND_SEGS SI ; Contains sti, cld call adjust_screen ; The COMBOOT program might have changed the screen pusha mov si,DOSSaveVectors @@ -386,7 +385,7 @@ comboot_getchar: ; INT 28h - DOS idle ; comboot_int28: - cli + sti cld call do_idle iret @@ -395,7 +394,7 @@ comboot_int28: ; INT 29h - DOS fast write character ; comboot_int29: - cli + sti cld call writechr ; Preserves registers! iret @@ -405,7 +404,7 @@ comboot_int29: ; System call number in ax ; comboot_int22: - cli + sti push ds push es push fs -- 2.7.4