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