File tree Expand file tree Collapse file tree 4 files changed +19
-1
lines changed Expand file tree Collapse file tree 4 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -25,13 +25,17 @@ SECTIONS {
25
25
. = 0x7c00;
26
26
_stack_end = .;
27
27
28
- .bootloader :
28
+ .bootloader_first_stage :
29
29
{
30
30
/* first stage */
31
31
*(.boot-first-stage)
32
+ }
32
33
34
+ .bootloader :
35
+ {
33
36
/* rest of bootloader */
34
37
_rest_of_bootloader_start_addr = .;
38
+ *(.smp_trampoline)
35
39
*(.boot)
36
40
*(.context_switch)
37
41
*(.text .text.*)
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ pub struct BootInfo {
29
29
/// the memory map before passing it to the kernel. Regions marked as usable can be freely
30
30
/// used by the kernel.
31
31
pub memory_map : MemoryMap ,
32
+ pub smp_trampoline : unsafe extern "C" fn ( ) -> !,
32
33
/// The virtual address of the recursively mapped level 4 page table.
33
34
#[ cfg( feature = "recursive_page_table" ) ]
34
35
pub recursive_page_table_addr : u64 ,
@@ -51,11 +52,13 @@ impl BootInfo {
51
52
#[ doc( hidden) ]
52
53
pub fn new (
53
54
memory_map : MemoryMap ,
55
+ smp_trampoline : unsafe extern "C" fn ( ) -> !,
54
56
recursive_page_table_addr : u64 ,
55
57
physical_memory_offset : u64 ,
56
58
) -> Self {
57
59
BootInfo {
58
60
memory_map,
61
+ smp_trampoline,
59
62
#[ cfg( feature = "recursive_page_table" ) ]
60
63
recursive_page_table_addr,
61
64
#[ cfg( feature = "map_physical_memory" ) ]
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ global_asm!(include_str!("stage_1.s"));
36
36
global_asm ! ( include_str!( "stage_2.s" ) ) ;
37
37
global_asm ! ( include_str!( "e820.s" ) ) ;
38
38
global_asm ! ( include_str!( "stage_3.s" ) ) ;
39
+ global_asm ! ( include_str!( "smp_trampoline.s" ) ) ;
39
40
40
41
#[ cfg( feature = "vga_320x200" ) ]
41
42
global_asm ! ( include_str!( "video_mode/vga_320x200.s" ) ) ;
@@ -84,6 +85,7 @@ extern "C" {
84
85
static __bootloader_end: usize ;
85
86
static __bootloader_start: usize ;
86
87
static _p4: usize ;
88
+ fn _smp_trampoline ( ) -> !;
87
89
}
88
90
89
91
#[ no_mangle]
@@ -324,6 +326,7 @@ fn bootloader_main(
324
326
// Construct boot info structure.
325
327
let mut boot_info = BootInfo :: new (
326
328
memory_map,
329
+ _smp_trampoline,
327
330
recursive_page_table_addr. as_u64 ( ) ,
328
331
physical_memory_offset,
329
332
) ;
Original file line number Diff line number Diff line change
1
+ .section .smp_trampoline, "awx"
2
+ .global _smp_trampoline
3
+ .intel_syntax noprefix
4
+ .align 4096
5
+ .code16
6
+
7
+ _smp_trampoline:
8
+ jmp _smp_trampoline
You can’t perform that action at this time.
0 commit comments