- Move asm.h to NDK.
[reactos.git] / reactos / ntoskrnl / ke / i386 / main.S
1 #include <roscfg.h>
2 #include <ndk/asm.h>
3 #include <ndk/i386/segment.h>
4
5 #define AP_MAGIC (0x12481020)
6
7 .globl _NtProcessStartup
8
9 _NtProcessStartup:
10
11 /* FIXME: Application processors should have their own GDT/IDT */
12 lgdt _KiGdtDescriptor
13 lidt _KiIdtDescriptor
14
15 /* Load the PCR selector */
16 movl $PCR_SELECTOR, %eax
17 movl %eax, %fs
18
19 cmpl $AP_MAGIC, %ecx
20 jne .m1
21
22 pushl $0
23 popfl
24
25 /*
26 * Reserve space for the floating point save area.
27 */
28 subl $SIZEOF_FX_SAVE_AREA, %esp
29
30 /*
31 * Call the application processor initialization code
32 */
33 pushl $0
34 call _KiSystemStartup
35
36 .m1:
37 /* Load the initial kernel stack */
38 lea _kernel_stack, %eax
39 add $0x1000, %eax
40 and $0xFFFFE000, %eax
41 add $(0x3000 - SIZEOF_FX_SAVE_AREA), %eax
42 movl %eax, %esp
43
44 /* Call the main kernel initialization */
45 pushl %edx
46 pushl %ecx
47 call __main