1
- use alloc:: boxed:: Box ;
2
1
use alloc:: vec:: Vec ;
3
2
#[ cfg( any( feature = "pci" , feature = "smp" ) ) ]
4
3
use core:: arch:: x86_64:: _mm_mfence;
@@ -8,19 +7,18 @@ use core::ptr;
8
7
use core:: sync:: atomic:: Ordering ;
9
8
use core:: { cmp, fmt, mem, u32} ;
10
9
11
- use arch:: x86_64:: kernel:: percore:: * ;
10
+ #[ cfg( feature = "smp" ) ]
11
+ use arch:: x86_64:: kernel:: core_local:: * ;
12
12
use arch:: x86_64:: kernel:: { interrupts, processor} ;
13
- use crossbeam_utils:: CachePadded ;
14
13
use hermit_sync:: without_interrupts;
15
14
#[ cfg( feature = "smp" ) ]
16
15
use x86:: controlregs:: * ;
17
16
use x86:: msr:: * ;
18
17
use x86_64:: structures:: idt:: InterruptDescriptorTable ;
19
18
20
- use super :: interrupts:: { IDT , IRQ_COUNTERS } ;
19
+ use super :: interrupts:: IDT ;
21
20
#[ cfg( feature = "acpi" ) ]
22
21
use crate :: arch:: x86_64:: kernel:: acpi;
23
- use crate :: arch:: x86_64:: kernel:: interrupts:: IrqStatistics ;
24
22
use crate :: arch:: x86_64:: kernel:: CURRENT_STACK_ADDRESS ;
25
23
use crate :: arch:: x86_64:: mm:: paging:: {
26
24
BasePageSize , PageSize , PageTableEntryFlags , PageTableEntryFlagsExt ,
@@ -512,13 +510,6 @@ pub extern "C" fn eoi() {
512
510
}
513
511
514
512
pub fn init ( ) {
515
- let boxed_irq = Box :: new ( IrqStatistics :: new ( ) ) ;
516
- let boxed_irq_raw = Box :: into_raw ( boxed_irq) ;
517
- unsafe {
518
- IRQ_COUNTERS . insert ( 0 , & ( * boxed_irq_raw) ) ;
519
- PERCORE . irq_statistics . set ( boxed_irq_raw) ;
520
- }
521
-
522
513
// Initialize an empty vector for the Local APIC IDs of all CPUs.
523
514
unsafe {
524
515
CPU_LOCAL_APIC_IDS = Some ( Vec :: new ( ) ) ;
@@ -736,30 +727,11 @@ pub fn init_x2apic() {
736
727
}
737
728
738
729
/// Initialize the required _start variables for the next CPU to be booted.
739
- pub fn init_next_processor_variables ( core_id : CoreId ) {
740
- // Allocate stack and PerCoreVariables structure for the CPU and pass the addresses.
730
+ pub fn init_next_processor_variables ( ) {
731
+ // Allocate stack for the CPU and pass the addresses.
741
732
// Keep the stack executable to possibly support dynamically generated code on the stack (see https://security.stackexchange.com/a/47825).
742
733
let stack = mm:: allocate ( KERNEL_STACK_SIZE , true ) ;
743
- let mut boxed_percore = Box :: new ( CachePadded :: new ( PerCoreInnerVariables :: new ( core_id) ) ) ;
744
- let boxed_irq = Box :: new ( IrqStatistics :: new ( ) ) ;
745
- let boxed_irq_raw = Box :: into_raw ( boxed_irq) ;
746
-
747
- unsafe {
748
- IRQ_COUNTERS . insert ( core_id, & ( * boxed_irq_raw) ) ;
749
- boxed_percore. irq_statistics = PerCoreVariable :: new ( boxed_irq_raw) ;
750
- }
751
-
752
734
CURRENT_STACK_ADDRESS . store ( stack. as_u64 ( ) , Ordering :: Relaxed ) ;
753
-
754
- let current_percore = Box :: leak ( boxed_percore) ;
755
-
756
- trace ! (
757
- "Initialize per core data at {:p} (size {} bytes)" ,
758
- current_percore,
759
- mem:: size_of_val( current_percore)
760
- ) ;
761
-
762
- CURRENT_PERCORE_ADDRESS . store ( current_percore as * mut _ as u64 , Ordering :: Release ) ;
763
735
}
764
736
765
737
/// Boot all Application Processors
@@ -836,7 +808,7 @@ pub fn boot_application_processors() {
836
808
"Waking up CPU {} with Local APIC ID {}" ,
837
809
core_id_to_boot, apic_id
838
810
) ;
839
- init_next_processor_variables ( core_id_to_boot ) ;
811
+ init_next_processor_variables ( ) ;
840
812
841
813
// Save the current number of initialized CPUs.
842
814
let current_processor_count = arch:: get_processor_count ( ) ;
0 commit comments