aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhpa <hpa>2005-01-05 07:45:23 +0000
committerhpa <hpa>2005-01-05 07:45:23 +0000
commit9457200040a01d507df69ef876162566932b77ea (patch)
tree1c2f9e22a55dab631ecfefc312566904c161926a
parent4176f87ff148e72b4626284cadfdb0f800eead1b (diff)
downloadsyslinux-elf-syslinux-3.02.tar.gz
syslinux-elf-syslinux-3.02.tar.xz
syslinux-elf-syslinux-3.02.zip
Allow libcom32 to detect a disabled video console, and act appropriately.syslinux-3.02
-rw-r--r--com32/lib/sys/ansicon_write.c19
-rw-r--r--comboot.doc1
-rw-r--r--comboot.inc4
3 files changed, 22 insertions, 2 deletions
diff --git a/com32/lib/sys/ansicon_write.c b/com32/lib/sys/ansicon_write.c
index d3bdff1f..b22421ef 100644
--- a/com32/lib/sys/ansicon_write.c
+++ b/com32/lib/sys/ansicon_write.c
@@ -57,6 +57,7 @@ enum ansi_state {
#define MAX_PARMS 16
struct term_state {
+ int disabled;
int attr; /* Current display attribute */
int vtgraphics; /* VT graphics on/off */
int intensity;
@@ -76,6 +77,7 @@ struct term_state {
static const struct term_state default_state =
{
+ .disabled = 0,
.attr = 0x07, /* Grey on black */
.vtgraphics = 0,
.intensity = 1,
@@ -103,10 +105,20 @@ static const char decvt_to_cp437[] =
static void __constructor ansicon_init(void)
{
static com32sys_t ireg; /* Auto-initalized to all zero */
+ com32sys_t oreg;
/* Initial state */
memcpy(&st, &default_state, sizeof st);
+ /* Are we disabled? */
+ ireg.eax.w[0] = 0x000b;
+ __intcall(0x22, &ireg, &oreg);
+
+ if ( (signed char)oreg.ebx.b[1] < 0 ) {
+ st.disabled = 1;
+ return;
+ }
+
/* Force text mode */
ireg.eax.w[0] = 0x0005;
__intcall(0x22, &ireg, NULL);
@@ -114,8 +126,8 @@ static void __constructor ansicon_init(void)
/* Get cursor shape */
ireg.eax.b[1] = 0x03;
ireg.ebx.b[1] = BIOS_PAGE;
- __intcall(0x10, &ireg, &ireg);
- st.cursor_type = ireg.ecx.w[0];
+ __intcall(0x10, &ireg, &oreg);
+ st.cursor_type = oreg.ecx.w[0];
}
/* Erase a region of the screen */
@@ -506,6 +518,9 @@ ssize_t __ansicon_write(struct file_info *fp, const void *buf, size_t count)
(void)fp;
+ if ( st.disabled )
+ return n; /* Nothing to do */
+
while ( count-- ) {
ansicon_putchar(*bufp++);
n++;
diff --git a/comboot.doc b/comboot.doc
index 62b17db3..7719068e 100644
--- a/comboot.doc
+++ b/comboot.doc
@@ -424,6 +424,7 @@ AX=000Bh [2.00] Get Serial Console Configuration
Output: DX Serial port I/O base (e.g. 3F8h = COM1...)
CX Baud rate divisor (1 = 115200 bps, 2 = 57600 bps...)
BX Flow control configuration bits (see syslinux.doc)
+ -> Bit 15 is set if the video console is disabled
If no serial port is configured, DX will be set to 0 and the
other registers are undefined.
diff --git a/comboot.inc b/comboot.inc
index 3859998e..44d02d82 100644
--- a/comboot.inc
+++ b/comboot.inc
@@ -509,6 +509,10 @@ comapi_serialcfg:
or al,ah
mov ah,[FlowIgnore]
shr ah,4
+ test byte [DisplayCon],01h
+ jnz .normalconsole
+ or ah,80h
+.normalconsole:
mov P_BX,ax
clc
ret