2006-12-21 08:22:07 -05:00
|
|
|
|
2006-12-16 18:15:38 -05:00
|
|
|
#include <stdio.h>
|
2006-12-21 08:22:07 -05:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
typedef struct pcb{
|
|
|
|
int counter;
|
|
|
|
} pcb;
|
|
|
|
|
|
|
|
extern void interrupt_mem(pcb*);
|
|
|
|
extern void interrupt_reg(int);
|
2006-12-16 18:15:38 -05:00
|
|
|
|
2006-12-21 08:22:07 -05:00
|
|
|
void usage(char* name){
|
|
|
|
fprintf(stderr, "Usage: %s [mem|reg]\n", name);
|
|
|
|
exit(-1);
|
2006-12-16 18:15:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char** argv){
|
2006-12-21 08:22:07 -05:00
|
|
|
int most_positive_number = 0x7FFFFFFF;
|
|
|
|
if(argc != 2) usage(argv[0]);
|
|
|
|
if(strcmp(argv[1], "reg") == 0){
|
|
|
|
interrupt_reg(most_positive_number);
|
|
|
|
} else if(strcmp(argv[1], "mem") == 0){
|
|
|
|
pcb x;
|
|
|
|
x.counter = most_positive_number;
|
|
|
|
interrupt_mem(&x);
|
|
|
|
} else {
|
|
|
|
usage(argv[0]);
|
|
|
|
}
|
|
|
|
return 0;
|
2006-12-16 18:15:38 -05:00
|
|
|
}
|