@@ -39,38 +39,11 @@ start:
3939 call init_nvs ; Initialize non-volatile storage
4040 call init_net ; Initialize network
4141 call init_hid ; Initialize human interface devices
42-
43- ; Copy the payload after the kernel to the proper address
44- mov rsi , 0x100000 + KERNELSIZE ; Payload starts right after the kernel
45- cmp qword [ rsi ], 0 ; Is there a payload after the kernel?
42+ cmp qword [ 0x100000 + KERNELSIZE ], 0 ; Is there a payload after the kernel?
4643 je ap_clear ; If not, skip to ap_clear
47- mov rdi , 0x1E0000
48- mov rcx , 2048
49- rep movsq ; Copy 16384 bytes
50-
51- ; Set the payload to run
52- bsp_run_payload:
53- mov rsi , [ os_LocalAPICAddress ] ; We can't use b_smp_get_id as no configured stack yet
54- xor eax , eax ; Clear Task Priority (bits 7:4) and Task Priority Sub-Class (bits 3:0)
55- mov dword [ rsi + 0x80 ], eax ; APIC Task Priority Register (TPR)
56- mov eax , dword [ rsi + 0x20 ] ; APIC ID in upper 8 bits
57- shr eax , 24 ; Shift to the right and AL now holds the CPU's APIC ID
58- mov [ os_BSP ], al ; Keep a record of the BSP APIC ID
59- mov ebx , eax ; Save the APIC ID
60- mov rdi , os_SMP ; Clear the entry in the work table
61- shl rax , 3 ; Quick multiply by 8 to get to proper record
62- add rdi , rax
63- xor eax , eax
64- or al , 1 ; Set bit 0 for "present"
65- stosq ; Clear the code address
66- mov rcx , rbx ; Copy the APIC ID for b_smp_set
67- mov rax , 0x1E0000 ; Payload was copied here
68- call b_smp_set
44+ call init_sys
6945 jmp bsp ; Skip past some of the ap_clear code we have already executed
7046
71- ; Fall through to ap_clear as align fills the space with No-Ops
72- ; At this point the BSP is just like one of the AP's
73-
7447align 16
7548ap_clear: ; All cores start here on first start-up and after an exception
7649 cli ; Disable interrupts on this core
0 commit comments