flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Turn off NMI ???

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
milind



Joined: 15 Feb 2004
Posts: 33
milind
I found this code from one of the posts, it disables the NMI. Would this really work??

in AL,070h ;
or AL,080h ; Turn NMI off
out 070h,AL ;
Post 04 Mar 2004, 12:51
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
Ralph



Joined: 04 Oct 2003
Posts: 86
Ralph
Yes.
Post 04 Mar 2004, 17:37
View user's profile Send private message Reply with quote
Adam Kachwalla



Joined: 01 Apr 2006
Posts: 150
Adam Kachwalla
Hang on... Isn't NMI Non-Maskable Interrupt? I think that is a CPU bug, which has most likely been fixed.
Post 26 May 2007, 11:40
View user's profile Send private message Reply with quote
Japheth



Joined: 26 Oct 2004
Posts: 151
Japheth
The code above should work on most machines, but it is not 100% safe. A write to port 70h should be followed by an access to port 71h, for example:

Code:
pushf
cli
mov al, 0Fh+80h
out 70h, al
in al,71h
popf
    
Post 26 May 2007, 17:18
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
NMI means that CLI instruction doesn't prevent the processor to handle it. However, if some other chip prevents the processor's NMI pin to be asserted then you have the NMI interrupt masked Very Happy
Post 26 May 2007, 18:10
View user's profile Send private message Reply with quote
Japheth



Joined: 26 Oct 2004
Posts: 151
Japheth
> NMI means that CLI instruction doesn't prevent the processor to handle it.

That was absolutely new to me. Sad

(the "CLI" was to mask IRQs, not NMIs, in case the RTC timer /alarm has been enabled.)
Post 26 May 2007, 19:10
View user's profile Send private message Visit poster's website Reply with quote
mikegonta



Joined: 20 Nov 2005
Posts: 99
mikegonta
[ Post removed by author. ]


Last edited by mikegonta on 28 Jan 2009, 09:15; edited 2 times in total
Post 31 May 2007, 20:37
View user's profile Send private message Reply with quote
Japheth



Joined: 26 Oct 2004
Posts: 151
Japheth
> Keep in mind that this caveat was designed for the original chip and like
> many other "urban" legends is not applicable to a modern PC.

This might be true, but the OP did not indicate that the code must run on a new PC only.

> I ran the following code in Protected Mode from a boot sector on a Pentium
> for 5 minutes and it had no noticeable effect on the time.

Hm, what did you expect from this code? It loops. What effect should have been seen?
Post 03 Jun 2007, 12:17
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Sorry for bumping this thread. The code shown on this thread is the correct to disable NMI even on modern computers or not?

I would like to write my switch-to-protected-mode code, and Intel says NMIs must be disabled during the transition.
Post 24 Jan 2009, 17:51
View user's profile Send private message Reply with quote
DJ Mauretto



Joined: 14 Mar 2007
Posts: 464
Location: Rome,Italy
DJ Mauretto
Unfortunately this is Chipset specific, on Intel Chipset
you cannot read anymore Port 70h , but you can set bit 7 and
Disable All NMI sources, that is the Port 70h is Write Only, unless
you enable Alt Access Mode or use alias Port 74h ( Intel chipset specific)
anyway that bit is still valid for write operation and disable NMI Wink
Code:
; Disable NMI

mov   al,80h
out   70h,al

; Enable NMI

xor   al,al
out  70h,al
    

_________________
Nil Volentibus Arduum Razz
Post 24 Jan 2009, 18:35
View user's profile Send private message Reply with quote
mikegonta



Joined: 20 Nov 2005
Posts: 99
mikegonta
[ Post removed by author. ]


Last edited by mikegonta on 28 Jan 2009, 09:15; edited 2 times in total
Post 24 Jan 2009, 18:57
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17278
Location: In your JS exploiting you and your system
revolution
mikegonta wrote:
The chances of an NMI triggered event are slim and by definition they are non recoverable. So the simple thing is to ignore it.
Haven't you ever heard of Murphy's Law?
Post 24 Jan 2009, 19:04
View user's profile Send private message Visit poster's website Reply with quote
mikegonta



Joined: 20 Nov 2005
Posts: 99
mikegonta
[ Post removed by author. ]


Last edited by mikegonta on 28 Jan 2009, 09:15; edited 1 time in total
Post 24 Jan 2009, 19:13
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17278
Location: In your JS exploiting you and your system
revolution
mikegonta wrote:
revolution wrote:
Haven't you ever heard of Murphy's Law?
Only happens when you are Out to lunch!
But I am always Out to Lunch, so does that mean it always happens. Sounds quite bad in that case.

BTW, I am using the second to last meaning of Out to lunch in my location.
Post 24 Jan 2009, 19:21
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
In general, operating systems (both, hobby and professional) do care about NMI while switching?

Thanks for the answers!
Post 24 Jan 2009, 19:24
View user's profile Send private message Reply with quote
mikegonta



Joined: 20 Nov 2005
Posts: 99
mikegonta
[ Post removed by author. ]


Last edited by mikegonta on 28 Jan 2009, 09:16; edited 2 times in total
Post 24 Jan 2009, 21:48
View user's profile Send private message Reply with quote
Coddy41



Joined: 18 Jan 2009
Posts: 384
Location: Ohio, USA
Coddy41
So jmp $ wont pause the system on my new computer?
Post 24 Jan 2009, 22:01
View user's profile Send private message Visit poster's website Reply with quote
mikegonta



Joined: 20 Nov 2005
Posts: 99
mikegonta
[ Post removed by author. ]


Last edited by mikegonta on 28 Jan 2009, 09:16; edited 3 times in total
Post 24 Jan 2009, 22:06
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
Coddy41,

jmp $ makes CPU busy, not uninterruptable.
Post 24 Jan 2009, 22:13
View user's profile Send private message Reply with quote
Coddy41



Joined: 18 Jan 2009
Posts: 384
Location: Ohio, USA
Coddy41
Busy, hmm... --takes notes-- busy doing what?
Mike "hlt" stands for stall in
+==========+
|@@:
| sti
| hlt
| jmp @B
+==========+
And then it jumps back to @, Right????
Post 24 Jan 2009, 22:24
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.