- Timestamp:
- Jul 20, 2017, 9:55:05 AM (7 years ago)
- Location:
- trunk/hal/x86_64/core
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/core/hal_acpi.c
r235 r240 116 116 subheader_t *sub; 117 117 size_t nioapic = 0; 118 size_t ncpu = 0;118 extern size_t ncpu; 119 119 120 120 extern paddr_t lapic_pa; -
trunk/hal/x86_64/core/hal_init.c
r237 r240 58 58 uint8_t mb_mmap[PAGE_SIZE] __in_kdata; 59 59 60 size_t ncpu __in_kdata = 0; 61 static boot_info_t btinfo __in_kdata; 62 60 63 /* x86-specific per-cluster structures */ 61 64 uint8_t gdtstore[PAGE_SIZE] __in_kdata; … … 160 163 static void init_bootinfo_core(boot_core_t *core) 161 164 { 162 memset(core, 0, sizeof(boot_core_t)); 163 164 core->gid = hal_lapic_gid(); 165 core->lid = 0; 166 core->cxy = 0; 165 size_t i; 166 167 // XXX: not necessarily contiguous 168 for (i = 0; i < ncpu; i++) { 169 memset(&core[i], 0, sizeof(boot_core_t)); 170 171 core[i].gid = i; 172 core[i].lid = i; 173 core[i].cxy = 0; 174 } 167 175 } 168 176 … … 240 248 241 249 info->cxy = 0; 242 info->cores_nr = 1;243 init_bootinfo_core( &info->core[0]);250 info->cores_nr = ncpu; 251 init_bootinfo_core((boot_core_t *)&info->core); 244 252 245 253 info->rsvd_nr = init_bootinfo_rsvd((boot_rsvd_t *)&info->rsvd); … … 303 311 void init_x86_64_cpuN() 304 312 { 305 lid_t lid = hal_lapic_gid(); 313 lid_t lid; 314 315 cli(); 316 317 lid = hal_lapic_gid(); 306 318 307 319 cpu_attach(lid); … … 322 334 } 323 335 324 sti(); 336 kernel_init(&btinfo); 337 338 reg_t dummy; 339 hal_enable_irq(&dummy); 340 325 341 while (1); 326 342 } … … 342 358 void init_x86_64(paddr_t firstpa) 343 359 { 344 boot_info_t btinfo;360 cli(); 345 361 346 362 /* Initialize the serial port */ … … 396 412 start_secondary_cpus(); 397 413 414 kernel_init(&btinfo); 415 416 x86_printf("[+] kernel_init called\n"); 417 398 418 reg_t dummy; 399 419 hal_enable_irq(&dummy); 400 401 while (1);402 403 kernel_init(&btinfo);404 405 x86_printf("[+] kernel_init called\n");406 420 /* 407 421 void *ptr; … … 623 637 cputls->tls_gid = hal_lapic_gid(); 624 638 cputls->tls_lid = lid; 639 cputls->tls_intr = INTRS_DISABLED; 625 640 626 641 wrmsr(MSR_FSBASE, 0); -
trunk/hal/x86_64/core/hal_irqmask.c
r234 r240 22 22 #include <hal_types.h> 23 23 #include <hal_internal.h> 24 25 #define INTRS_ENABLED 0xFFEFAAAA 26 #define INTRS_DISABLED 0xD0CCCCC0 27 28 static uint32_t intrs_state __in_kdata = INTRS_DISABLED; 24 #include <hal_segmentation.h> 29 25 30 26 inline void hal_disable_irq(uint32_t *old) 31 27 { 32 *old = intrs_state; 33 intrs_state = INTRS_DISABLED; 28 tls_t *tls = curcpu(); 29 30 *old = tls->tls_intr; 31 tls->tls_intr = INTRS_DISABLED; 32 34 33 cli(); 35 34 } … … 37 36 inline void hal_enable_irq(uint32_t *old) 38 37 { 39 *old = intrs_state; 40 intrs_state = INTRS_ENABLED; 38 tls_t *tls = curcpu(); 39 40 *old = tls->tls_intr; 41 tls->tls_intr = INTRS_ENABLED; 42 41 43 sti(); 42 44 } … … 44 46 inline void hal_restore_irq(uint32_t old) 45 47 { 46 intrs_state = old;48 tls_t *tls = curcpu(); 47 49 48 if (intrs_state == INTRS_ENABLED) 50 tls->tls_intr = old; 51 52 if (old == INTRS_ENABLED) 49 53 sti(); 50 else if( intrs_state== INTRS_DISABLED)54 else if(old == INTRS_DISABLED) 51 55 cli(); 52 56 else -
trunk/hal/x86_64/core/hal_segmentation.h
r234 r240 154 154 uint32_t tls_lid; 155 155 void *tls_thr; 156 reg_t tls_intr; 156 157 } __packed; 157 158 typedef struct tls tls_t; … … 160 161 void lidt(struct region_descriptor *); 161 162 void ltr(uint16_t); 163 tls_t *curcpu(); 164 165 #define INTRS_ENABLED 0xFFEFAAAA 166 #define INTRS_DISABLED 0xD0CCCCC0 162 167 163 168 #endif /* !x86_ASM */
Note: See TracChangeset
for help on using the changeset viewer.