Subject: Re: PCVT
To: None <>
From: Holger Veit <>
List: current-users
Date: 04/05/1994 10:11:03
> The problem seems to be the same everywhere: when you switch vt's, what 
> happens is
> 	- protect against irq's by doing spltty()
> 	- copy video memory to kernel memory (old vt)
> 	- copy kernel memory to video memory (new vt)
> 	- release protection by doing splx()
> The protection is neccesary to protect against keyboard interrupts while
> copying memory, obviously this also masks serial port interrupts which is
> the cause of the sio overflow problem.

Copying video mem <-> kernel mem is a very time consuming operation
because video memory access has many more waitstates than RAM.
Even with "direct mapping" and VLB the problem remains (although less
severe). Some old video cards without real dualport memory even delay 
accesses to video memory until a hor/vert blanking gap. Masking tty
irq's during that time will certainly cause data loss.

The question is why you want to mask interrupts at all during the copy
process. If it is solely speed concerns, the second solution below
won't help, because the time to process sio -> tty queue events will
still cause time even with a separate spl level.
Disabling kbd irqs (the first solution) is critical due to the whole
keyboard code mess, I agree.
But why don't you provide a semaphore like 'in_vty_switch', that is toggled
(in a spltty/splx critical region) for a vt switch and suspend
kbd queueing, hotkey processing and video write (by pcwrite/term emu/fontload) 
while this flag is active?

> The problem can be solved in two ways, first, drop the spltty/splx pair and
> disable keyboard interrupts by reconfiguring the 8042 keyboard controller
> on the mainboard. I avoided this because it creates one more piece of code
> which accesses the @#$%^&-keyboard area ....
> A second solution could be to create a (new ?) splkbd() routine, which just
> disables the keyboard irq so serial interrupts can be processed while switching
> vt's. Perhaps someone with more insight and understanding of the interrupt
> system can comment on this !
> hellmuth
> -- 
> Hellmuth Michaelis                                    

         Dr. Holger Veit                   | INTERNET:
|  |   / GMD-SET German National Research  | Phone: (+49) 2241 14 2448
|__|  /  Center for Computer Science       | Fax:   (+49) 2241 14 2342
|  | /   Schloss Birlinghoven              | Had a nightmare yesterday:
|  |/    53754 St. Augustin, Germany       | My system started up with
                                           | ... Booting vmunix.el ...