[SeaBIOS] [PATCH 8/6] sercon: add text modes != 3

Kevin O'Connor kevin at koconnor.net
Mon Sep 11 17:05:19 CEST 2017


On Mon, Sep 11, 2017 at 01:18:16PM +0200, Gerd Hoffmann wrote:
[...]
> --- a/src/romlayout.S
> +++ b/src/romlayout.S
> @@ -434,7 +434,7 @@ entry_sercon:
>          pushl $1f
>          retl
>  1:      cmpl %esp, %eax
> -        jne 4f
> +        jne 5f
>          cmpb $0, sercon_enable  // Test that sercon is enabled
>          je 3f
>  
> @@ -449,15 +449,17 @@ entry_sercon:
>  
>          // sercon disabled - verify not 0x03 modeset and otherwise exit
>  3:      popl %eax
> +        cmpw $0x0007, %ax
> +        je 4f
>          cmpw $0x0003, %ax
> -        jne 5f
> -        pushl %eax
> +        jg 6f
> +4:      pushl %eax
>          jmp 2b
>  
>          // Running on broken x86emu - restore stack and exit
> -4:      movl %eax, %esp
> +5:      movl %eax, %esp
>          popl %eax
> -5:      popw %ds
> +6:      popw %ds
>          iretw

The asm could be simplified a bit:

// Serial console "hooked vga" entry point
        DECLFUNC entry_sercon
entry_sercon:
        // Setup for chain loading to real vga handler
        pushfw
        pushl %cs:sercon_real_vga_handler

        // Set %ds to zonelow segment
        cli
        cld
        pushw %ds
        pushl %eax
        movl $_zonelow_seg, %eax
        movl %eax, %ds

        // Test if the sercon handler can be called
        movl %esp, %eax         // Test for broken x86emu
        pushl $1f
        retl
1:      cmpl %esp, %eax
        jne 4f
        cmpb $0, sercon_enable  // Test that sercon is enabled
        je 3f

        // Call handle_sercon()
        popl %eax
        popw %ds
2:      pushl $handle_sercon
#if CONFIG_ENTRY_EXTRASTACK
        jmp irqentry_arg_extrastack
#else
        jmp irqentry_arg
#endif

        // sercon disabled - check for legacy text modeset and otherwise exit
3:      popl %eax
        popw %ds
        cmpw $0x0007, %ax
        jle 2b
        iretw

        // Running on broken x86emu - restore stack and exit
4:      movl %eax, %esp
        popl %eax
        popw %ds
        iretw



More information about the SeaBIOS mailing list