added base src
[xv6-db.git] / asm.h
blob68210d788b3cf1868c98fb277cd7c79729f69794
1 //
2 // assembler macros to create x86 segments
3 //
5 #define SEG_NULLASM \
6 .word 0, 0; \
7 .byte 0, 0, 0, 0
9 // The 0xC0 means the limit is in 4096-byte units
10 // and (for executable segments) 32-bit mode.
11 #define SEG_ASM(type,base,lim) \
12 .word (((lim) >> 12) & 0xffff), ((base) & 0xffff); \
13 .byte (((base) >> 16) & 0xff), (0x90 | (type)), \
14 (0xC0 | (((lim) >> 28) & 0xf)), (((base) >> 24) & 0xff)
16 #define STA_X 0x8 // Executable segment
17 #define STA_E 0x4 // Expand down (non-executable segments)
18 #define STA_C 0x4 // Conforming code segment (executable only)
19 #define STA_W 0x2 // Writeable (non-executable segments)
20 #define STA_R 0x2 // Readable (executable segments)
21 #define STA_A 0x1 // Accessed