It's been a long time since I last posted. Everything was fine after then. Now, I've encounterd the 'invalid opcode' fault. This happens only when I install the mouse handler. Sometimes, the mouse handler works fine and then suddenly generates the 'invalid opcode' fault in the middle after the mouse cursor is moved for some time.
To my surprise, this happens only when I run my OS under the AMD processor on real hardware(I've tested it under AMD duron and AMD Turion processor and both on my laptops). Amazingly, there is no problem at all when I run my OS under Bochs, Qemu, Virtual PC or under Intel Processor on real hardware. So far I've been able to figure out that the problem is the handler code(adapted from sanik's mouse driver) and as soon as I remove the mouse handler code, there's no Invalid Opcode Fault.
I'm currently trying to debug the code to see if there's some problem in the binary generated code but I'm facing difficulty to figure out the problem because of the huge bunch of the handler code.
If someone knows the workaround for this, please help!
Looking forward for help.
Invalid Opcode[SOLVED]
Invalid Opcode[SOLVED]
Last edited by Chandra on Thu Nov 25, 2010 11:51 pm, edited 1 time in total.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Invalid Opcode
As far as my crystal ball goes: Invalid opcode is almost always caused by a bad instruction pointer, which in turn is usually caused by stack corruption so check your ISR and see if it overwrites anything. With the lack of information provided guesswork is the best we can do.
Re: Invalid Opcode
Thank you very much. Yes, the problem was with the stack. Now I've reserved 8 kb of stack space and the code is working fine. Thank you very much once again.
Oh! One more question. How did it previously work fine with the Intel processor and the emulators while it didn't work with AMD processors. Please let me know.
Best Regards,
Chandra
Oh! One more question. How did it previously work fine with the Intel processor and the emulators while it didn't work with AMD processors. Please let me know.
Best Regards,
Chandra
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: Invalid Opcode
My guess: Unallocated address space generally reads as FFh. On Intel processors, this is an undocumented NOP (to placate some BIOS manufacturers who, years ago, had issues with puting their BIOS ROMs at the top of the address space; this would cause the boot process to quickly wrap to 0h. AMD don't implement this hack (they have never needed to)
Re: Invalid Opcode
Oh yes, this seems to be useful. Possibly this is the case with the emulators too, not only with the intel processors; if I am not wrong. Anyway, thanks.Owen wrote:My guess: Unallocated address space generally reads as FFh. On Intel processors, this is an undocumented NOP (to placate some BIOS manufacturers who, years ago, had issues with puting their BIOS ROMs at the top of the address space; this would cause the boot process to quickly wrap to 0h. AMD don't implement this hack (they have never needed to)
Programming is not about using a language to solve a problem, it's about using logic to find a solution !