xv6-65oo2/asm.h

19 lines
754 B
C
Raw Normal View History

2006-08-29 19:06:37 +00:00
//
2007-08-31 19:55:27 +00:00
// assembler macros to create x86 segments
2006-08-29 19:06:37 +00:00
//
#define SEG_NULLASM \
.word 0, 0; \
.byte 0, 0, 0, 0
2006-06-22 15:28:09 +00:00
// The 0xC0 means the limit is in 4096-byte units
// and (for executable segments) 32-bit mode.
#define SEG_ASM(type,base,lim) \
.word (((lim) >> 12) & 0xffff), ((base) & 0xffff); \
.byte (((base) >> 16) & 0xff), (0x90 | (type)), \
(0xC0 | (((lim) >> 28) & 0xf)), (((base) >> 24) & 0xff)
2006-09-06 19:08:14 +00:00
#define STA_X 0x8 // Executable segment
#define STA_W 0x2 // Writeable (non-executable segments)
#define STA_R 0x2 // Readable (executable segments)