Page 1 of 1
NOPs in Entering Long Mode Article
Posted: Fri Jan 06, 2017 9:59 am
by matt11235
I was reading through
Entering Long Mode Directly on the Wiki and I noticed after sending the commands to disable the PIC there are two nop instructions.
Code: Select all
mov al, 0xFF ; Out 0xFF to 0xA1 and 0x21 to disable all IRQs.
out 0xA1, al
out 0x21, al
nop
nop
Is this in lieu of something like IO_WAIT seen in other articles, just in case the PIC can't keep up? Or does it serve another purpose?
Thanks
Re: NOPs in Entering Long Mode Article
Posted: Fri Jan 06, 2017 10:12 am
by BrightLight
They are there in place of an iowait() function. They give the PICs time to process the data they receive, as the CPU is definitely much faster than any other hardware on-board. IMHO, I prefer to delay using two "out 0x80, al" instructions instead of "nop" or "pause".
Re: NOPs in Entering Long Mode Article
Posted: Fri Jan 06, 2017 10:27 am
by matt11235
omarrx024 wrote:They are there in place of an iowait() function. They give the PICs time to process the data they receive, as the CPU is definitely much faster than any other hardware on-board. IMHO, I prefer to delay using two "out 0x80, al" instructions instead of "nop" or "pause".
Thanks!
Re: NOPs in Entering Long Mode Article
Posted: Fri Jan 06, 2017 10:53 am
by Antti
I am almost sure that they were put there as a two-instruction window for handling interrupts that may be "on their way" before having a null IDT. There is a small difference between an "IO_WAIT" and an "instruction window with IRQs disabled but interrupts enabled", although they both may be intertwined.