kern
diff src/segm.c @ 8:78d5c304ddd0
minor changes
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 16 Feb 2011 07:50:25 +0200 |
parents | 611b2d66420b |
children | b11a86695493 |
line diff
1.1 --- a/src/segm.c Wed Feb 16 07:26:03 2011 +0200 1.2 +++ b/src/segm.c Wed Feb 16 07:50:25 2011 +0200 1.3 @@ -1,6 +1,7 @@ 1.4 #include <string.h> 1.5 #include "segm.h" 1.6 1.7 +/* bits for the 3rd 16bt part of the descriptor */ 1.8 #define BIT_ACCESSED (1 << 8) 1.9 #define BIT_WR (1 << 9) 1.10 #define BIT_RD (1 << 9) 1.11 @@ -10,6 +11,7 @@ 1.12 #define BIT_NOSYS (1 << 12) 1.13 #define BIT_PRESENT (1 << 15) 1.14 1.15 +/* bits for the last 16bit part of the descriptor */ 1.16 #define BIT_BIG (1 << 6) 1.17 #define BIT_DEFAULT (1 << 6) 1.18 #define BIT_GRAN (1 << 7) 1.19 @@ -18,7 +20,12 @@ 1.20 1.21 static void segm_desc(desc_t *desc, uint32_t base, uint32_t limit, int dpl, int type); 1.22 1.23 +/* these functions are implemented in segm-asm.S */ 1.24 +void setup_selectors(uint16_t code, uint16_t data); 1.25 +void set_gdt(uint32_t addr, uint16_t limit); 1.26 1.27 + 1.28 +/* our global descriptor table */ 1.29 static desc_t gdt[4]; 1.30 1.31 1.32 @@ -33,6 +40,7 @@ 1.33 setup_selectors(selector(SEGM_KCODE, 0), selector(SEGM_KDATA, 0)); 1.34 } 1.35 1.36 +/* constructs a GDT selector based on index and priviledge level */ 1.37 uint16_t selector(int idx, int rpl) 1.38 { 1.39 return (idx << 3) | (rpl & 3);