Rev 1251 | Rev 1256 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1251 | Rev 1255 | ||
---|---|---|---|
Line 59... | Line 59... | ||
59 | 59 | ||
60 | ASSERT(TASK->arch.iomap.map); |
60 | ASSERT(TASK->arch.iomap.map); |
61 | bitmap_initialize(&iomap, CPU->arch.tss->iomap, TSS_IOMAP_SIZE * 8); |
61 | bitmap_initialize(&iomap, CPU->arch.tss->iomap, TSS_IOMAP_SIZE * 8); |
62 | bitmap_copy(&iomap, &TASK->arch.iomap, TASK->arch.iomap.bits); |
62 | bitmap_copy(&iomap, &TASK->arch.iomap, TASK->arch.iomap.bits); |
63 | /* |
63 | /* |
64 | * It is safe to set the trailing four bits because of the extra |
64 | * It is safe to set the trailing eight bits because of the extra |
65 | * convenience byte in TSS_IOMAP_SIZE. |
65 | * convenience byte in TSS_IOMAP_SIZE. |
66 | */ |
66 | */ |
67 | bitmap_set_range(&iomap, TASK->arch.iomap.bits, 4); |
67 | bitmap_set_range(&iomap, TASK->arch.iomap.bits, 8); |
68 | } |
68 | } |
69 | spinlock_unlock(&TASK->lock); |
69 | spinlock_unlock(&TASK->lock); |
70 | 70 | ||
71 | /* Second, adjust TSS segment limit. */ |
71 | /* Second, adjust TSS segment limit. */ |
72 | gdtr_store(&cpugdtr); |
72 | gdtr_store(&cpugdtr); |
73 | gdt_p = (descriptor_t *) cpugdtr.base; |
73 | gdt_p = (descriptor_t *) cpugdtr.base; |
74 | gdt_setlimit(&gdt_p[TSS_DES], TSS_BASIC_SIZE + BITS2BYTES(bits) - 1); |
74 | gdt_setlimit(&gdt_p[TSS_DES], TSS_BASIC_SIZE + BITS2BYTES(bits) - 1); |
75 | gdtr_load(&cpugdtr); |
75 | gdtr_load(&cpugdtr); |
- | 76 | ||
- | 77 | /* |
|
- | 78 | * Before we load new TSS limit, the current TSS descriptor |
|
- | 79 | * type must be changed to describe inactive TSS. |
|
- | 80 | */ |
|
- | 81 | gdt_p[TSS_DES].access = AR_PRESENT | AR_TSS | DPL_KERNEL; |
|
- | 82 | tr_load(selector(TSS_DES)); |
|
76 | } |
83 | } |
77 | 84 | ||
78 | /** Perform ia32 specific tasks needed before the new thread is scheduled. |
85 | /** Perform ia32 specific tasks needed before the new thread is scheduled. |
79 | * |
86 | * |
80 | * THREAD is locked and interrupts are disabled. |
87 | * THREAD is locked and interrupts are disabled. |