Changes in kernel/arch/ia32/src/pm.c [d6f9fff:d242cb6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/pm.c
rd6f9fff rd242cb6 41 41 #include <panic.h> 42 42 #include <arch/mm/page.h> 43 #include <mm/km.h>44 #include <mm/frame.h>45 43 #include <mm/slab.h> 46 44 #include <memstr.h> … … 53 51 54 52 /* 55 * We don't have much use for segmentation so we set up flat mode.56 * In thismode, we use, for each privilege level, two segments spanning the53 * We have no use for segmentation so we set up flat mode. In this 54 * mode, we use, for each privilege level, two segments spanning the 57 55 * whole memory. One is for code and one is for data. 58 56 * 59 * One special segment apart of that is for the GS register which holds60 * a pointer to the VREG page in its base.57 * One is for GS register which holds pointer to the TLS thread 58 * structure in it's base. 61 59 */ 62 60 descriptor_t gdt[GDT_ITEMS] = { … … 73 71 /* TSS descriptor - set up will be completed later */ 74 72 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 75 /* VREG descriptor - segment used for virtual registers, will be reinitialized later */76 { 0xffff, 0 73 /* TLS descriptor */ 74 { 0xffff, 0, 0, AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_USER, 0xf, 0, 0, 1, 1, 0 }, 77 75 /* VESA Init descriptor */ 78 76 #ifdef CONFIG_FB … … 84 82 static idescriptor_t idt[IDT_ITEMS]; 85 83 86 static tss_t tss 0;84 static tss_t tss; 87 85 88 86 tss_t *tss_p = NULL; … … 97 95 { 98 96 d->base_0_15 = base & 0xffff; 99 d->base_16_23 = ( base>> 16) & 0xff;100 d->base_24_31 = ( base>> 24) & 0xff;97 d->base_16_23 = ((base) >> 16) & 0xff; 98 d->base_24_31 = ((base) >> 24) & 0xff; 101 99 } 102 100 … … 267 265 * the heap hasn't been initialized so far. 268 266 */ 269 tss_p = &tss0; 270 } else { 267 tss_p = &tss; 268 } 269 else { 271 270 tss_p = (tss_t *) malloc(sizeof(tss_t), FRAME_ATOMIC); 272 271 if (!tss_p) … … 293 292 } 294 293 294 void set_tls_desc(uintptr_t tls) 295 { 296 ptr_16_32_t cpugdtr; 297 descriptor_t *gdt_p; 298 299 gdtr_store(&cpugdtr); 300 gdt_p = (descriptor_t *) cpugdtr.base; 301 gdt_setbase(&gdt_p[TLS_DES], tls); 302 /* Reload gdt register to update GS in CPU */ 303 gdtr_load(&cpugdtr); 304 } 305 295 306 /** @} 296 307 */
Note:
See TracChangeset
for help on using the changeset viewer.