Skip to content

Instantly share code, notes, and snippets.

@robbmanes
Created August 17, 2021 18:49
Show Gist options
  • Save robbmanes/a7a23f6db77db9f63cc54c7ac1939217 to your computer and use it in GitHub Desktop.
Save robbmanes/a7a23f6db77db9f63cc54c7ac1939217 to your computer and use it in GitHub Desktop.
iopl syscall test
#include <stdio.h>
#include <sys/io.h>
#include <errno.h>
#define LEVEL 3
int main(int argc, char **argv)
{
int rc;
rc = iopl(LEVEL);
switch(rc) {
case -EINVAL:
printf("Incorrect level (greater than 3)\n");
break;
case -ENOSYS:
printf("iopl() call is not implemented.\n");
break;
case -EPERM:
printf("Insufficient privileges to call iopl().\n");
break;
default:
printf("Success calling iopl(): code %d\n", rc);
}
return rc;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment