OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Mar 29, 2024 6:32 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: NOPs in Entering Long Mode Article
PostPosted: Fri Jan 06, 2017 9:59 am 
Offline
Member
Member
User avatar

Joined: Tue Aug 02, 2016 1:52 pm
Posts: 286
Location: East Riding of Yorkshire, UK
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:
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

_________________
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum


Top
 Profile  
 
 Post subject: Re: NOPs in Entering Long Mode Article
PostPosted: Fri Jan 06, 2017 10:12 am 
Offline
Member
Member
User avatar

Joined: Sat Dec 27, 2014 9:11 am
Posts: 901
Location: Maadi, Cairo, Egypt
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".

_________________
You know your OS is advanced when you stop using the Intel programming guide as a reference.


Top
 Profile  
 
 Post subject: Re: NOPs in Entering Long Mode Article
PostPosted: Fri Jan 06, 2017 10:27 am 
Offline
Member
Member
User avatar

Joined: Tue Aug 02, 2016 1:52 pm
Posts: 286
Location: East Riding of Yorkshire, UK
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!

_________________
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum


Top
 Profile  
 
 Post subject: Re: NOPs in Entering Long Mode Article
PostPosted: Fri Jan 06, 2017 10:53 am 
Offline
Member
Member

Joined: Thu Jul 05, 2012 5:12 am
Posts: 923
Location: Finland
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.

_________________
Undefined behavior since 2012


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Majestic-12 [Bot] and 180 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group