[SeaBIOS] [PATCH 4/6] add serial console support

Kevin O'Connor kevin at koconnor.net
Fri Sep 8 20:44:23 CEST 2017


On Fri, Sep 08, 2017 at 08:18:26AM +0200, Gerd Hoffmann wrote:
> Redirect int10 calls to serial console output.
> Parse serial input and queue key events.
[...]
> --- a/src/misc.c
> +++ b/src/misc.c
> @@ -11,6 +11,7 @@
>  #include "output.h" // debug_enter
>  #include "stacks.h" // call16_int
>  #include "string.h" // memset
> +#include "util.h" // serial_10
>  
>  #define PORT_MATH_CLEAR        0x00f0
>  
> @@ -57,6 +58,7 @@ handle_10(struct bregs *regs)
>  {
>      debug_enter(regs, DEBUG_HDL_10);
>      // don't do anything, since the VGA BIOS handles int10h requests
> +    sercon_10(regs);
>  }

I don't think we should have two entry points into the C code for
vgabios calls given how fragile the vgabios entry point is (due to
broken emulation on various OSes).  Indeed, I'd be more inclined to
remove handle_10() entirely - see patch below as example.

Instead of having two entry points (primary mode and split mode),
perhaps just have a split mode entry point.  When sercon is in primary
mode, point the chain'ed handler to an iretw instruction.  One could
use FUNC16(entry_iret_official), or just keep it at FUNC16(entry_10)
with the patch below.

-Kevin


    romlayout: Don't enter C code on 0x10 video interrupt
    
    The handle_10() code doesn't currently do anything and there is a risk
    that entering the C code to run it could cause problems with operating
    systems that attempt to emulate vgabios calls.  Change the entry_10
    code to immediately invoke an iretw instead.
    
    Signed-off-by: Kevin O'Connor <kevin at koconnor.net>

diff --git a/src/config.h b/src/config.h
index baca029..93c8dbc 100644
--- a/src/config.h
+++ b/src/config.h
@@ -76,7 +76,6 @@
 #define DEBUG_ISR_08 20
 #define DEBUG_ISR_09 9
 #define DEBUG_ISR_0e 9
-#define DEBUG_HDL_10 20
 #define DEBUG_HDL_11 2
 #define DEBUG_HDL_12 2
 #define DEBUG_HDL_13 10
diff --git a/src/misc.c b/src/misc.c
index f02237c..b511730 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -51,14 +51,6 @@ handle_05(struct bregs *regs)
     debug_enter(regs, DEBUG_HDL_05);
 }
 
-// INT 10h Video Support Service Entry Point
-void VISIBLE16
-handle_10(struct bregs *regs)
-{
-    debug_enter(regs, DEBUG_HDL_10);
-    // don't do anything, since the VGA BIOS handles int10h requests
-}
-
 // NMI handler
 void VISIBLE16
 handle_02(void)
diff --git a/src/romlayout.S b/src/romlayout.S
index 89b3784..7529e60 100644
--- a/src/romlayout.S
+++ b/src/romlayout.S
@@ -597,7 +597,8 @@ entry_10_0x0f:
         iretw
 
         ORG 0xf065
-        IRQ_ENTRY_ARG 10
+entry_10:
+        iretw
 
         // 0xf0a4 - VideoParams in misc.c
 



More information about the SeaBIOS mailing list