os_kernel_lab/labcodes/lab2/tools/vector.c
2013-09-17 22:21:48 +08:00

30 lines
643 B
C

#include <stdio.h>
int
main(void) {
printf("# handler\n");
printf(".text\n");
printf(".globl __alltraps\n");
int i;
for (i = 0; i < 256; i ++) {
printf(".globl vector%d\n", i);
printf("vector%d:\n", i);
if ((i < 8 || i > 14) && i != 17) {
printf(" pushl $0\n");
}
printf(" pushl $%d\n", i);
printf(" jmp __alltraps\n");
}
printf("\n");
printf("# vector table\n");
printf(".data\n");
printf(".globl __vectors\n");
printf("__vectors:\n");
for (i = 0; i < 256; i ++) {
printf(" .long vector%d\n", i);
}
return 0;
}