xref: /reactos/boot/environ/app/rosload/i386/osxfera.s (revision 2196a06f)
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
14EXTERN _OslKernelGdt:FWORD
15EXTERN _OslKernelIdt:FWORD
16
17/* FUNCTIONS ****************************************************************/
18.code
19
20PUBLIC _OslArchTransferToKernel
21_OslArchTransferToKernel:
22
23    /* Load new GDT and IDT */
24    lgdt _OslKernelGdt+2
25    lidt _OslKernelIdt+2
26
27    /* Set the Ring 0 DS/ES/SS Segment */
28    mov ax, KGDT_R0_DATA
29    mov ds, ax
30    mov es, ax
31    mov ss, ax
32    mov gs, ax
33
34    /* Get the Ring 0 TSS */
35    mov ax, KGDT_TSS
36    ltr ax
37
38    /* Save loader block and entrypoint */
39    mov ecx, [esp+4]
40    mov eax, [esp+8]
41
42    /* Create initial interrupt frame */
43    xor edx, edx
44    push ecx
45    push edx
46    push KGDT_R0_CODE
47    push eax
48
49    /* Jump to KGDT_R0_CODE:[EAX] */
50    retf
51
52    /* We should never make it here */
53    ret 8
54END
55