The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ookami on February 15, 2011, 08:54:43 AM

Title: Interrupts and 32 bits
Post by: ookami on February 15, 2011, 08:54:43 AM
I read in one topic that we can't use interrupts in 32 bits mode. I have two questions :

- Why ?
- So in the 32 bits mode the INT instruction is totally useless ?

Thanks
Title: Re: Interrupts and 32 bits
Post by: hutch-- on February 15, 2011, 10:31:41 AM
Yes unless you are writing very low level drivers for ring0.

Use the Windows API functions.
Title: Re: Interrupts and 32 bits
Post by: japheth on February 15, 2011, 11:26:39 AM
Quote from: ookami on February 15, 2011, 08:54:43 AM
I read in one topic that we can't use interrupts in 32 bits mode. I have two questions :

- Why ?
- So in the 32 bits mode the INT instruction is totally useless ?

You can use the INT instruction in 32-bits of course. The problem is that many ints won't do anything else than a GPF. Exceptions are: INT 3 (which is similar to DebugBreak()), INT 2Eh (which is/was used to call the "native API"), ...

So the INT instruction is not totally useless, but just not used that often anymore.
Title: Re: Interrupts and 32 bits
Post by: ookami on February 15, 2011, 12:13:58 PM
Thank you. :U

But why does that make a GPF ? What exactly the problem ?
Title: Re: Interrupts and 32 bits
Post by: FORTRANS on February 15, 2011, 01:47:55 PM
Hi,

   Why?  Because the people that wrote Windows as a 32-bit
protected mode operating system decided to use CALL to
access the API rather than using INT.  So an interrupt is
generally just not supported.  And if it is not supported, it
is an error.  GPF.

   To a different why, DOS used INT to access its various
functions.  As DOS went through newer versions and both
Microsoft and third parties added functions, the interrupt
"chain" became rather complex and "slow".  And that is a
possible explanation for not wanting to use interrupts for
the more complex API of Windows.  Though that is just
a guess of course.

Cheers,

Steve N.
Title: Re: Interrupts and 32 bits
Post by: dedndave on February 15, 2011, 01:49:31 PM
privilege level   :P
Title: Re: Interrupts and 32 bits
Post by: Magnum on February 15, 2011, 02:31:04 PM
http://www.informit.com/articles/article.aspx?p=22442

I can't run this code right now cuz I am a Vista System.

NtQuerySystemInformation:
    mov   eax, 97h
    lea   edx, [esp+4]
    int   2Eh
    ret   10h
Title: Re: Interrupts and 32 bits
Post by: ookami on February 15, 2011, 11:40:17 PM
Thank you everybody !