disable warnings about unused local typedefs
[AROS-Contrib.git] / Misc / berger / kernellibs.c
blob62306d342f13ab284ce0e04c62a6d5ec8ed6eca8
1 #include <exec/types.h>
3 #include "kernellibs.h"
4 #include "debug.h"
6 #include "callfuncs.c"
8 struct LibCall Exec_Funcs[]=
10 {NULL, "open"},
11 {NULL, "close"},
12 {NULL, "null"},
13 {NULL, "null"},
14 {call_A5_VOID, "Supervisor"},
15 {call_A0_A1_A2, "PrepareContext"},
16 {NULL, "Private2"},
17 {call_A0_VOID, "Reschedule"},
18 {call_VOID, "Switch"},
19 {call_VOID, "Dispatch"},
20 {call_VOID, "Exception"},
21 {call_D0_D1_VOID, "InitCode"},
22 {call_A1_A2_D0_VOID, "InitStruct"},
23 {call_A0_A1_A2_D0_D1, "MakeLibrary"},
24 {call_A0_A1_A2, "MakeFunctions"},
25 {call_A1, "FindResident"},
26 {call_A1_D1, "InitResident"},
27 {call_D7_VOID, "Alert"},
28 {call_D0_VOID, "Debug"},
29 {call_VOID, "Disable"},
30 {call_VOID, "Enable"},
31 {call_VOID, "Forbid"},
32 {call_VOID, "Permit"},
33 {call_D0_D1, "SetSR"},
34 {call_VOID, "SuperState"},
35 {call_D0_VOID, "UserState"},
36 {call_D0_A1, "SetIntVector"},
37 {call_D0_A1_VOID, "AddIntServer"},
38 {call_D0_A1_VOID, "RemIntServer"},
39 {call_A1_VOID, "Cause"},
40 {call_A0_D0, "Allocate"},
41 {call_A0_A1_D0_VOID, "Deallocate"},
42 {call_D0_D1, "AllocMem"},
43 {call_D0_D1, "AllocAbs"},
44 {call_A1_D0_VOID, "FreeMem"},
45 {call_D1, "AvailMem"},
46 {call_A0, "AllocEntry"},
47 {call_A0_VOID, "FreeEntry"},
48 {call_A0_A1_A2, "Insert"},
49 {call_A0_A1_VOID, "AddHead"},
50 {call_A0_A1_VOID, "AddTail"},
51 {call_A1_VOID, "Remove"},
52 {call_A0, "RemHead"},
53 {call_A0, "RemTail"},
54 {call_A0_A1_VOID, "Enqueue"},
55 {call_A0_A1, "FindName"},
56 {call_A1_A2_A3, "AddTask"},
57 {call_A1_VOID, "RemTask"},
58 {call_A1, "FindTask"},
59 {call_A1_D0, "SetTaskPri"},
60 {call_D0_D1, "SetSignal"},
61 {call_D0_D1, "SetExcept"},
62 {call_D0, "Wait"},
63 {call_A1_D0_VOID, "Signal"},
64 {call_D0, "AllocSignal"},
65 {call_D0_VOID, "FreeSignal"},
66 {call_D0, "AllocTrap"},
67 {call_D0_VOID, "FreeTrap"},
68 {call_A1_VOID, "AddPort"},
69 {call_A1_VOID, "RemPort"},
70 {call_A0_A1_VOID, "PutMsg"},
71 {call_A0, "GetMsg"},
72 {call_A1_VOID, "ReplyMsg"},
73 {call_A0, "WaitPort"},
74 {call_A1, "FindPort"},
75 {call_A1_VOID, "AddLibrary"},
76 {call_A1_VOID, "RemLibrary"},
77 {call_A1_D0, "OldOpenLibrary"},
78 {call_A1_VOID, "CloseLibrary"},
79 {call_A1_A0_D0, "SetFunction"},
80 {call_A1_VOID, "SumLibrary"},
81 {call_A1_VOID, "AddDevice"},
82 {call_A1_VOID, "RemDevice"},
83 {call_A0_D0_A1_D1, "OpenDevice"},
84 {call_A1_VOID, "CloseDevice"},
85 {call_A1, "DoIO"},
86 {call_A1_VOID, "SendIO"},
87 {call_A1, "CheckIO"},
88 {call_A1, "WaitIO"},
89 {call_A1, "AbortIO"},
90 {call_A1_VOID, "AddResource"},
91 {call_A1_VOID, "RemResource"},
92 {call_A1, "OpenResource"},
93 {call_VOID, "RawIOInit"},
94 {call_NOPARM, "RawMayGetChar"},
95 {call_D0_VOID, "RawPutChar"}
101 struct Libbases Libbasetable[]=
103 {NULL, Exec_Funcs},
104 {-1, -1}
108 extern struct ExecBase * SysBase;
110 void init_libbases(void)
112 /* fetch the library bases */
113 Libbasetable[0].baseptr = (struct Library *)SysBase;
117 void dolibcall()
119 int i = 0;
120 BOOL found = FALSE;
121 while (-1 != (LONG)(Libbasetable[i].baseptr))
123 if (CPU.A[6] == (ULONG)Libbasetable[i].baseptr)
125 ULONG offset;
126 /* It's this entry */
127 offset = (CPU.PC-CPU.A[6])/6 - 1;
128 SHOW_OPCODE("Doing libcall to function %s\n",(Libbasetable[i].libcall)[offset].funcname);
129 (Libbasetable[i].libcall)[offset].func(*(ULONG *)(CPU.PC+2));
130 found = TRUE;
132 /* do a fake RTS so we get back into m68k code */
133 CPU.PC = *(ULONG *)(CPU.A[7]);
134 CPU.A[7] += 4;
135 CPU.instsize = 0;
136 break;
138 i++;