[NTOS]: Implement MmDeleteTeb, VADs are now deleted/freed on thread exit as well...
[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 EXTERN KiInitializeKernelAndGotoIdleLoop:PROC
15
16 /* GLOBALS *******************************************************************/
17
18
19 /* FUNCTIONS *****************************************************************/
20
21 .code64
22 .text
23
24 /**
25 * VOID
26 * KiSetupStackAndInitializeKernel(
27 * IN PKPROCESS InitProcess, <rsp + 0x08, rcx>
28 * IN PKTHREAD InitThread, <rsp + 0x10, rdx>
29 * IN PVOID IdleStack, <rsp + 0x18, r8>
30 * IN PKPRCB Prcb, <rsp + 0x20, r9>
31 * IN CCHAR Number, <rsp + 0x28>
32 * IN PLOADER_PARAMETER_BLOCK LoaderBlock) <rsp + 0x30>
33 */
34 PUBLIC KiSetupStackAndInitializeKernel
35 .PROC KiSetupStackAndInitializeKernel
36
37 /* Save current stack */
38 mov rsi, rsp
39
40 /* Setup the new stack */
41 mov ax, HEX(18)
42 mov ss, ax
43 mov rsp, r8
44 sub rsp, HEX(300) // FIXME
45
46 /* Copy stack parameters to the new stack */
47 sub rsp, HEX(38)
48 .ENDPROLOG
49
50 mov rdi, rsp
51 movsq
52 movsq
53 movsq
54 movsq
55 movsq
56 movsq
57 movsq
58
59 jmp KiInitializeKernelAndGotoIdleLoop
60
61 .ENDP KiSetupStackAndInitializeKernel
62
63 END
64