《操作系统》的实验代码。
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.

28 lines
618 B

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