Changeset 168
- Timestamp:
- Jul 10, 2017, 10:33:15 AM (7 years ago)
- Location:
- trunk/hal/x86_64/core
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/core/hal_init.c
r166 r168 48 48 static void gdt_create(); 49 49 static void idt_create(); 50 void cpu_tls_init(size_t lid); 50 51 void cpu_identify(); 51 52 void cpu_attach(); … … 292 293 x86_printf("[+] hal_apic_init called\n"); 293 294 294 hal_tls_init_cpu0();295 x86_printf("[+] hal_tls_init_cpu0called\n");295 cpu_tls_init(0); 296 x86_printf("[+] cput_tls_init called\n"); 296 297 297 298 x86_printf("-> mytest = %z\n", mytest); … … 328 329 typedef struct { 329 330 struct tss tss; 331 struct tls tls; 330 332 uint8_t intr_stack[STKSIZE]; 331 333 uint8_t dbfl_stack[STKSIZE]; … … 485 487 /* -------------------------------------------------------------------------- */ 486 488 489 void cpu_tls_init(size_t lid) 490 { 491 percpu_archdata_t *data = &cpudata[lid]; 492 tls_t *cputls = &data->tls; 493 494 memset(cputls, 0, sizeof(tls_t)); 495 496 cputls->tls_self = cputls; 497 cputls->tls_gid = hal_lapic_gid(); 498 cputls->tls_lid = lid; 499 500 wrmsr(MSR_FSBASE, 0); 501 wrmsr(MSR_GSBASE, (uint64_t)cputls); 502 wrmsr(MSR_KERNELGSBASE, 0); 503 } 504 505 /* -------------------------------------------------------------------------- */ 506 487 507 uint64_t cpu_features[4] __in_kdata; 488 508 … … 532 552 void cpu_attach(size_t lid) 533 553 { 554 /* Per-cluster structures */ 534 555 cpu_load_gdt(); 535 556 cpu_load_idt(); 557 558 /* Per-cpu structures */ 536 559 cpu_create_tss(lid); 537 560 -
trunk/hal/x86_64/core/hal_internal.h
r166 r168 66 66 67 67 /* hal_special.c */ 68 void hal_tls_init_cpu0();69 68 70 69 /* x86_printf.c */ -
trunk/hal/x86_64/core/hal_interrupt.c
r155 r168 29 29 #include <hal_apic.h> 30 30 #include <hal_internal.h> 31 #include <hal_special.h> 31 32 32 33 /* -------------------------------------------------------------------------- */ … … 37 38 void hal_timer_intr(struct trapframe *tf) 38 39 { 39 x86_printf("-> got timer: rip=%Z\n", tf->tf_rip); 40 x86_printf("-> got timer: rip=%Z (th=%Z)\n", tf->tf_rip, 41 hal_get_current_thread()); 40 42 return; 41 43 } -
trunk/hal/x86_64/core/hal_special.c
r167 r168 43 43 (*(tls_t * const *)offsetof(tls_t, tls_self))); 44 44 return cputls; 45 }46 47 static void hal_tls_load_cpu(tls_t *cputls)48 {49 wrmsr(MSR_FSBASE, 0);50 wrmsr(MSR_GSBASE, (uint64_t)cputls);51 wrmsr(MSR_KERNELGSBASE, 0);52 }53 54 void hal_tls_init_cpu0()55 {56 tls_t *cputls = &cpu0;57 58 memset(cputls, 0, sizeof(tls_t));59 60 cputls->tls_self = cputls;61 cputls->tls_gid = hal_lapic_gid();62 cputls->tls_lid = 0; /* XXX */63 64 hal_tls_load_cpu(cputls);65 45 } 66 46
Note: See TracChangeset
for help on using the changeset viewer.