《操作系统》的实验代码。
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

44 行
873 B

  1. #include <memlayout.h>
  2. # vectors.S sends all traps here.
  3. .text
  4. .globl __alltraps
  5. __alltraps:
  6. # push registers to build a trap frame
  7. # therefore make the stack look like a struct trapframe
  8. pushl %ds
  9. pushl %es
  10. pushl %fs
  11. pushl %gs
  12. pushal
  13. # load GD_KDATA into %ds and %es to set up data segments for kernel
  14. movl $GD_KDATA, %eax
  15. movw %ax, %ds
  16. movw %ax, %es
  17. # push %esp to pass a pointer to the trapframe as an argument to trap()
  18. pushl %esp
  19. # call trap(tf), where tf=%esp
  20. call trap
  21. # pop the pushed stack pointer
  22. popl %esp
  23. # return falls through to trapret...
  24. .globl __trapret
  25. __trapret:
  26. # restore registers from stack
  27. popal
  28. # restore %ds, %es, %fs and %gs
  29. popl %gs
  30. popl %fs
  31. popl %es
  32. popl %ds
  33. # get rid of the trap number and error code
  34. addl $0x8, %esp
  35. iret