Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!ames!amdcad!sun!pitstop!sundc!seismo!uunet!munnari!otc!metro!basser!natmlab!ditsyda!evans From: evans@ditsyda.oz (Bruce Evans) Newsgroups: comp.os.minix Subject: Re: Help! Minix 1.3 & PS/2 Model 80 Message-ID: <1733@ditsyda.oz> Date: 2 Feb 89 10:33:04 GMT References: <1988@ast.cs.vu.nl> Organization: CSIRO DIT Sydney, Australia Lines: 106 in article <1988@ast.cs.vu.nl>, ast@cs.vu.nl (Andy Tanenbaum) says: > > In article <1701@ditsyda.oz> evans@ditsyda.oz (Bruce Evans) writes: >>There is an amazingly simple answer. Do nothing. > I am not sure I follow. Suppose we just remove the sending of the EOI > from interrupt(). Does this block all subsequent interrupts? Just those It blocks those on the current line and lower priority lines (== higher interrupt numbers within the same 8259). I think Steve Ackerman needed the mask fiddling because he did not remove the EOI. >>Of course an EOI must still be done in the high level task. It must now be >>a specific EOI: > Why does it have to be specific now? The generic EOI applies to the last in-service line (or maybe the highest priority line - they are usually the same). The difference is like the one between function returns and coroutine returns. I used the "simple" method for a while but now prefer the mask fiddling approach. The simple method depends too much on the native privilege levels and may cause trouble in future. Currently it may cause unnecessary (but probably negligible) delays in servicing floppy and printer interrupts. I changed the wini drivers (back) to use mask fiddling but the floppy driver still uses the simple method. They are compatible once the centralized EOI is removed. The overheads for the mask fiddling are just: (1) Every interrupt handler (i.e. the part running with processor interrupts disabled) which completely services its device must do an EOI at its start or finish. This takes just 2 instructions each in assembler. The only devices not covered by this are the disks. Here's what it looks like for tty. --- _tty_int: | Interrupt routine for terminal input. call save | save the machine state call _keyboard | process a keyboard interrupt movb al,#ENABLE | reenable int controller out INT_CTL jmp _restart | continue execution --- (2) Other handlers must set a mask bit in the interrupt handler as well. This takes 3 instructions in assembler. The high level handler must clear the mask bit every time it clears the device interrupt and expects another. Here's the wini code (slightly edited, may not run :-)). This would be cleaner if the XT and AT routines were separated and the interrupt vector initialized to the appropiate one by a decision in main(). --- _wini_int: | Interrupt routine for the winchester disk. call save | save the machine state mov ax,_pc_at | check for 2nd int controller on AT test ax,ax jnz at_wini_int xt_wini_int: in INT_CTLMASK | mask further wini interrupts using 8259 orb al,#XT_WINI_BITPOWER | 0x20 out INT_CTLMASK movb al,#ENABLE | reenable all unmasked 8259 lines out INT_CTL jmp common_wini_int at_wini_int: in INT2_MASK | mask further wini interrupts using 8259 orb al,#AT_WINI_BITPOWER | 0x40 out INT2_MASK movb al,#ENABLE | reenable both 8259's (all unmasked lines) out INT2_CTL out INT_CTL | CONNECT_IRQ is on this common_wini_int: mov _int_mess+2,*DISKINT| build message for winchester task mov ax,#_int_mess | prepare to call interrupt(WINI, &intmess) push ax | push second parameter mov ax,*WINI | prepare to push first parameter push ax | push first parameter call _interrupt | this is the call jmp _restart | continue execution --- This is the high level code for the AT. It is exactly what I'm using. --- PRIVATE int win_results() { /* Extract results from the controller after an operation, then reenable the * (slave) interrupt controller. */ int old_mask; int old_state; int r; r = old_win_results(); old_state = lock(); port_in(INT2_MASK, &old_mask); port_out(INT2_MASK, old_mask & ~(1 << (AT_WINI_IRQ & 0x07))); restore(old_state); return(r); } --- Bruce Evans evans@ditsyda.oz.au