summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlmuHS <almuhs@github.com>2019-10-03 17:18:55 +0200
committerAlmuHS <almuhs@github.com>2019-10-03 17:18:55 +0200
commitb076434a3c6303d817dc839d2097bc6f308b6dea (patch)
tree56fae0f3193d744a83af26751ff26fee6b5906d4
parente752c32092e96d51b5af2db3e089e3ef54ea2212 (diff)
refactor: moved BSP's apic_id initialization to c_boot_entry
-rw-r--r--i386/i386/mp_desc.c4
-rw-r--r--i386/i386at/model_dep.c10
2 files changed, 11 insertions, 3 deletions
diff --git a/i386/i386/mp_desc.c b/i386/i386/mp_desc.c
index aad81014..10caeb19 100644
--- a/i386/i386/mp_desc.c
+++ b/i386/i386/mp_desc.c
@@ -566,9 +566,6 @@ start_other_cpus(void)
/*TODO: Copy the routine in a physical page */
memcpy((void*)phystokv(AP_BOOT_ADDR), (void*) &apboot, (uint32_t)&apbootend - (uint32_t)&apboot);
- //update BSP machine_slot and apic2kernel
- machine_slot[0].apic_id = apic_id;
- apic2kernel[apic_id] = 0;
//Reserve memory for cpu stack
if (!init_alloc_aligned(STACK_SIZE*(ncpu-1), &stack_start))
@@ -595,6 +592,7 @@ start_other_cpus(void)
}
}
+
/* Get rid of the temporary direct mapping and flush it out of the TLB. */
for (i = 0 ; i < nb_direct_value; i++){
kernel_page_dir[lin2pdenum_cont(INIT_VM_MIN_KERNEL_ADDRESS) + i] = 0;
diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
index fd667b4f..e47ef317 100644
--- a/i386/i386at/model_dep.c
+++ b/i386/i386at/model_dep.c
@@ -581,6 +581,7 @@ if(ncpu == 1){
*/
void c_boot_entry(vm_offset_t bi)
{
+ int apic_id;
#if ENABLE_IMMEDIATE_CONSOLE
romputc = immc_romputc;
#endif /* ENABLE_IMMEDIATE_CONSOLE */
@@ -687,6 +688,15 @@ void c_boot_entry(vm_offset_t bi)
break;
}
+ if(lapic != 0){
+ apic_id = lapic->apic_id.r;
+
+ //update BSP machine_slot and apic2kernel
+ machine_slot[0].apic_id = apic_id;
+ apic2kernel[apic_id] = 0;
+ }
+
+
/*
* Start the system.
*/