revert between 56095 -> 55830 in arch
[AROS.git] / arch / all-mingw32 / exec / platform_init.c
blob1e5a714fb78d09c75cc700863fddb8ae5c61b165
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/kernel.h>
7 #include <proto/arossupport.h>
8 #include <proto/exec.h>
10 #include "../kernel/hostinterface.h"
11 #include "exec_intern.h"
14 * Note that we are called very early, so no exec calls here! We don't have
15 * ExecBase's functions table yet, only empty data structure!
16 * In fact this routine exists only because of need to link up FlushInstructionCache()
17 * function before creating vector table. This is done for convenience, what if at some
18 * point we are using complete jumps as vectors ? All other functions could be linked
19 * in normal init routine. But, well, we do it all in one place.
21 BOOL Exec_PreparePlatform(struct Exec_PlatformData *pd, struct TagItem *msg)
23 struct TagItem *tag;
24 struct HostInterface *HostIFace;
25 void *KernelLib;
26 APTR __stdcall (*GetCurrentProcess)(void);
28 tag = LibFindTagItem(KRN_HostInterface, msg);
29 if (!tag)
30 return FALSE;
32 HostIFace = (struct HostInterface *)tag->ti_Data;
34 KernelLib = HostIFace->hostlib_Open("kernel32.dll", NULL);
35 if (!KernelLib)
36 return FALSE;
38 pd->ExitProcess = HostIFace->hostlib_GetPointer(KernelLib, "ExitProcess", NULL);
39 if (!pd->ExitProcess)
40 return FALSE;
42 pd->FlushInstructionCache = HostIFace->hostlib_GetPointer(KernelLib, "FlushInstructionCache", NULL);
43 if (!pd->FlushInstructionCache)
44 return FALSE;
46 GetCurrentProcess = HostIFace->hostlib_GetPointer(KernelLib, "GetCurrentProcess", NULL);
47 if (!GetCurrentProcess)
48 return FALSE;
50 pd->Reboot = HostIFace->Reboot;
51 pd->MyProcess = GetCurrentProcess();
53 return TRUE;