i'm getting invalid opcode exception.
what might be the possibilities of this exception and how should i look to remove this exception.
invalid opcode
Re:invalid opcode
Obvious answers first, an invalid opcode exception occurs because you execute - an invalid opcode. The possibilities are that you have something the cpu doesn't know or you use something that doesn't exist (or is illegal, such as 0F C7 [C0-FF]), the solution is to remove those opcodes.shahzad wrote: i'm getting invalid opcode exception.
what might be the possibilities of this exception and how should i look to remove this exception.
The less obvious answer, is the point where the crash occurs even code? if it isn't, how did you get there? If it is, is it a part of the code or a misaligned access of sorts?
Re:invalid opcode
actually i used a variable
this line was causing the invalid op code exception .
but this type of declaration does not cause any error in TC,then why its causing exception when i compiled code in gcc and ran the code as a kernel.
Code: Select all
static a=0;
but this type of declaration does not cause any error in TC,then why its causing exception when i compiled code in gcc and ran the code as a kernel.
Re:invalid opcode
because you probably don't have a real big makefile system up now, all static data is put at the start of the file. This static data is initialized, so it's put in the file, but it's no code, yet you try to execute it as code (guessing here). Well, 00 is a valid code (add with modrm byte) but some of those after it are not.shahzad wrote: actually i used a variable
this line was causing the invalid op code exception .Code: Select all
static a=0;
but this type of declaration does cause any error in TC,then why its causing exception when i compiled code in gcc and ran the code as a kernel.
Use a proper linking script to avoid.
Re:invalid opcode
static <what?> a;
You need to give the compiler a proper declaration.
e.g. static int a;
Boom-
You need to give the compiler a proper declaration.
e.g. static int a;
Boom-
Re:invalid opcode
then it should be a compiler error ,but gcc didn't complaint about it.
rather processor reported that it's an error.
is it a bug in gcc?
rather processor reported that it's an error.
is it a bug in gcc?
Re:invalid opcode
If it's a bug, then it's a bug in the C standard -- "static a" is an old way of saying "static int a".