summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-23 19:20:01 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-23 19:20:01 -0700
commitee89890b4008c40bd7d6ea5ddb1016b47fee7bbf (patch)
treed32ce4281873933fb6148295ac5a427e9884aec5
parent2b052241f002e2cfe3fed022e56bbc7fb532939c (diff)
downloadsyslinux-ee89890b4008c40bd7d6ea5ddb1016b47fee7bbf.tar.gz
core: don't flush the serial port queue for a serial command
Don't flush the serial port queue when encountering a "serial" command. We don't actually want to lose data due to a repeated "serial", since it's quite likely it's exactly the same as before. Do flush the queue on hardware cleanup, however. Also fix some minor bugs, including a bunch of code in the .data segment. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--core/parseconfig.inc2
-rw-r--r--core/serirq.inc31
2 files changed, 20 insertions, 13 deletions
diff --git a/core/parseconfig.inc b/core/parseconfig.inc
index efa41d17..65d71c95 100644
--- a/core/parseconfig.inc
+++ b/core/parseconfig.inc
@@ -224,7 +224,7 @@ pc_serial: call getint
;
; Begin code to actually set up the serial port
;
- call sirq_cleanup ; Cleanup existing IRQ handler
+ call sirq_cleanup_nowipe ; Cleanup existing IRQ handler
lea dx,[di+3] ; DX -> LCR
mov al,83h ; Enable DLAB
diff --git a/core/serirq.inc b/core/serirq.inc
index 8b04728a..579c42b4 100644
--- a/core/serirq.inc
+++ b/core/serirq.inc
@@ -91,6 +91,8 @@ SerialIRQPort dw 0 ; Serial port w IRQ service
SerialHead dw 0 ; Head of serial port rx buffer
SerialTail dw 0 ; Tail of serial port rx buffer
+ section .text
+
sirq_install:
pushad
@@ -124,8 +126,7 @@ sirq_install:
mov [SerialIRQPort],bx
lea dx,[bx+5] ; DX -> LCR
- in al,dx
- and al,7Fh ; Clear DLAB (should already be...)
+ mov al,03h ; Clear DLAB (should already be...)
slow_out dx,al
lea dx,[bx+1] ; DX -> IER
@@ -135,7 +136,7 @@ sirq_install:
popad
ret
-sirq_cleanup:
+sirq_cleanup_nowipe:
pushad
push ds
push es
@@ -148,8 +149,7 @@ sirq_cleanup:
jz .done
lea dx,[bx+5] ; DX -> LCR
- in al,dx
- and al,7Fh ; Clear DLAB (should already be...)
+ mov al,03h ; Clear DLAB (should already be...)
slow_out dx,al
lea dx,[bx+1] ; DX -> IER
@@ -165,19 +165,26 @@ sirq_cleanup:
mov cx,8
rep movsd
+.done:
+ pop es
+ pop ds
+ popad
+ ret
+
+sirq_cleanup:
+ call sirq_cleanup_nowipe
+ pushad
+ push es
; Just in case it might contain a password, erase the
; serial port receive buffer...
- mov [SerialIRQPort],ax
- mov [SerialHead],eax
- mov cx,aux_seg + (aux.serial >> 4)
- mov es,cx
+ mov ax,aux_seg + (aux.serial >> 4)
+ mov es,ax
+ xor eax,eax
+ mov [cs:SerialHead],eax
mov cx,serial_buf_size >> 2
xor di,di
rep stosd
-
-.done:
pop es
- pop ds
popad
ret