Changeset a35b458 in mainline for kernel/arch/amd64/src/pm.c
- Timestamp:
- 2018-03-02T20:10:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/pm.c
r3061bc1 ra35b458 130 130 { 131 131 tss_descriptor_t *td = (tss_descriptor_t *) d; 132 132 133 133 td->base_0_15 = base & 0xffffU; 134 134 td->base_16_23 = ((base) >> 16) & 0xffU; … … 140 140 { 141 141 tss_descriptor_t *td = (tss_descriptor_t *) d; 142 142 143 143 td->limit_0_15 = limit & 0xffffU; 144 144 td->limit_16_19 = (limit >> 16) & 0x0fU; … … 167 167 idescriptor_t *d; 168 168 unsigned int i; 169 169 170 170 for (i = 0; i < IDT_ITEMS; i++) { 171 171 d = &idt[i]; 172 172 173 173 d->unused = 0; 174 174 d->selector = GDT_SELECTOR(KTEXT_DES); 175 175 176 176 d->present = 1; 177 177 d->type = AR_INTERRUPT; /* masking interrupt */ 178 178 } 179 179 180 180 d = &idt[0]; 181 181 idt_setoffset(d++, (uintptr_t) &int_0); … … 252 252 descriptor_t *gdt_p = (descriptor_t *) gdtr.base; 253 253 tss_descriptor_t *tss_desc; 254 254 255 255 /* 256 256 * Each CPU has its private GDT and TSS. 257 257 * All CPUs share one IDT. 258 258 */ 259 259 260 260 if (config.cpu_active == 1) { 261 261 idt_init(); … … 270 270 * ahead of page_init */ 271 271 write_cr3((uintptr_t) AS_KERNEL->genarch.page_table); 272 272 273 273 tss_p = (tss_t *) malloc(sizeof(tss_t), FRAME_ATOMIC); 274 274 if (!tss_p) 275 275 panic("Cannot allocate TSS."); 276 276 } 277 277 278 278 tss_initialize(tss_p); 279 279 280 280 tss_desc = (tss_descriptor_t *) (&gdt_p[TSS_DES]); 281 281 tss_desc->present = 1; 282 282 tss_desc->type = AR_TSS; 283 283 tss_desc->dpl = PL_KERNEL; 284 284 285 285 gdt_tss_setbase(&gdt_p[TSS_DES], (uintptr_t) tss_p); 286 286 gdt_tss_setlimit(&gdt_p[TSS_DES], TSS_BASIC_SIZE - 1); 287 287 288 288 gdtr_load(&gdtr); 289 289 idtr_load(&idtr);
Note:
See TracChangeset
for help on using the changeset viewer.