FreeCalypso > hg > fc-magnetite
comparison src/gpf2/osl/os_mis_fl.c @ 487:91e8dac34ada
src/gpf2/osl: initial import from old freecalypso-sw tree
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 22 Jun 2018 05:56:16 +0000 |
parents | |
children | 9e55fe3a5ee4 |
comparison
equal
deleted
inserted
replaced
486:c433cca731a3 | 487:91e8dac34ada |
---|---|
1 /* | |
2 * This C module is a reconstruction based on the disassembly of | |
3 * os_mis.obj in frame_na7_db_fl.lib from the Leonardo package. | |
4 */ | |
5 | |
6 /* set of included headers from COFF symtab, slightly reordered: */ | |
7 #include <stddef.h> | |
8 #include <stdio.h> | |
9 #include <string.h> | |
10 #include "../../riviera/rv/general.h" | |
11 #include "../../riviera/rv/rv_general.h" | |
12 #include "../../riviera/rvf/rvf_api.h" | |
13 #include "../../services/ffs/ffs.h" | |
14 #include "gpfconf.h" /* FreeCalypso addition */ | |
15 #include "../../nucleus/nucleus.h" | |
16 #include "typedefs.h" | |
17 #include "os.h" | |
18 #include "gdi.h" | |
19 #include "os_types.h" | |
20 #include "os_glob.h" | |
21 #include "header.h" | |
22 #include "vsi.h" | |
23 #include "drvconf.h" | |
24 #include "../tst_pei/tstdriver.h" | |
25 #include "dar_func.h" | |
26 #include "tools.h" | |
27 | |
28 typedef unsigned char u_char; | |
29 | |
30 char *NU_State[13] = { | |
31 "NU_READY", | |
32 "", | |
33 "NU_SLEEP_SUSPEND", | |
34 "", | |
35 "", | |
36 "NU_QUEUE_SUSPEND", | |
37 "NU_SEMAPHORE_SUSPEND", | |
38 "", | |
39 "NU_PARTITION_SUSPEND", | |
40 "NU_MEMORY_SUSPEND", | |
41 "", | |
42 "NU_FINISHED", | |
43 "NU_TERMINATED", | |
44 }; | |
45 | |
46 char *msg_type[4] = { | |
47 "", | |
48 "PRIMITIVE", | |
49 "SIGNAL", | |
50 "TIMEOUT", | |
51 }; | |
52 | |
53 char *warning = "SYSTEM WARNING: "; | |
54 | |
55 T_GPF_DAR_PROPERTIES *dar; | |
56 T_GPF_DAR_STRUCT os_dar; | |
57 NU_PROTECT os_mis_Protect; | |
58 u_char SystemErrorBuffer[256]; | |
59 u_char DARErrorBuffer[256]; | |
60 | |
61 static u_char state; | |
62 static int fd; | |
63 static unsigned bytes_read; | |
64 static u_char *msg; | |
65 static unsigned count; | |
66 static unsigned data_len; | |
67 static unsigned dar_wrap_around; | |
68 static unsigned dar_buffer_count; | |
69 static unsigned dar_wrap_around_detected; | |
70 | |
71 LONG | |
72 os_read_dar_ffs_data(USHORT entry, char *buffer, USHORT len) | |
73 { | |
74 /* dummy for now */ | |
75 return(OS_ERROR); | |
76 } | |
77 | |
78 LONG | |
79 os_dar_set_filter(void) | |
80 { | |
81 if (dar) | |
82 dar->diagnose_swe_filter(dar->gpf_use_id, dar->warning); | |
83 return(OS_OK); | |
84 } | |
85 | |
86 LONG | |
87 os_dar_register(const void *dar_properties) | |
88 { | |
89 if (dar_properties) { | |
90 os_dar.properties = (T_GPF_DAR_PROPERTIES *) dar_properties; | |
91 os_dar.magic_nr = DAR_INITIALIZED; | |
92 dar = (T_GPF_DAR_PROPERTIES *) dar_properties; | |
93 } | |
94 return(OS_OK); | |
95 } | |
96 | |
97 void | |
98 os_dar_init(void) | |
99 { | |
100 if (os_dar.magic_nr != DAR_INITIALIZED) | |
101 dar = 0; | |
102 } | |
103 | |
104 void | |
105 os_SystemError(OS_HANDLE Caller, USHORT cause, char *buffer) | |
106 { | |
107 /* | |
108 * The implementation of this function in the binary blob | |
109 * which we are reversing is very complex. I am leaving it | |
110 * as an empty stub for now. - Space Falcon | |
111 */ | |
112 } | |
113 | |
114 GLOBAL LONG | |
115 os_ObjectInformation(OS_HANDLE Caller, USHORT Id, USHORT Handle, USHORT len, | |
116 void *Buffer) | |
117 { | |
118 switch (Id) { | |
119 case OS_OBJTASK: | |
120 return os_TaskInformation(Handle, Buffer); | |
121 case OS_OBJQUEUE: | |
122 return os_QueueInformation(Handle, Buffer); | |
123 case OS_OBJPARTITIONGROUP: | |
124 return os_PartitionInformation(Handle, Buffer); | |
125 case OS_OBJMEMORYPOOL: | |
126 return os_MemoryInformation(Handle, Buffer); | |
127 case OS_OBJTIMER: | |
128 return os_TimerInformation(Handle, Buffer); | |
129 case OS_OBJSEMAPHORE: | |
130 return os_SemaphoreInformation(Handle, Buffer); | |
131 default: | |
132 return(OS_ERROR); | |
133 } | |
134 } | |
135 | |
136 GLOBAL LONG | |
137 os_Initialize(void) | |
138 { | |
139 if (os_SemInit() == OS_ERROR) | |
140 return(OS_ERROR); | |
141 if (os_ProInit() == OS_ERROR) | |
142 return(OS_ERROR); | |
143 if (os_ComInit() == OS_ERROR) | |
144 return(OS_ERROR); | |
145 if (os_MemInit() == OS_ERROR) | |
146 return(OS_ERROR); | |
147 if (os_TimInit() == OS_ERROR) | |
148 return(OS_ERROR); | |
149 if (os_isr_init() == OS_ERROR) | |
150 return(OS_ERROR); | |
151 #if 0 | |
152 if (os_EvGrpInit() == OS_ERROR) | |
153 return(OS_ERROR); | |
154 #endif | |
155 /* | |
156 * The original code zeroes out the first 32-bit word of | |
157 * os_mis_Protect here. We don't really need to do that, | |
158 * as it is a zeroed-on-boot bss var. | |
159 */ | |
160 os_dar_init(); /* inlined in the original */ | |
161 return(OS_OK); | |
162 } |