x86.c 718 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <signal.h>
  4. #include <unistd.h>
  5. void nope()
  6. {
  7. exit(1);
  8. }
  9. int main()
  10. {
  11. unsigned long x[4];
  12. unsigned long y[4];
  13. int i;
  14. int j;
  15. char c;
  16. signal(SIGILL,nope);
  17. x[0] = 0;
  18. x[1] = 0;
  19. x[2] = 0;
  20. x[3] = 0;
  21. asm volatile(".byte 15;.byte 162" : "=a"(x[0]),"=b"(x[1]),"=c"(x[3]),"=d"(x[2]) : "0"(0) );
  22. if (!x[0]) return 0;
  23. asm volatile(".byte 15;.byte 162" : "=a"(y[0]),"=b"(y[1]),"=c"(y[2]),"=d"(y[3]) : "0"(1) );
  24. for (i = 1;i < 4;++i)
  25. for (j = 0;j < 4;++j) {
  26. c = x[i] >> (8 * j);
  27. if (c < 32) c = 32;
  28. if (c > 126) c = 126;
  29. putchar(c);
  30. }
  31. printf("-%08x-%08x\n",(unsigned int) y[0],(unsigned int) y[3]);
  32. return 0;
  33. }