Something went wrong. Try again.
Reactos
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119;; COPYRIGHT: See COPYING in the top level directory; PROJECT: ReactOS kernel; FILE: hal/halx86/mp/mpsboot.c; PURPOSE: Bootstrap code for application processors; PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net); UPDATE HISTORY:; Created 12/04/2001;
;; Memory map at this stage is:; 0x2000 Location of our stack; 0x3000 Startup code for the APs (this code);
;; Magic value to be put in EAX when multiboot.S is called as part of the; application processor initialization process;AP_MAGIC equ 12481020h
X86_CR4_PAE equ 00000020h
;; Segment selectors;%define KERNEL_CS (0x8)%define KERNEL_DS (0x10)
section .text
global _APstartglobal _APend
; 16 bit codeBITS 16
_APstart: cli ; Just in case
xor ax, ax mov ds, ax mov ss, ax
mov eax, 3000h + APgdt - _APstart lgdt [eax] mov eax, [2004h] ; Set the page directory mov cr3, eax mov eax, [200ch] cmp eax,0 je NoPae mov eax,cr4 or eax,X86_CR4_PAE mov cr4,eax NoPae:
mov eax, cr0 or eax, 80010001h ; Turn on protected mode, paging and write protection mov cr0, eax
db 0eah dw 3000h + flush - _APstart, KERNEL_CS
; 32 bit codeBITS 32
flush: mov ax, KERNEL_DS mov ds, ax mov es, ax mov fs, ax mov gs, ax mov ss, ax
; Setup a stack for the AP mov eax, 2000h mov eax, [eax] mov esp, eax
; Jump to start of the kernel with AP magic in ecx mov ecx, AP_MAGIC mov eax,[2008h] jmp eax
; Never get here
; Temporary GDT descriptor for the APs
APgdt:; Limit dw (3*8)-1; Base dd 3000h + gdt - _APstart
gdt: dw 0x0 ; Null descriptor dw 0x0 dw 0x0 dw 0x0
dw 0xffff ; Kernel code descriptor dw 0x0000 dw 0x9a00 dw 0x00cf
dw 0xffff ; Kernel data descriptor dw 0x0000 dw 0x9200 dw 0x00cf
_APend: