Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / arch / i386-darwin / kernel / kernel_hostlib.c
blobc6352a93c343be7ac6585e4f2208a67e7f811a9a
1 #include <aros/debug.h>
2 #include <inttypes.h>
3 #include <aros/symbolsets.h>
4 #include <exec/lists.h>
5 #include <memory.h>
6 #include <exec/resident.h>
7 #include <exec/memheaderext.h>
8 #include <utility/tagitem.h>
10 #include <proto/exec.h>
11 #include <proto/kernel.h>
12 #include <aros/kernel.h>
13 #include <proto/arossupport.h>
15 #include <clib/alib_protos.h>
17 #include "kernel_intern.h"
19 void prepare_host_hook(struct Hook * hook)
21 hook->h_Entry = HookEntry;
25 AROS_LH1(struct TagItem *, KrnGetHooks,
27 /* SYNOPSIS */
28 AROS_LHA(UBYTE *, name, A1),
30 /* LOCATION */
31 struct KernelBase *, KernelBase, 2, Kernel)
33 AROS_LIBFUNC_INIT
36 struct TagItem * hooks = 0;
37 int i;
40 if (name == NULL)
42 struct TagItem * msg = KrnGetBootInfo();
43 hooks = (struct TagItem *)krnGetTagData(KRN_KernelHooks, 0, msg);
44 } else {
45 KRNWireImpl(LoadNativeLib);
46 hooks = CALLHOOKPKT(krnLoadNativeLibImpl,name,0);
49 for (i = 0; hooks[i].ti_Tag != TAG_DONE; ++i)
51 struct Hook* hook = (struct Hook*)hooks[i].ti_Data;
52 prepare_host_hook(hook);
55 return hooks;
57 AROS_LIBFUNC_EXIT
60 AROS_LH1(struct TagItem *, KrnRelaseHooks,
62 /* SYNOPSIS */
63 AROS_LHA(struct TagItem *, handle, A1),
65 /* LOCATION */
66 struct KernelBase *, KernelBase, 2, Kernel)
68 AROS_LIBFUNC_INIT
69 if (handle != NULL)
71 KRNWireImpl(UnloadNativeLib);
72 CALLHOOKPKT(krnUnloadNativeLibImpl,handle,0);
74 AROS_LIBFUNC_EXIT
76 #if 0
80 AROS_LH2(void, KrnImportHookListToHost,
82 /* SYNOPSIS */
83 AROS_LHA(struct TagItem *, hooks, A1),
84 AROS_LHA(const char*, name, A2),
86 /* LOCATION */
87 struct KernelBase *, KernelBase, 20, Kernel)
89 AROS_LIBFUNC_INIT
91 struct TagItem[2] tags;
93 tags[0].ti_tag = KRN_HookList;
94 tags[0].ti_data = (ULONG)hooks;
95 tags[1].ti_tag = KRN_HookListName;
96 tags[1].ti_data = (ULONG)name;
98 AROS_LIBFUNC_EXIT
101 #endif