[ROSLOAD]: Continue work on loader
[reactos.git] / boot / environ / app / rosload / i386 / osxfera.s
1 /*
2 * COPYRIGHT: See COPYING.ARM in the top level directory
3 * PROJECT: ReactOS UEFI OS Loader
4 * FILE: boot/environ/i386/osxfera.asm
5 * PURPOSE: OS Loader i386 Transfer Functions
6 * PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9 /* INCLUDES ******************************************************************/
10
11 #include <asm.inc>
12 #include <ks386.inc>
13
14 EXTERN _OslKernelGdt:FWORD
15 EXTERN _OslKernelIdt:FWORD
16
17 /* FUNCTIONS ****************************************************************/
18 .code
19 ASSUME nothing
20
21 PUBLIC _OslArchTransferToKernel
22 _OslArchTransferToKernel:
23
24 /* Load new GDT and IDT */
25 lgdt _OslKernelGdt+2
26 lidt _OslKernelIdt+2
27
28 /* Set the Ring 0 DS/ES/SS Segment */
29 mov ax, KGDT_R0_DATA
30 mov ds, ax
31 mov es, ax
32 mov ss, ax
33 mov gs, ax
34
35 /* Get the Ring 0 TSS */
36 mov ax, KGDT_TSS
37 ltr ax
38
39 /* Save loader block and entrypoint */
40 mov ecx, [esp+4]
41 mov eax, [esp+8]
42
43 /* Create initial interrupt frame */
44 xor edx, edx
45 push ecx
46 push edx
47 push KGDT_R0_CODE
48 push eax
49
50 /* Jump to KGDT_R0_CODE:[EAX] */
51 retf
52
53 /* We should never make it here */
54 ret 8
55 END