+ if(debug)
+ printIdtr(idtr, sizeof(idtr));
+ // should normally be the case on amd64, but does not work
+ //return (0xff==idtr[9]) ? 1 : 0;
+ return (0xff==idtr[5]) ? 1 : 0;
+}
+int checkVmwareIO()
+{
+ unsigned int vmaj, vmin, magic, dout = 11;
+ __asm__ __volatile__(
+ "mov $0x564D5868, %%eax; /* magic number */"
+ "mov $0x3c6cf712, %%ebx; /* random number */"
+ "mov $0x0000000A, %%ecx; /* specifies command */"
+ "mov $0x5658, %%edx; /* VMware I/O port */"
+ "in %%dx, %%eax;"
+ "mov %%eax, %0;"
+ "mov %%ebx, %1;"
+ "mov %%ecx, %2;"
+ "mov %%edx, %3;"
+ : "=r"(vmaj), "=r"(magic), "=r"(vmin), "=r"(dout));
+#ifdef DEBUG
+ fprintf(stderr, "version: major=%x, minor=%x, magic=%x, dout=%x\n",
+ vmaj, vmin, magic, dout);
+#endif
+ return (0x564D5868 == magic) ? 1 : 0;