Subject: Re: DUMMY_NOPS -- WHOA
To: None <port-i386@NetBSD.ORG>
From: D. J. Vanecek <djv-list@bedford.net>
List: port-i386
Date: 10/21/1997 19:18:33
I think we need to see what these NOPS are, first.

What they are *not* is the gratuitous nop instruction inserted
between inb or outb instructions to adjacent IO ports. They
are restricted to the 8059 PIC.

I have done some grepping and head-scratching over DUMMY_NOPS, and
think I have found all its occurences, for whatever that is worth
to those carrying on the discussion.

I find occurences of "DUMMY_NOPS" (except for Makefiles) only in
./arch/i386/i386/locore.s, where it defines two macros (see below) used by 
./arch/i386/isa/vector.s and indirectly by ./arch/i386/isa/icu.s,
which files are included by locore.s. It looks (I have looked, but not
looked till my eyes hurt), that the FASTER_NOP macro is the only
one used, and that it is used only to talk to the 8059 PIC (interrupt
controller), or to its equivalent in modern LSI chips. It would be
an old board that had discrete 8059's -- I have a 1986 vintage 286
board with them, but most >=386 seem to have LSI. I would *assume*
that anything with LSI bus/PIC chips would be fast enough not to
require the NOPs. BTW, DUMMY_NOPS, doesn't just waste time with
a nop instruction, it actually reads from port 0x84, which is
some register on the PIC, IIRC. This may have some effect on the PIC,
that I don't know about; but I have an old Intel book for it, if there
are curiosity seekers.

>From locore.s:

fdef DUMMY_NOPS       /* this will break some older machines */
#define FASTER_NOP
#define NOP
#else 
#define FASTER_NOP      pushl %eax ; inb $0x84,%al ; popl %eax
#define NOP     pushl %eax ; inb $0x84,%al ; inb $0x84,%al ; popl %eax
#endif

There are equivalent definitions of NOP in other files, but they are defined
unconditionally, and locally. These are confined to these files:

./arch/i386/stand/fdbootblk.c:#define	NOP	inb	$0x84,%al
./arch/i386/stand/srt0.c:#define	NOP	inb $0x84,%al ; inb $0x84,%al
./arch/i386/stand/wdbootblk.c:#define	NOP	inb $0x84,%al

(I notice that these do not preserve eax.)

Dave