《操作系统》的实验代码。

26 rindas
961 B

pirms 12 gadiem
  1. #ifndef __BOOT_ASM_H__
  2. #define __BOOT_ASM_H__
  3. /* Assembler macros to create x86 segments */
  4. /* Normal segment */
  5. #define SEG_NULLASM \
  6. .word 0, 0; \
  7. .byte 0, 0, 0, 0
  8. #define SEG_ASM(type,base,lim) \
  9. .word (((lim) >> 12) & 0xffff), ((base) & 0xffff); \
  10. .byte (((base) >> 16) & 0xff), (0x90 | (type)), \
  11. (0xC0 | (((lim) >> 28) & 0xf)), (((base) >> 24) & 0xff)
  12. /* Application segment type bits */
  13. #define STA_X 0x8 // Executable segment
  14. #define STA_E 0x4 // Expand down (non-executable segments)
  15. #define STA_C 0x4 // Conforming code segment (executable only)
  16. #define STA_W 0x2 // Writeable (non-executable segments)
  17. #define STA_R 0x2 // Readable (executable segments)
  18. #define STA_A 0x1 // Accessed
  19. #endif /* !__BOOT_ASM_H__ */