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

10 years ago
9 years ago
10 years ago
  1. #ifndef __KERN_MM_MEMLAYOUT_H__
  2. #define __KERN_MM_MEMLAYOUT_H__
  3. /* This file contains the definitions for memory management in our OS. */
  4. /* global segment number */
  5. #define SEG_KTEXT 1
  6. #define SEG_KDATA 2
  7. #define SEG_UTEXT 3
  8. #define SEG_UDATA 4
  9. #define SEG_TSS 5
  10. /* global descriptor numbers */
  11. #define GD_KTEXT ((SEG_KTEXT) << 3) // kernel text
  12. #define GD_KDATA ((SEG_KDATA) << 3) // kernel data
  13. #define GD_UTEXT ((SEG_UTEXT) << 3) // user text
  14. #define GD_UDATA ((SEG_UDATA) << 3) // user data
  15. #define GD_TSS ((SEG_TSS) << 3) // task segment selector
  16. #define DPL_KERNEL (0)
  17. #define DPL_USER (3)
  18. #define KERNEL_CS ((GD_KTEXT) | DPL_KERNEL)
  19. #define KERNEL_DS ((GD_KDATA) | DPL_KERNEL)
  20. #define USER_CS ((GD_UTEXT) | DPL_USER)
  21. #define USER_DS ((GD_UDATA) | DPL_USER)
  22. #endif /* !__KERN_MM_MEMLAYOUT_H__ */