FreeCalypso > hg > fc-selenite
annotate src/gpf/frame/cust_os/osx.c @ 85:4ef6808ea50e
components/main_ir: created for assembly modules
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 20 Jul 2018 20:22:38 +0000 |
parents | 8b2a9a374324 |
children |
rev | line source |
---|---|
6
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This C module is a reconstruction based on the disassembly of |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * osx.obj in osx_na7_db.lib from the Leonardo package. |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 /* reconstructed set of included headers from COFF symtab: */ |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdio.h> |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdlib.h> |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <string.h> |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include "typedefs.h" |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include "vsi.h" |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include "cust_os.h" |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 int osx_config = 2; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 int _caller; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 T_OSX_REGISTER _osx_registry[MAX_OSX_QUEUE]; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 void |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 int_osx_send_sig(int caller, unsigned long opc, void *signal_ptr, |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 int queue_handle) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 T_QMSG Message; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 int status; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 TRACE_ASSERT(queue_handle != 0); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 Message.MsgType = MSG_SIGNAL; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 Message.Msg.Signal.SigOPC = opc; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 Message.Msg.Signal.SigBuffer = signal_ptr; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 Message.Msg.Signal.SigLen = sizeof(xSignalHeaderRec); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 status = vsi_c_send(caller, queue_handle, &Message FILE_LINE_MACRO); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 TRACE_ASSERT(status == VSI_OK); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 void |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 osx_send_sig(unsigned long opc, void *signal_ptr, T_ENUM_OS_QUEUE queue_type) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 int caller, queue_handle; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 caller = _osx_registry[queue_type].caller; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 queue_handle = _osx_registry[queue_type].queue_handle; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 TRACE_ASSERT(queue_handle != 0); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 int_osx_send_sig(caller, opc, signal_ptr, queue_handle); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 void |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 int_osx_free_prim(int caller, xSignalHeaderRec *prim_ptr) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 vsi_c_free(caller, (T_VOID_STRUCT **) &prim_ptr FILE_LINE_MACRO); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 void |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 int_osx_send_prim(int caller, xSignalHeaderRec *prim_ptr, int queue_handle) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 T_QMSG Message; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 int status; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 if (osx_config & 1 && prim_ptr->SignalCode == 0x7D) { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 vsi_c_free(caller, (T_VOID_STRUCT **) &prim_ptr |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 FILE_LINE_MACRO); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 return; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 TRACE_ASSERT(queue_handle != 0); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 Message.MsgType = MSG_PRIMITIVE; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 Message.Msg.Primitive.Prim = (T_VOID_STRUCT *) prim_ptr; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 Message.Msg.Primitive.PrimLen = sizeof(xSignalHeaderRec); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 status = vsi_c_send(caller, queue_handle, &Message FILE_LINE_MACRO); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 TRACE_ASSERT(status == VSI_OK); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 void |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 osx_send_prim(xSignalHeaderRec *prim_ptr, T_ENUM_OS_QUEUE queue_type) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 int_osx_send_prim(_osx_registry[queue_type].caller, prim_ptr, |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 _osx_registry[queue_type].queue_handle); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 xSignalHeaderRec * |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 int_osx_receive_prim(int caller, int queue_handle) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 T_QMSG Message; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 unsigned opc; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 xSignalHeaderRec *message; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 int status; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 TRACE_ASSERT(queue_handle != OSX_ERROR); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 for (;;) { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 status = vsi_c_await(caller, queue_handle, &Message, |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 0xFFFFFFFF); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 TRACE_ASSERT(status == VSI_OK); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 /* |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 * Disassembly reveals that the original code expects |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 * the received message to be a primitive, rather than |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 * a signal or a timeout. If one of the latter comes |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 * in, the original code would go haywire. Hence the |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 * following TRACE_ASSERT is a FreeCalypso addition. |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 */ |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 TRACE_ASSERT(Message.MsgType == MSG_PRIMITIVE); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 message = (xSignalHeaderRec *) Message.Msg.Primitive.Prim; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 opc = message->SignalCode & 0xFFFF; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 if (opc == 11 && osx_config & 2) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 message->SigP = *(DummyStruct **)(message + 1); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 else |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 message->SigP = (DummyStruct *)(message + 1); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 if (opc != 0x8000) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 return(message); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 vsi_c_primitive(caller, message); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 xSignalHeaderRec * |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 osx_receive_prim(T_ENUM_OS_QUEUE queue_type) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 return int_osx_receive_prim(_osx_registry[queue_type].caller, |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 _osx_registry[queue_type].queue_handle); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 void |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 osx_free_prim(xSignalHeaderRec *prim_ptr) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 vsi_c_free(_caller, (T_VOID_STRUCT **) &prim_ptr FILE_LINE_MACRO); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 void |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 int_osx_free_mem(int caller, void *mem_ptr) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 int status; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 TRACE_ASSERT(mem_ptr != 0); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 status = D_FREE(mem_ptr); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 TRACE_ASSERT(status == VSI_OK); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 void |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 osx_free_mem(void *mem_ptr) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 int_osx_free_mem(_caller, mem_ptr); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 xSignalHeaderRec * |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 int_osx_alloc_prim(int caller, unsigned long len, int pool_group_handle) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 xSignalHeaderRec *prim_ptr; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 prim_ptr = (xSignalHeaderRec *) vsi_c_new(caller, |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 (len & 0xFFFF) + sizeof(xSignalHeaderRec), 0 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 FILE_LINE_MACRO); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 /* This check is a FreeCalypso addition */ |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 TRACE_ASSERT(prim_ptr != 0); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 prim_ptr->SigP = (DummyStruct *)(prim_ptr + 1); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 return(prim_ptr); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 xSignalHeaderRec * |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 osx_alloc_prim(unsigned long len) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 xSignalHeaderRec *prim_ptr; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 prim_ptr = (xSignalHeaderRec *) vsi_c_new(_caller, |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 (len & 0xFFFF) + sizeof(xSignalHeaderRec), 0 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 FILE_LINE_MACRO); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 /* This check is a FreeCalypso addition */ |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 TRACE_ASSERT(prim_ptr != 0); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 prim_ptr->SigP = (DummyStruct *)(prim_ptr + 1); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 return(prim_ptr); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 void * |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 int_osx_alloc_mem(int caller, unsigned long len) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 void *mem_ptr; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 DMALLOC(mem_ptr, len); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 TRACE_ASSERT(mem_ptr != 0); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 return(mem_ptr); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 void * |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 osx_alloc_mem(unsigned long len) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 return int_osx_alloc_mem(_caller, len); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 int |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 _osx_open(int caller, unsigned short queue_type, int queue_handle) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 if (!queue_type && !queue_handle) { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 _caller = caller; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 return(OSX_ERROR); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 if (queue_type >= MAX_OSX_QUEUE) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 return(OSX_ERROR); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 if (_osx_registry[queue_type].queue_handle != queue_handle && |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 _osx_registry[queue_type].queue_handle != -1) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 return(OSX_ERROR); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 _osx_registry[queue_type].queue_handle = queue_handle; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 _osx_registry[queue_type].caller = caller; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 return(OSX_OK); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
200 void |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 _osx_init(void) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
202 { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 USHORT i; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 for (i = 0; i < MAX_OSX_QUEUE; i++) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 _osx_registry[i].queue_handle = -1; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 int |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 _osx_config(const char *config) |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 if (!strcmp(config, L1S_TRACE_DISABLE)) { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
213 osx_config |= 1; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
214 return(OSX_OK); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
215 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
216 if (!strcmp(config, L1S_TRACE_ENABLE)) { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
217 osx_config &= ~1; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
218 return(OSX_OK); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
219 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
220 if (!strcmp(config, NO_SPECIAL_MPHC_RXLEV_REQ)) { |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
221 osx_config &= ~2; |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
222 return(OSX_OK); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
223 } |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
224 return(OSX_ERROR); |
8b2a9a374324
src/gpf: addition of Magnetite src/gpf2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
225 } |