;
; 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
SerialHead dw 0 ; Head of serial port rx buffer
SerialTail dw 0 ; Tail of serial port rx buffer
+ section .text
+
sirq_install:
pushad
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
popad
ret
-sirq_cleanup:
+sirq_cleanup_nowipe:
pushad
push ds
push es
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
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