Index | Thread | Search

From:
Stefan Fritsch <sf@sfritsch.de>
Subject:
Re: un-ifdef i8259 on amd64
To:
Crystal Kolipe <kolipe.c@exoticsilicon.com>
Cc:
tech@openbsd.org
Date:
Thu, 15 Jan 2026 16:55:47 +0100

Download raw body.

Thread
On Thu, 15 Jan 2026, Crystal Kolipe wrote:

> On Thu, Jan 15, 2026 at 11:05:53AM +0100, Stefan Fritsch wrote:
> > never defined:
> >         ICU_SPECIAL_MASK_MODE
> >         AUTO_EOI_1
> >         AUTO_EOI_2
> >         PIC_MASKDELAY
> >         MASKDELAY
> 
> The code behind MASKDELAY which is always disabled on amd64 is hardcoded and
> always present on i386:
> 
> From i386/include/i8259.h:
> 
> In #define i8259_asm_mask(num) and #define i8259_asm_unmask(num):
> 
> 	pushl	%eax							;\
> 	inb	$0x84,%al						;\
> 	popl	%eax							;\
> 
> This is just a discarded read from port 0x84.
> 
> Looking at the history of the i386 version, in the original OpenBSD commit,
> it's behind a similar #define that the amd64 code is today, and the original
> intent seems to have been for the delay not to be compiled in by default even
> on i386.
> 
> Subsequent code tidying seems to have inverted the logic for it.

I don't think the tidying has changed it. If DUMMY_NOPS was not defined, 
PIC_MASKDELAY would be defined. The DUMMY_NOPS option was not enabled by 
default:

#options       DUMMY_NOPS      # speed hack; recommended

Therefore when removing DUMMY_NOPS, it preserved the old code by always 
enabling the code behind PIC_MASKDELAY. Or am I missing something? See git 
commit 45caead02b48a "Nuke DUMMY_NOPS, cleanup."

amd64 never had DUMMY_NOPS.

> Was this change in i386 intentional?