I have a oneline C program:
int main(){asm volatile ("INT $0x06"::);}
Once compiled, I execute it by
sudo ./a.out
However, it does not throw invalid instruction error (as expected, since 0x06
is invalid instruction interrupt). Instead, in dmesg
, it switches to general protection trap...
[ 2898.849785] traps: a.out[2534] general protection ip:4004f1 sp:7fffa949c8f0 error:32 in a.out[400000+1000]
My question is: what is the right way to throw an interrupt in kernel space?
My platform is Ubuntu 14.04 on linux 3.13 and x86_64.