"0xC0000096: Privileged instruction" 
Author Message
 "0xC0000096: Privileged instruction"

Quote:
> I've got a "0xC0000096: Privileged instruction"
> when trying to execute :

> (s0, s1, s2 & dst are void* pixel arrays)

> _asm{

> mov eax,s0
> mov ebx,s1
> mov ecx,s2
> mov edx,dst
> mov edi,width

> shr edi,1
> sub edi,1

> pxor        xmm0,xmm0
> movdqa      [edx],xmm0 // => "0xC0000096: Privileged instruction"
> ...

> but when I move the second asm line a few lines far (after the fifth
> line for example), the error occurs at the following movdqa
> instruction!

> someone has an idea ?

I think Windows will generate a 0xC0000096 for privileged instructions and
undefined opcodes. However, those should be defined for any MMX-enabled CPU.
Are you sure that you didn't somehow jump into the middle of an instruction?

Which OS are you running? What CPU are you testing this on? What happens
when you comment out all the SSE code?

-Matt

-------------------------------------------------------------------------------

Thank you Matt for a so quick response...
I'm using Windows XP Professionnal on a Pentium4 1.5Ghz, compile with
Visual C++ 7.0, and my asm code is a little part of a filtering
service, used for optimize the process...
When I comment all SSE code, the software is running good. I don't use
any jump instruction or else, it's the beginning of the asm code...
Any idea ?

Thanks

Pierre



Tue, 20 Sep 2005 22:50:38 GMT  
 "0xC0000096: Privileged instruction"

Quote:
> > I've got a "0xC0000096: Privileged instruction"
> > when trying to execute :

> > (s0, s1, s2 & dst are void* pixel arrays)

> > _asm{

> > mov eax,s0
> > mov ebx,s1
> > mov ecx,s2
> > mov edx,dst
> > mov edi,width

> > shr edi,1
> > sub edi,1

> > pxor        xmm0,xmm0
> > movdqa      [edx],xmm0 // => "0xC0000096: Privileged instruction"
> > ...

> > but when I move the second asm line a few lines far (after the fifth
> > line for example), the error occurs at the following movdqa
> > instruction!

> > someone has an idea ?

> I think Windows will generate a 0xC0000096 for privileged instructions and
> undefined opcodes. However, those should be defined for any MMX-enabled
CPU.
> Are you sure that you didn't somehow jump into the middle of an
instruction?

> Which OS are you running? What CPU are you testing this on? What happens
> when you comment out all the SSE code?

> -Matt

> --------------------------------------------------------------------------
-----

> Thank you Matt for a so quick response...
> I'm using Windows XP Professionnal on a Pentium4 1.5Ghz, compile with
> Visual C++ 7.0, and my asm code is a little part of a filtering
> service, used for optimize the process...
> When I comment all SSE code, the software is running good. I don't use
> any jump instruction or else, it's the beginning of the asm code...
> Any idea ?

> Thanks

> Pierre

Some quick tests confirmed my suspicions. Windows XP will generate
0xC0000096 (Privileged Instruction) for misaligned memory access. I'm
willing to bet that edx isn't 16-byte aligned, and you're getting an
exception for misaligned access. Try using movdqu instead of movdqa. If it
works, that's your problem. If that is in fact the problem, you'll probably
want to align edx so you can read full 16-byte strides.

-Matt



Wed, 21 Sep 2005 06:28:30 GMT  
 "0xC0000096: Privileged instruction"

Quote:
> Some quick tests confirmed my suspicions. Windows XP will generate
> 0xC0000096 (Privileged Instruction) for misaligned memory access. I'm
> willing to bet that edx isn't 16-byte aligned, and you're getting an
> exception for misaligned access. Try using movdqu instead of movdqa. If it
> works, that's your problem. If that is in fact the problem, you'll
probably
> want to align edx so you can read full 16-byte strides.

Does Windows use the alignment check?? I have never received Priveleged
Insruction error when using misaligned memory access.

Ivan



Sun, 09 Oct 2005 16:50:51 GMT  
 "0xC0000096: Privileged instruction"

Quote:
> > Some quick tests confirmed my suspicions. Windows XP will generate
> > 0xC0000096 (Privileged Instruction) for misaligned memory access. I'm
> > willing to bet that edx isn't 16-byte aligned, and you're getting an
> > exception for misaligned access. Try using movdqu instead of movdqa. If
it
> > works, that's your problem. If that is in fact the problem, you'll
> probably
> > want to align edx so you can read full 16-byte strides.

> Does Windows use the alignment check?? I have never received Priveleged
> Insruction error when using misaligned memory access.

> Ivan

No, but the movdqa instruction requires 16-byte aligned data. Try this on a
P4:

int main(void)
{
 int buf[17];
 int i;

 __asm movdqa xmm0, [buf]
 __asm movdqa xmm0, [buf+1]

 return 0;

Quote:
}

You will get the illegal instruction exception. Note that when you declare
buf with __declspec(align(16)) and only make the first access, the exception
goes away.

-Matt



Mon, 10 Oct 2005 14:03:54 GMT  
 "0xC0000096: Privileged instruction"
Sorry, after posting previous message I found in IA-32 manual that CPU
raises a GPF when some SSE instructions try to access memory operand not
aligned by 16 bytes, irrelevant to state of CR0.AM and EFLAGS.AC. Never
mind. But it was much more sensible for Windows to raise 0x80000002
(Datatype Misalignment) in his case.

Ivan



Mon, 10 Oct 2005 14:55:14 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. strange "0xC0000096: Privileged instruction" !

2. string.join(["Tk 4.2p2", "Python 1.4", "Win32", "free"], "for")

3. Availability of "N3" instructions

4. P4's "PAUSE" instruction

5. "out" instruction

6. "OUT" Instruction

7. Pentium III "katmai" instructions

8. MASM instruction "s" bit question

9. Instruction like "if"

10. BEGIN{want[]={"s1o", "s2o", "s2q", "s3q"}

11. Parsing ""D""?

12. "Fifth", "Forth", zai nar?

 

 
Powered by phpBB® Forum Software