Changes in kernel/generic/src/cpu/cpu.c [44a7ee5:a35b458] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/cpu/cpu.c
r44a7ee5 ra35b458 63 63 if (config.cpu_active == 1) { 64 64 #endif /* CONFIG_SMP */ 65 65 66 66 cpus = (cpu_t *) malloc(sizeof(cpu_t) * config.cpu_count, 67 67 FRAME_ATOMIC); 68 68 if (!cpus) 69 69 panic("Cannot allocate CPU structures."); 70 70 71 71 /* Initialize everything */ 72 72 memsetb(cpus, sizeof(cpu_t) * config.cpu_count, 0); 73 73 74 74 size_t i; 75 75 for (i = 0; i < config.cpu_count; i++) { … … 78 78 if (!stack_phys) 79 79 panic("Cannot allocate CPU stack."); 80 80 81 81 cpus[i].stack = (uint8_t *) PA2KA(stack_phys); 82 82 cpus[i].id = i; 83 83 84 84 irq_spinlock_initialize(&cpus[i].lock, "cpus[].lock"); 85 85 86 86 for (unsigned int j = 0; j < RQ_COUNT; j++) { 87 87 irq_spinlock_initialize(&cpus[i].rq[j].lock, "cpus[].rq[].lock"); … … 89 89 } 90 90 } 91 91 92 92 #ifdef CONFIG_SMP 93 93 } 94 94 #endif /* CONFIG_SMP */ 95 95 96 96 CPU = &cpus[config.cpu_active - 1]; 97 97 98 98 CPU->active = true; 99 99 CPU->tlb_active = true; 100 100 101 101 CPU->idle = false; 102 102 CPU->last_cycle = get_cycle(); 103 103 CPU->idle_cycles = 0; 104 104 CPU->busy_cycles = 0; 105 105 106 106 cpu_identify(); 107 107 cpu_arch_init(); … … 113 113 { 114 114 unsigned int i; 115 115 116 116 for (i = 0; i < config.cpu_count; i++) { 117 117 if (cpus[i].active)
Note:
See TracChangeset
for help on using the changeset viewer.