iopl.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifdef __NetBSD__
  2. # include <sys/types.h>
  3. # include <machine/pio.h>
  4. # include <machine/sysarch.h>
  5. #else
  6. # if defined(__linux__)
  7. /* Can't because <sys/iopl.h> provides conflicting inb, outb, etc
  8. * # include <sys/io.h>
  9. */
  10. int iopl(int level);
  11. # endif
  12. # if defined(SVR4) && defined(i386)
  13. # include <sys/types.h>
  14. # ifdef NCR
  15. /* broken NCR <sys/sysi86.h> */
  16. # define __STDC
  17. # include <sys/sysi86.h>
  18. # undef __STDC
  19. # else
  20. # include <sys/sysi86.h>
  21. # endif
  22. # ifdef SVR4
  23. # if !defined(sun)
  24. # include <sys/seg.h>
  25. # endif
  26. # endif
  27. # include <sys/v86.h>
  28. # if defined(sun)
  29. # include <sys/psw.h>
  30. # endif
  31. # endif
  32. # include "AsmMacros.h"
  33. #endif /* NetBSD */
  34. #include <unistd.h>
  35. #include <stdio.h>
  36. #include <stdlib.h>
  37. #ifdef __NetBSD__
  38. # define SET_IOPL() i386_iopl(3)
  39. # define RESET_IOPL() i386_iopl(0)
  40. #else
  41. # if defined(SVR4) && defined(i386)
  42. # ifndef SI86IOPL
  43. # define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
  44. # define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
  45. # else
  46. # define SET_IOPL() sysi86(SI86IOPL,3)
  47. # define RESET_IOPL() sysi86(SI86IOPL,0)
  48. # endif
  49. # else
  50. # ifdef linux
  51. # define SET_IOPL() iopl(3)
  52. # define RESET_IOPL() iopl(0)
  53. # else
  54. # define SET_IOPL() (void)0
  55. # define RESET_IOPL() (void)0
  56. # endif
  57. # endif
  58. #endif