[AMD64]
[reactos.git] / reactos / ntoskrnl / ke / amd64 / boot.S
1 /*
2 * FILE: ntoskrnl/ke/i386/boot.S
3 * COPYRIGHT: See COPYING in the top level directory
4 * PURPOSE: FreeLDR Wrapper Bootstrap Code and Bootstrap Trampoline
5 * PROGRAMMERs: Alex Ionescu (alex@relsoft.net)
6 * Thomas Weidenmueller <w3seek@reactos.org>
7 */
8
9 /* INCLUDES ******************************************************************/
10
11 #include <reactos/asm.h>
12 #include <ndk/amd64/asm.h>
13
14
15 /* GLOBALS *******************************************************************/
16
17
18 /* FUNCTIONS *****************************************************************/
19
20 .code64
21 .text
22
23 /**
24 * VOID
25 * KiSetupStackAndInitializeKernel(
26 * IN PKPROCESS InitProcess, <rsp + 0x08, rcx>
27 * IN PKTHREAD InitThread, <rsp + 0x10, rdx>
28 * IN PVOID IdleStack, <rsp + 0x18, r8>
29 * IN PKPRCB Prcb, <rsp + 0x20, r9>
30 * IN CCHAR Number, <rsp + 0x28>
31 * IN PLOADER_PARAMETER_BLOCK LoaderBlock) <rsp + 0x30>
32 */
33 PUBLIC KiSetupStackAndInitializeKernel
34 .PROC KiSetupStackAndInitializeKernel
35
36 /* Save current stack */
37 mov rsi, rsp
38
39 /* Setup the new stack */
40 mov ax, 0x18
41 mov ss, ax
42 mov rsp, r8
43 sub rsp, 0x300 // FIXME
44
45 /* Copy stack parameters to the new stack */
46 sub rsp, 0x38
47 mov rdi, rsp
48 movsq
49 movsq
50 movsq
51 movsq
52 movsq
53 movsq
54 movsq
55
56 jmp KiInitializeKernelAndGotoIdleLoop
57
58 .ENDP KiSetupStackAndInitializeKernel
59
60 END
61