+FSCTL_DISMOUNT_VOLUME define
[reactos.git] / hal / halx86 / mpsboot.asm
1 ;
2 ; COPYRIGHT:       See COPYING in the top level directory
3 ; PROJECT:         ReactOS kernel
4 ; FILE:            ntoskrnl/hal/x86/mpsboot.c
5 ; PURPOSE:         Bootstrap code for application processors
6 ; PROGRAMMER:      Casper S. Hornstrup (chorns@users.sourceforge.net)
7 ; UPDATE HISTORY:
8 ;                  Created 12/04/2001
9 ;
10
11 ;
12 ; Memory map at this stage is:
13 ;     0x2000  Location of our stack
14 ;     0x3000  Startup code for the APs (this code)
15 ;
16
17 ;
18 ; Base address of common area for BSP and APs
19 ;
20 LOAD_BASE   equ 00200000h
21
22 ;
23 ; Magic value to be put in EAX when multiboot.S is called as part of the
24 ; application processor initialization process
25 ;
26 AP_MAGIC    equ 12481020h
27
28 ;
29 ; Segment selectors
30 ;
31 %define KERNEL_CS     (0x8)
32 %define KERNEL_DS     (0x10)
33
34 section .text
35
36 global _APstart
37 global _APend
38
39 ; 16 bit code
40 BITS 16
41
42 _APstart:
43         cli             ; Just in case
44
45   xor   ax, ax
46         mov             ds, ax
47         mov             ss, ax
48
49   mov   eax, 3000h + APgdt - _APstart
50         lgdt  [eax]
51
52   mov   eax, cr0
53   or    eax, 00010001h    ; Turn on protected mode and write protection
54   mov   cr0, eax
55
56   db    0eah
57   dw    3000h + flush - _APstart, KERNEL_CS
58
59 ; 32 bit code
60 BITS 32
61
62 flush:
63   mov   ax, KERNEL_DS
64   mov           ds, ax
65   mov           es, ax
66   mov           fs, ax
67   mov           gs, ax
68   mov           ss, ax
69
70   ; Setup a stack for the AP
71   mov   eax, 2000h
72   mov   eax, [eax]
73   mov   esp, eax
74
75   ; Jump to start of the kernel with AP magic in eax
76   mov      eax, AP_MAGIC
77   jmp      dword KERNEL_CS:(LOAD_BASE + 0x1000)
78
79   ; Never get here
80
81
82 ; Temporary GDT descriptor for the APs
83
84 APgdt:
85 ; Limit
86   dw  (3*8)-1
87 ; Base
88   dd    3000h + gdt - _APstart
89
90 gdt:
91   dw    0x0       ; Null descriptor
92   dw    0x0
93   dw    0x0
94   dw    0x0
95
96   dw    0xffff    ; Kernel code descriptor
97   dw    0x0000
98   dw    0x9a00
99   dw    0x00cf
100
101   dw    0xffff    ;  Kernel data descriptor
102   dw    0x0000
103   dw    0x9200
104   dw    0x00cf
105
106 _APend: