I am trying to use MONITOR/MWAIT in a user-level application running on Linux 2.6.5. But, I'm getting an Illegal Instruction exception on them. I used CPUID to verify that MONITOR/MWAIT are supported, which, according to the Intel IA-32 manual, means that unconditional execution is supported at privilege level 0 and conditional execution is supported at privilege levels 1 through 3. So, what can I do to enable MONITOR/MWAIT support in a user-level app?
I too am trying to get this to work in userspace. CPUID tells me that the feature is supported unconditionally, but I get the same illegal instruction error message. Also, I greped through the linux source code of the version that I'm running, and I couldn't find any code that disables it. What could be wrong?
I understand the implications of doing this in user space. I'm doing this purely as a feasibility study.