《操作系统》的实验代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 line
643 B

10 年之前
  1. #include <stdio.h>
  2. int
  3. main(void) {
  4. printf("# handler\n");
  5. printf(".text\n");
  6. printf(".globl __alltraps\n");
  7. int i;
  8. for (i = 0; i < 256; i ++) {
  9. printf(".globl vector%d\n", i);
  10. printf("vector%d:\n", i);
  11. if ((i < 8 || i > 14) && i != 17) {
  12. printf(" pushl $0\n");
  13. }
  14. printf(" pushl $%d\n", i);
  15. printf(" jmp __alltraps\n");
  16. }
  17. printf("\n");
  18. printf("# vector table\n");
  19. printf(".data\n");
  20. printf(".globl __vectors\n");
  21. printf("__vectors:\n");
  22. for (i = 0; i < 256; i ++) {
  23. printf(" .long vector%d\n", i);
  24. }
  25. return 0;
  26. }