I am trying to create a program which generates an illegal instruction exception for demonstration purposes.
There seems to be a simple solution to my problem:
cmpxchgl %edx, %ecx
But rather than giving me an exception at runtime, the compiler (FASM) doesn't want to compile the code. It says "Illegal instruction" (and that's probably right, actually nice to warn me before).
Any solution for getting an illegal instruction exception is fine for me, so you could
a) point me to another compiler which simply compiles the code
b) apply a workaround for my command
c) propose a completely different command (should be simple, oneliners preferred)
Simple: ud2
(0F 0B
)
Its entire purpose is to raise an Invalid Opcode Exception.