summaryrefslogtreecommitdiff
path: root/mmu.h
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2011-08-08 13:30:08 -0400
committerFrans Kaashoek <[email protected]>2011-08-08 13:30:08 -0400
commita56c8d609b24e4c1c3a8a5bacdced6ae53376ee2 (patch)
tree9d049eae2080a7c330fb7ac3ec9ff6e557a310e4 /mmu.h
parent11b7438b1046eecca6135b52ddbe686008099fa5 (diff)
downloadxv6-labs-a56c8d609b24e4c1c3a8a5bacdced6ae53376ee2.tar.gz
xv6-labs-a56c8d609b24e4c1c3a8a5bacdced6ae53376ee2.tar.bz2
xv6-labs-a56c8d609b24e4c1c3a8a5bacdced6ae53376ee2.zip
One definition of several macros and constants
Diffstat (limited to 'mmu.h')
-rw-r--r--mmu.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/mmu.h b/mmu.h
index 86879d2..3e46f41 100644
--- a/mmu.h
+++ b/mmu.h
@@ -37,7 +37,15 @@
#define CR0_CD 0x40000000 // Cache Disable
#define CR0_PG 0x80000000 // Paging
+#define SEG_KCODE 1 // kernel code
+#define SEG_KDATA 2 // kernel data+stack
+#define SEG_KCPU 3 // kernel per-cpu data
+#define SEG_UCODE 4 // user code
+#define SEG_UDATA 5 // user data+stack
+#define SEG_TSS 6 // this process's task state
+
//PAGEBREAK!
+#ifndef __ASSEMBLER__
// Segment Descriptor
struct segdesc {
uint lim_15_0 : 16; // Low bits of segment limit
@@ -64,6 +72,7 @@ struct segdesc {
{ (lim) & 0xffff, (uint)(base) & 0xffff, \
((uint)(base) >> 16) & 0xff, type, 1, dpl, 1, \
(uint)(lim) >> 16, 0, 0, 1, 0, (uint)(base) >> 24 }
+#endif
#define DPL_USER 0x3 // User DPL
@@ -130,6 +139,7 @@ struct segdesc {
// Address in page table or page directory entry
#define PTE_ADDR(pte) ((uint)(pte) & ~0xFFF)
+#ifndef __ASSEMBLER__
typedef uint pte_t;
// Task state segment format
@@ -208,3 +218,4 @@ struct gatedesc {
(gate).off_31_16 = (uint)(off) >> 16; \
}
+#endif