Advertisement
jay_lltv

reproducer.c

Sep 9th, 2021
1,694
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <unistd.h>
  3. #include <sys/io.h>
  4. #include <stdio.h>
  5. #include <limits.h>
  6.  
  7. int main(int argc, char **argv)
  8. {
  9.     FILE *fh = fopen("testnum", "w");
  10.     int start = argc > 1 ? atoi(argv[1]) : 0;
  11.     int stop = argc > 2 ? atoi(argv[2]) : INT_MAX;
  12.     int iter;
  13.  
  14.     iopl(3);
  15.     for (iter = start; iter < stop; iter++) {
  16.         int i;
  17.  
  18.         fprintf(fh, "%d\n", iter);
  19.         fprintf(stderr, "%d\n", iter);
  20.         fflush(fh);
  21.         fdatasync(fileno(fh));
  22.  
  23.         srand(iter);
  24.         for (i=0; i< 100000; i++) {
  25.             int a, b;
  26.             a = rand()%0x100;
  27.             b = 0x3c0 + (rand()%0x20);
  28.             outb(a,b);
  29.  
  30.         }
  31.  
  32.     }
  33.     return 0;
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement