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