1 | /*␊ |
2 | * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights␊ |
7 | * Reserved. This file contains Original Code and/or Modifications of␊ |
8 | * Original Code as defined in and that are subject to the Apple Public␊ |
9 | * Source License Version 2.0 (the 'License'). You may not use this file␊ |
10 | * except in compliance with the License. Please obtain a copy of the␊ |
11 | * License at http://www.apple.com/publicsource and read it before using␊ |
12 | * this file.␊ |
13 | * ␊ |
14 | * The Original Code and all software distributed under the License are␊ |
15 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
18 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the␊ |
19 | * License for the specific language governing rights and limitations␊ |
20 | * under the License.␊ |
21 | * ␊ |
22 | * @APPLE_LICENSE_HEADER_END@␊ |
23 | */␊ |
24 | /*␊ |
25 | * drivers.c - Driver Loading Functions.␊ |
26 | *␊ |
27 | * Copyright (c) 2000 Apple Computer, Inc.␊ |
28 | *␊ |
29 | * DRI: Josh de Cesare␊ |
30 | */␊ |
31 | ␊ |
32 | #include <mach-o/fat.h>␊ |
33 | #include <libkern/OSByteOrder.h>␊ |
34 | #include <mach/machine.h>␊ |
35 | ␊ |
36 | #include "sl.h"␊ |
37 | #include "boot.h"␊ |
38 | #include "bootstruct.h"␊ |
39 | #include "xml.h"␊ |
40 | #include "ramdisk.h"␊ |
41 | #include "modules.h"␊ |
42 | ␊ |
43 | #if DEBUG␊ |
44 | #define DBG(x...)␉printf(x)␊ |
45 | #else␊ |
46 | #define DBG(x...)␉msglog(x)␊ |
47 | #endif␊ |
48 | ␊ |
49 | // extern char gMacOSVersion[8];␊ |
50 | ␊ |
51 | struct Module { ␊ |
52 | ␉struct Module *nextModule;␊ |
53 | ␉long willLoad;␊ |
54 | ␉TagPtr dict;␊ |
55 | ␉char *plistAddr;␊ |
56 | ␉long plistLength;␊ |
57 | ␉char *executablePath;␊ |
58 | ␉char *bundlePath;␊ |
59 | ␉long bundlePathLength;␊ |
60 | };␊ |
61 | typedef struct Module Module, *ModulePtr;␊ |
62 | ␊ |
63 | struct DriverInfo {␊ |
64 | ␉char *plistAddr;␊ |
65 | ␉long plistLength;␊ |
66 | ␉void *executableAddr;␊ |
67 | ␉long executableLength;␊ |
68 | ␉void *bundlePathAddr;␊ |
69 | ␉long bundlePathLength;␊ |
70 | };␊ |
71 | typedef struct DriverInfo DriverInfo, *DriverInfoPtr;␊ |
72 | ␊ |
73 | #define kDriverPackageSignature1 'MKXT'␊ |
74 | #define kDriverPackageSignature2 'MOSX'␊ |
75 | ␊ |
76 | struct DriversPackage {␊ |
77 | unsigned long signature1;␊ |
78 | unsigned long signature2;␊ |
79 | unsigned long length;␊ |
80 | unsigned long adler32;␊ |
81 | unsigned long version;␊ |
82 | unsigned long numDrivers;␊ |
83 | unsigned long reserved1;␊ |
84 | unsigned long reserved2;␊ |
85 | };␊ |
86 | typedef struct DriversPackage DriversPackage;␊ |
87 | ␊ |
88 | enum {␊ |
89 | ␉kCFBundleType2,␊ |
90 | ␉kCFBundleType3␊ |
91 | };␊ |
92 | ␊ |
93 | long (*LoadExtraDrivers_p)(FileLoadDrivers_t FileLoadDrivers_p);␊ |
94 | ␊ |
95 | /*static*/ unsigned long Adler32( unsigned char * buffer, long length );␊ |
96 | ␊ |
97 | long FileLoadDrivers(char *dirSpec, long plugin);␊ |
98 | long NetLoadDrivers(char *dirSpec);␊ |
99 | long LoadDriverMKext(char *fileSpec);␊ |
100 | long LoadDriverPList(char *dirSpec, char *name, long bundleType);␊ |
101 | long LoadMatchedModules(void);␊ |
102 | ␊ |
103 | static long MatchPersonalities(void);␊ |
104 | static long MatchLibraries(void);␊ |
105 | #ifdef NOTDEF␊ |
106 | static ModulePtr FindModule(char *name);␊ |
107 | static void ThinFatFile(void **loadAddrP, unsigned long *lengthP);␊ |
108 | #endif␊ |
109 | static long ParseXML(char *buffer, ModulePtr *module, TagPtr *personalities);␊ |
110 | static long InitDriverSupport(void);␊ |
111 | ␊ |
112 | ModulePtr gModuleHead, gModuleTail;␊ |
113 | static TagPtr gPersonalityHead, gPersonalityTail;␊ |
114 | static char * gExtensionsSpec;␊ |
115 | static char * gDriverSpec;␊ |
116 | static char * gFileSpec;␊ |
117 | static char * gTempSpec;␊ |
118 | static char * gFileName;␊ |
119 | ␊ |
120 | /*static*/ unsigned long␊ |
121 | Adler32( unsigned char * buffer, long length )␊ |
122 | {␊ |
123 | ␉long cnt;␊ |
124 | ␉unsigned long result, lowHalf, highHalf;␊ |
125 | ␊ |
126 | ␉lowHalf = 1;␊ |
127 | ␉highHalf = 0;␊ |
128 | ␊ |
129 | ␉for (cnt = 0; cnt < length; cnt++)␊ |
130 | ␉{␊ |
131 | ␉␉if ((cnt % 5000) == 0)␊ |
132 | ␉␉{␊ |
133 | ␉␉␉lowHalf %= 65521L;␊ |
134 | ␉␉␉highHalf %= 65521L;␊ |
135 | ␉␉}␊ |
136 | ␊ |
137 | ␉␉lowHalf += buffer[cnt];␊ |
138 | ␉␉highHalf += lowHalf;␊ |
139 | ␉}␊ |
140 | ␊ |
141 | ␉lowHalf %= 65521L;␊ |
142 | ␉highHalf %= 65521L;␊ |
143 | ␊ |
144 | ␉result = (highHalf << 16) | lowHalf;␊ |
145 | ␊ |
146 | ␉return result;␊ |
147 | }␊ |
148 | ␊ |
149 | ␊ |
150 | //==========================================================================␊ |
151 | // InitDriverSupport␊ |
152 | ␊ |
153 | static long␊ |
154 | InitDriverSupport( void )␊ |
155 | {␊ |
156 | ␉gExtensionsSpec = malloc( 4096 );␊ |
157 | ␉gDriverSpec = malloc( 4096 );␊ |
158 | ␉gFileSpec = malloc( 4096 );␊ |
159 | ␉gTempSpec = malloc( 4096 );␊ |
160 | ␉gFileName = malloc( 4096 );␊ |
161 | ␊ |
162 | ␉if ( !gExtensionsSpec || !gDriverSpec || !gFileSpec || !gTempSpec || !gFileName ) {␊ |
163 | ␉␉stop("InitDriverSupport error");␊ |
164 | ␉}␊ |
165 | ␊ |
166 | ␉return 0;␊ |
167 | }␊ |
168 | ␊ |
169 | //==========================================================================␊ |
170 | // LoadDrivers␊ |
171 | ␊ |
172 | long LoadDrivers( char * dirSpec )␊ |
173 | {␊ |
174 | ␉char dirSpecExtra[1024];␊ |
175 | ␊ |
176 | ␉if ( InitDriverSupport() != 0 ) {␊ |
177 | ␉␉return 0;␊ |
178 | ␉}␊ |
179 | ␊ |
180 | ␉// Load extra drivers if a hook has been installed.␊ |
181 | ␉if (LoadExtraDrivers_p != NULL)␊ |
182 | ␉{␊ |
183 | ␉␉(*LoadExtraDrivers_p)(&FileLoadDrivers);␊ |
184 | ␉}␊ |
185 | ␊ |
186 | ␉if ( gBootFileType == kNetworkDeviceType )␊ |
187 | ␉{␊ |
188 | ␉␉if (NetLoadDrivers(dirSpec) != 0)␊ |
189 | ␉␉{␊ |
190 | ␉␉␉error("Could not load drivers from the network\n");␊ |
191 | ␉␉␉return -1;␊ |
192 | ␉␉}␊ |
193 | ␉}␊ |
194 | ␉else if ( gBootFileType == kBlockDeviceType )␊ |
195 | ␉{␊ |
196 | ␉␉// First try to load Extra extensions from the ramdisk if isn't aliased as bt(0,0).␊ |
197 | ␉␉if (gRAMDiskVolume && !gRAMDiskBTAliased)␊ |
198 | ␉␉{␊ |
199 | ␉␉␉strcpy(dirSpecExtra, "rd(0,0)/Extra/");␊ |
200 | ␉␉␉FileLoadDrivers(dirSpecExtra, 0);␊ |
201 | ␉␉}␊ |
202 | ␊ |
203 | ␉␉// Next try to load Extra extensions from the selected root partition.␊ |
204 | ␉␉strcpy(dirSpecExtra, "/Extra/");␊ |
205 | ␉␉if (FileLoadDrivers(dirSpecExtra, 0) != 0) {␊ |
206 | ␉␉␉// If failed, then try to load Extra extensions from the boot partition␊ |
207 | ␉␉␉// in case we have a separate booter partition or a bt(0,0) aliased ramdisk.␊ |
208 | ␉␉␉if ( !(gBIOSBootVolume->biosdev == gBootVolume->biosdev && gBIOSBootVolume->part_no == gBootVolume->part_no)␊ |
209 | ␉␉␉␉|| (gRAMDiskVolume && gRAMDiskBTAliased) ) {␊ |
210 | ␉␉␉␉// Next try a specfic OS version folder ie 10.5␊ |
211 | ␉␉␉␉sprintf(dirSpecExtra, "bt(0,0)/Extra/%s/", &gMacOSVersion);␊ |
212 | ␉␉␉␉if (FileLoadDrivers(dirSpecExtra, 0) != 0) {␊ |
213 | ␉␉␉␉␉// Next we'll try the base␊ |
214 | ␉␉␉␉␉strcpy(dirSpecExtra, "bt(0,0)/Extra/");␊ |
215 | ␉␉␉␉␉FileLoadDrivers(dirSpecExtra, 0);␊ |
216 | ␉␉␉␉}␊ |
217 | ␉␉␉}␊ |
218 | ␉␉}␊ |
219 | ␉␉if(!gHaveKernelCache) {␊ |
220 | ␉␉␉// Don't load main driver (from /System/Library/Extentions) if gHaveKernelCache is set.␊ |
221 | ␉␉␉// since these drivers will already be in the kernel cache.␊ |
222 | ␉␉␉// NOTE: when gHaveKernelCache, xnu cannot (by default) load *any* extra kexts from the bootloader.␊ |
223 | ␉␉␉// The /Extra code is not disabled in this case due to a kernel patch that allows for this to happen.␊ |
224 | ␊ |
225 | ␉␉␉// Also try to load Extensions from boot helper partitions.␊ |
226 | ␉␉␉if (gBootVolume->flags & kBVFlagBooter) {␊ |
227 | ␉␉␉␉strcpy(dirSpecExtra, "/com.apple.boot.P/System/Library/");␊ |
228 | ␉␉␉␉if (FileLoadDrivers(dirSpecExtra, 0) != 0) {␊ |
229 | ␉␉␉␉␉strcpy(dirSpecExtra, "/com.apple.boot.R/System/Library/");␊ |
230 | ␉␉␉␉␉if (FileLoadDrivers(dirSpecExtra, 0) != 0) {␊ |
231 | ␉␉␉␉␉␉strcpy(dirSpecExtra, "/com.apple.boot.S/System/Library/");␊ |
232 | ␉␉␉␉␉␉FileLoadDrivers(dirSpecExtra, 0);␊ |
233 | ␉␉␉␉␉}␊ |
234 | ␉␉␉␉}␊ |
235 | ␉␉␉}␊ |
236 | ␊ |
237 | ␉␉␉if (gMKextName[0] != '\0') {␊ |
238 | ␉␉␉␉verbose("LoadDrivers: Loading from [%s]\n", gMKextName);␊ |
239 | ␉␉␉␉if ( LoadDriverMKext(gMKextName) != 0 ) {␊ |
240 | ␉␉␉␉␉error("Could not load %s\n", gMKextName);␊ |
241 | ␉␉␉␉␉return -1;␊ |
242 | ␉␉␉␉}␊ |
243 | ␉␉␉} else {␊ |
244 | ␉␉␉␉if (gMacOSVersion[3] == '9') {␊ |
245 | ␉␉␉␉␉strlcpy(gExtensionsSpec, dirSpec, 4087); /* 4096 - sizeof("Library/") */␊ |
246 | ␉␉␉␉␉strcat(gExtensionsSpec, "Library/");␊ |
247 | ␉␉␉␉␉FileLoadDrivers(gExtensionsSpec, 0);␊ |
248 | ␉␉␉␉}␊ |
249 | ␉␉␉␉strlcpy(gExtensionsSpec, dirSpec, 4080); /* 4096 - sizeof("System/Library/") */␊ |
250 | ␉␉␉␉strcat(gExtensionsSpec, "System/Library/");␊ |
251 | ␉␉␉␉FileLoadDrivers(gExtensionsSpec, 0);␊ |
252 | ␉␉␉}␊ |
253 | ␊ |
254 | ␉␉}␊ |
255 | ␉} else {␊ |
256 | ␉␉return 0;␊ |
257 | ␉}␊ |
258 | ␊ |
259 | ␉MatchPersonalities();␊ |
260 | ␊ |
261 | ␉MatchLibraries();␊ |
262 | ␊ |
263 | ␉LoadMatchedModules();␊ |
264 | ␊ |
265 | ␉return 0;␊ |
266 | }␊ |
267 | ␊ |
268 | //==========================================================================␊ |
269 | // FileLoadMKext␊ |
270 | ␊ |
271 | static long␊ |
272 | FileLoadMKext( const char * dirSpec, const char * extDirSpec )␊ |
273 | {␊ |
274 | long ret, flags;␊ |
275 | u_int32_t time, time2;␊ |
276 | ␉char␉altDirSpec[512];␊ |
277 | ␉␊ |
278 | ␉snprintf(altDirSpec, sizeof(altDirSpec), "%s%s", dirSpec, extDirSpec);␊ |
279 | ␉ret = GetFileInfo(altDirSpec, "Extensions.mkext", &flags, &time);␊ |
280 | ␊ |
281 | ␉if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeFlat))␊ |
282 | ␉{␊ |
283 | ␉␉ret = GetFileInfo(dirSpec, "Extensions", &flags, &time2);␊ |
284 | ␊ |
285 | ␉␉if ((ret != 0)␊ |
286 | ␉␉␉|| ((flags & kFileTypeMask) != kFileTypeDirectory)␊ |
287 | ␉␉␉|| (((gBootMode & kBootModeSafe) == 0) && (time == (time2 + 1))))␊ |
288 | ␉␉{␊ |
289 | ␉␉␉snprintf(gDriverSpec, sizeof(altDirSpec) + 18, "%sExtensions.mkext", altDirSpec);␊ |
290 | ␉␉␉verbose("LoadDrivers: Loading from [%s]\n", gDriverSpec);␊ |
291 | ␊ |
292 | ␉␉␉if (LoadDriverMKext(gDriverSpec) == 0) {␊ |
293 | ␉␉␉␉return 0;␊ |
294 | ␉␉␉}␊ |
295 | ␉␉}␊ |
296 | ␉}␊ |
297 | ␉return -1;␊ |
298 | }␊ |
299 | ␊ |
300 | //==========================================================================␊ |
301 | // FileLoadDrivers␊ |
302 | ␊ |
303 | long␊ |
304 | FileLoadDrivers( char * dirSpec, long plugin )␊ |
305 | {␊ |
306 | ␉long long␉ index;␊ |
307 | ␉long ret, length, flags, bundleType;␊ |
308 | ␉long result = -1;␊ |
309 | u_int32_t time;␊ |
310 | ␉const char * name;␊ |
311 | ␊ |
312 | ␉if ( !plugin )␊ |
313 | ␉{␊ |
314 | ␉␉// First try 10.6's path for loading Extensions.mkext.␊ |
315 | ␉␉if (FileLoadMKext(dirSpec, "Caches/com.apple.kext.caches/Startup/") == 0) {␊ |
316 | ␉␉␉return 0;␊ |
317 | ␉␉}␊ |
318 | ␊ |
319 | ␉␉// Next try the legacy path.␊ |
320 | ␉␉else if (FileLoadMKext(dirSpec, "") == 0) {␊ |
321 | ␉␉␉return 0;␊ |
322 | ␉␉}␊ |
323 | ␊ |
324 | ␉␉strcat(dirSpec, "Extensions");␊ |
325 | ␉}␊ |
326 | ␊ |
327 | ␉index = 0;␊ |
328 | ␉while (1)␊ |
329 | ␉{␊ |
330 | ␉␉ret = GetDirEntry(dirSpec, &index, &name, &flags, &time);␊ |
331 | ␉␉if (ret == -1) {␊ |
332 | ␉␉␉break;␊ |
333 | ␉␉}␊ |
334 | ␊ |
335 | ␉␉// Make sure this is a directory.␊ |
336 | ␉␉if ((flags & kFileTypeMask) != kFileTypeDirectory) {␊ |
337 | ␉␉␉continue;␊ |
338 | ␉␉}␊ |
339 | ␊ |
340 | ␉␉// Make sure this is a kext.␊ |
341 | ␉␉length = strlen(name);␊ |
342 | ␉␉if (strcmp(name + length - 5, ".kext")) {␊ |
343 | ␉␉␉continue;␊ |
344 | ␉␉}␊ |
345 | ␊ |
346 | ␉␉// Save the file name.␊ |
347 | ␉␉strlcpy(gFileName, name, 4096);␊ |
348 | ␊ |
349 | ␉␉// Determine the bundle type.␊ |
350 | ␉␉snprintf(gTempSpec, 4096, "%s/%s", dirSpec, gFileName);␊ |
351 | ␉␉ret = GetFileInfo(gTempSpec, "Contents", &flags, &time);␊ |
352 | ␉␉if (ret == 0) {␊ |
353 | ␉␉␉bundleType = kCFBundleType2;␊ |
354 | ␉␉} else {␊ |
355 | ␉␉␉bundleType = kCFBundleType3;␊ |
356 | ␉␉}␊ |
357 | ␊ |
358 | ␉␉if (!plugin) {␊ |
359 | ␉␉␉snprintf(gDriverSpec, 4096, "%s/%s/%sPlugIns", dirSpec, gFileName, (bundleType == kCFBundleType2) ? "Contents/" : "");␊ |
360 | ␉␉}␊ |
361 | ␊ |
362 | ␉␉ret = LoadDriverPList(dirSpec, gFileName, bundleType);␊ |
363 | ␊ |
364 | ␉␉if (result != 0) {␊ |
365 | ␉␉␉result = ret;␊ |
366 | ␉␉}␊ |
367 | ␊ |
368 | ␉␉if (!plugin) {␊ |
369 | ␉␉␉FileLoadDrivers(gDriverSpec, 1);␊ |
370 | ␉␉}␊ |
371 | ␉}␊ |
372 | ␊ |
373 | ␉return result;␊ |
374 | }␊ |
375 | ␊ |
376 | ␊ |
377 | //==========================================================================␊ |
378 | // ␊ |
379 | ␊ |
380 | long␊ |
381 | NetLoadDrivers( char * dirSpec )␊ |
382 | {␊ |
383 | ␉long tries;␊ |
384 | ␊ |
385 | #if NODEF␊ |
386 | ␉long cnt;␊ |
387 | ␊ |
388 | ␉// Get the name of the kernel␊ |
389 | ␉cnt = strlen(gBootFile);␊ |
390 | ␉while (cnt--) {␊ |
391 | ␉␉if ((gBootFile[cnt] == '\\') || (gBootFile[cnt] == ',')) {␊ |
392 | ␉␉␉cnt++;␊ |
393 | ␉␉␉break;␊ |
394 | ␉␉}␊ |
395 | ␉}␊ |
396 | #endif␊ |
397 | ␊ |
398 | ␉// INTEL modification␊ |
399 | ␉snprintf(gDriverSpec, 4096, "%s%s.mkext", dirSpec, bootInfo->bootFile);␊ |
400 | ␊ |
401 | ␉verbose("NetLoadDrivers: Loading from [%s]\n", gDriverSpec);␊ |
402 | ␊ |
403 | ␉tries = 3;␊ |
404 | ␉while (tries--)␊ |
405 | ␉{␊ |
406 | ␉␉if (LoadDriverMKext(gDriverSpec) == 0) {␊ |
407 | ␉␉␉break;␊ |
408 | ␉␉}␊ |
409 | ␉}␊ |
410 | ␉if (tries == -1) {␊ |
411 | ␉␉return -1;␊ |
412 | ␉}␊ |
413 | ␊ |
414 | ␉return 0;␊ |
415 | }␊ |
416 | ␊ |
417 | //==========================================================================␊ |
418 | // loadDriverMKext␊ |
419 | ␊ |
420 | long␊ |
421 | LoadDriverMKext( char * fileSpec )␊ |
422 | {␊ |
423 | ␉unsigned long driversAddr, driversLength;␊ |
424 | ␉long length;␊ |
425 | ␉char segName[32];␊ |
426 | ␉DriversPackage * package;␊ |
427 | ␊ |
428 | #define GetPackageElement(e) OSSwapBigToHostInt32(package->e)␊ |
429 | ␊ |
430 | ␉// Load the MKext.␊ |
431 | ␉length = LoadThinFatFile(fileSpec, (void **)&package);␊ |
432 | ␉if (length < sizeof (DriversPackage)) {␊ |
433 | ␉␉return -1;␊ |
434 | ␉}␊ |
435 | ␊ |
436 | ␉// call hook to notify modules that the mkext has been loaded␊ |
437 | ␉execute_hook("LoadDriverMKext", (void*)fileSpec, (void*)package, (void*) &length, NULL);␊ |
438 | ␊ |
439 | ␉␊ |
440 | ␉// Verify the MKext.␊ |
441 | ␉if (( GetPackageElement(signature1) != kDriverPackageSignature1) ||␊ |
442 | ␉␉( GetPackageElement(signature2) != kDriverPackageSignature2) ||␊ |
443 | ␉␉( GetPackageElement(length) > kLoadSize ) ||␊ |
444 | ␉␉( GetPackageElement(adler32) !=␊ |
445 | ␉␉Adler32((unsigned char *)&package->version, GetPackageElement(length) - 0x10) ) )␊ |
446 | ␉{␊ |
447 | ␉␉return -1;␊ |
448 | ␉}␊ |
449 | ␊ |
450 | ␉// Make space for the MKext.␊ |
451 | ␉driversLength = GetPackageElement(length);␊ |
452 | ␉driversAddr = AllocateKernelMemory(driversLength);␊ |
453 | ␊ |
454 | ␉// Copy the MKext.␊ |
455 | ␉memcpy((void *)driversAddr, (void *)package, driversLength);␊ |
456 | ␊ |
457 | ␉// Add the MKext to the memory map.␊ |
458 | ␉snprintf(segName, sizeof(segName), "DriversPackage-%lx", driversAddr);␊ |
459 | ␉AllocateMemoryRange(segName, driversAddr, driversLength, kBootDriverTypeMKEXT);␊ |
460 | ␊ |
461 | ␉return 0;␊ |
462 | }␊ |
463 | ␊ |
464 | //==========================================================================␊ |
465 | // LoadDriverPList␊ |
466 | ␊ |
467 | long␊ |
468 | LoadDriverPList( char * dirSpec, char * name, long bundleType )␊ |
469 | {␊ |
470 | ␉long length, executablePathLength, bundlePathLength;␊ |
471 | ␉ModulePtr module;␊ |
472 | ␉TagPtr personalities;␊ |
473 | ␉char * buffer = 0;␊ |
474 | ␉char * tmpExecutablePath = 0;␊ |
475 | ␉char * tmpBundlePath = 0;␊ |
476 | ␉long ret = -1;␊ |
477 | ␊ |
478 | ␉do{␊ |
479 | ␉// Save the driver path.␊ |
480 | ␊ |
481 | ␉if(name) {␊ |
482 | ␉␉snprintf(gFileSpec, 4096, "%s/%s/%s", dirSpec, name, (bundleType == kCFBundleType2) ? "Contents/MacOS/" : "");␊ |
483 | ␉} else {␊ |
484 | ␉␉snprintf(gFileSpec, 4096, "%s/%s", dirSpec, (bundleType == kCFBundleType2) ? "Contents/MacOS/" : "");␊ |
485 | ␉}␊ |
486 | ␉executablePathLength = strlen(gFileSpec) + 1;␊ |
487 | ␊ |
488 | ␉tmpExecutablePath = malloc(executablePathLength);␊ |
489 | ␉if (tmpExecutablePath == 0) {␊ |
490 | ␉␉break;␊ |
491 | ␉}␊ |
492 | ␉strcpy(tmpExecutablePath, gFileSpec);␊ |
493 | ␊ |
494 | ␉if(name) {␊ |
495 | ␉␉snprintf(gFileSpec, 4096, "%s/%s", dirSpec, name);␊ |
496 | ␉} else ␉{␊ |
497 | ␉␉snprintf(gFileSpec, 4096, "%s", dirSpec);␊ |
498 | ␉}␊ |
499 | ␉bundlePathLength = strlen(gFileSpec) + 1;␊ |
500 | ␊ |
501 | ␉tmpBundlePath = malloc(bundlePathLength);␊ |
502 | ␉if (tmpBundlePath == 0) {␊ |
503 | ␉␉break;␊ |
504 | ␉}␊ |
505 | ␊ |
506 | ␉strcpy(tmpBundlePath, gFileSpec);␊ |
507 | ␊ |
508 | ␉// Construct the file spec to the plist, then load it.␊ |
509 | ␊ |
510 | ␉if(name) {␊ |
511 | ␉␉snprintf(gFileSpec, 4096, "%s/%s/%sInfo.plist", dirSpec, name, (bundleType == kCFBundleType2) ? "Contents/" : "");␊ |
512 | ␉} else {␊ |
513 | ␉␉snprintf(gFileSpec, 4096, "%s/%sInfo.plist", dirSpec, (bundleType == kCFBundleType2) ? "Contents/" : "");␊ |
514 | ␉}␊ |
515 | ␊ |
516 | ␉length = LoadFile(gFileSpec);␊ |
517 | ␉if (length == -1) {␊ |
518 | ␉␉break;␊ |
519 | ␉}␊ |
520 | ␉length = length + 1;␊ |
521 | ␉buffer = malloc(length);␊ |
522 | ␉if (buffer == 0) {␊ |
523 | ␉␉break;␊ |
524 | ␉}␊ |
525 | ␉strlcpy(buffer, (char *)kLoadAddr, length);␊ |
526 | ␊ |
527 | ␉// Parse the plist.␊ |
528 | ␊ |
529 | ␉ret = ParseXML(buffer, &module, &personalities);␊ |
530 | ␊ |
531 | ␉if (ret != 0) {␊ |
532 | ␉␉break;␊ |
533 | ␉}␊ |
534 | ␊ |
535 | ␉// Allocate memory for the driver path and the plist.␊ |
536 | ␊ |
537 | ␉module->executablePath = tmpExecutablePath;␊ |
538 | ␉module->bundlePath = tmpBundlePath;␊ |
539 | ␉module->bundlePathLength = bundlePathLength;␊ |
540 | ␉module->plistAddr = malloc(length);␊ |
541 | ␊ |
542 | ␉if ((module->executablePath == 0) || (module->bundlePath == 0) || (module->plistAddr == 0)) {␊ |
543 | ␉␉break;␊ |
544 | ␉}␊ |
545 | ␊ |
546 | ␉// Save the driver path in the module.␊ |
547 | ␉//strcpy(module->driverPath, tmpDriverPath);␊ |
548 | ␉tmpExecutablePath = 0;␊ |
549 | ␉tmpBundlePath = 0;␊ |
550 | ␊ |
551 | ␉// Add the plist to the module.␊ |
552 | ␊ |
553 | ␉strlcpy(module->plistAddr, (char *)kLoadAddr, length);␊ |
554 | ␉module->plistLength = length;␊ |
555 | ␊ |
556 | ␉// Add the module to the end of the module list.␊ |
557 | ␊ |
558 | ␉if (gModuleHead == 0) {␊ |
559 | ␉␉gModuleHead = module;␊ |
560 | ␉} else ␉{␊ |
561 | ␉␉gModuleTail->nextModule = module;␊ |
562 | ␉}␊ |
563 | ␉gModuleTail = module;␊ |
564 | ␊ |
565 | ␉// Add the persionalities to the personality list.␊ |
566 | ␊ |
567 | ␉if (personalities) {␊ |
568 | ␉␉personalities = personalities->tag;␊ |
569 | ␉}␊ |
570 | ␉while (personalities != 0)␊ |
571 | ␉{␊ |
572 | ␉␉if (gPersonalityHead == 0) {␊ |
573 | ␉␉␉gPersonalityHead = personalities->tag;␊ |
574 | ␉␉} else {␊ |
575 | ␉␉␉gPersonalityTail->tagNext = personalities->tag;␊ |
576 | ␉␉}␊ |
577 | ␊ |
578 | ␉␉gPersonalityTail = personalities->tag;␊ |
579 | ␉␉personalities = personalities->tagNext;␊ |
580 | ␉}␊ |
581 | ␊ |
582 | ␉ret = 0;␊ |
583 | ␉}␊ |
584 | ␉while (0);␊ |
585 | ␊ |
586 | ␉if ( buffer ) {␊ |
587 | ␉␉free( buffer );␊ |
588 | ␉}␊ |
589 | ␉if ( tmpExecutablePath ) {␊ |
590 | ␉␉free( tmpExecutablePath );␊ |
591 | ␉}␊ |
592 | ␉if ( tmpBundlePath ) {␊ |
593 | ␉␉free( tmpBundlePath );␊ |
594 | ␉}␊ |
595 | ␉return ret;␊ |
596 | }␊ |
597 | ␊ |
598 | ␊ |
599 | //==========================================================================␊ |
600 | // LoadMatchedModules␊ |
601 | ␊ |
602 | long␊ |
603 | LoadMatchedModules( void )␊ |
604 | {␊ |
605 | ␉TagPtr␉␉ prop;␊ |
606 | ␉ModulePtr␉ module;␊ |
607 | ␉char␉␉ *fileName, segName[32];␊ |
608 | ␉DriverInfoPtr driver;␊ |
609 | ␉long␉␉ length, driverAddr, driverLength;␊ |
610 | ␉void␉␉ *executableAddr = 0;␊ |
611 | ␊ |
612 | ␉module = gModuleHead;␊ |
613 | ␊ |
614 | ␉while (module != 0)␊ |
615 | ␉{␊ |
616 | ␉␉if (module->willLoad)␊ |
617 | ␉␉{␊ |
618 | ␉␉␉prop = XMLGetProperty(module->dict, kPropCFBundleExecutable);␊ |
619 | ␊ |
620 | ␉␉␉if (prop != 0)␊ |
621 | ␉␉␉{␊ |
622 | ␉␉␉␉fileName = prop->string;␊ |
623 | ␉␉␉␉snprintf(gFileSpec, 4096, "%s%s", module->executablePath, fileName);␊ |
624 | ␉␉␉␉length = LoadThinFatFile(gFileSpec, &executableAddr);␊ |
625 | ␉␉␉␉if (length == 0)␊ |
626 | ␉␉␉␉{␊ |
627 | ␉␉␉␉␉length = LoadFile(gFileSpec);␊ |
628 | ␉␉␉␉␉executableAddr = (void *)kLoadAddr;␊ |
629 | ␉␉␉␉}␊ |
630 | //␉␉␉␉printf("%s length = %d addr = 0x%x\n", gFileSpec, length, driverModuleAddr); getchar();␊ |
631 | ␉␉␉}␊ |
632 | ␉␉␉else␊ |
633 | ␉␉␉␉length = 0;␊ |
634 | ␊ |
635 | ␉␉␉if (length != -1)␊ |
636 | ␉␉␉{␊ |
637 | //␉␉␉␉driverModuleAddr = (void *)kLoadAddr;␊ |
638 | //␉␉␉␉if (length != 0)␊ |
639 | //␉␉␉␉{␊ |
640 | //␉␉␉␉␉ThinFatFile(&driverModuleAddr, &length);␊ |
641 | //␉␉␉␉}␊ |
642 | ␊ |
643 | ␉␉␉␉// Make make in the image area.␊ |
644 | ␊ |
645 | ␉␉␉␉execute_hook("LoadMatchedModules", module, &length, executableAddr, NULL);␊ |
646 | ␊ |
647 | ␉␉␉␉driverLength = sizeof(DriverInfo) + module->plistLength + length + module->bundlePathLength;␊ |
648 | ␉␉␉␉driverAddr = AllocateKernelMemory(driverLength);␊ |
649 | ␊ |
650 | ␉␉␉␉// Set up the DriverInfo.␊ |
651 | ␉␉␉␉driver = (DriverInfoPtr)driverAddr;␊ |
652 | ␉␉␉␉driver->plistAddr = (char *)(driverAddr + sizeof(DriverInfo));␊ |
653 | ␉␉␉␉driver->plistLength = module->plistLength;␊ |
654 | ␉␉␉␉if (length != 0)␊ |
655 | ␉␉␉␉{␊ |
656 | ␉␉␉␉␉driver->executableAddr = (void *)(driverAddr + sizeof(DriverInfo) +␊ |
657 | ␉␉␉␉␉␉␉␉␉␉ module->plistLength);␊ |
658 | ␉␉␉␉␉driver->executableLength = length;␊ |
659 | ␉␉␉␉}␊ |
660 | ␉␉␉␉else␊ |
661 | ␉␉␉␉{␊ |
662 | ␉␉␉␉␉driver->executableAddr␉ = 0;␊ |
663 | ␉␉␉␉␉driver->executableLength = 0;␊ |
664 | ␉␉␉␉}␊ |
665 | ␉␉␉␉driver->bundlePathAddr = (void *)(driverAddr + sizeof(DriverInfo) +␊ |
666 | ␉␉␉␉␉␉␉␉␉ module->plistLength + driver->executableLength);␊ |
667 | ␉␉␉␉driver->bundlePathLength = module->bundlePathLength;␊ |
668 | ␊ |
669 | ␉␉␉␉// Save the plist, module and bundle.␊ |
670 | ␉␉␉␉strcpy(driver->plistAddr, module->plistAddr);␊ |
671 | ␉␉␉␉if (length != 0)␊ |
672 | ␉␉␉␉{␊ |
673 | ␉␉␉␉␉memcpy(driver->executableAddr, executableAddr, length);␊ |
674 | ␉␉␉␉}␊ |
675 | ␉␉␉␉strcpy(driver->bundlePathAddr, module->bundlePath);␊ |
676 | ␊ |
677 | ␉␉␉␉// Add an entry to the memory map.␊ |
678 | ␉␉␉␉snprintf(segName, sizeof(segName), "Driver-%lx", (unsigned long)driver);␊ |
679 | ␉␉␉␉AllocateMemoryRange(segName, driverAddr, driverLength,␊ |
680 | ␉␉␉␉␉␉␉␉␉kBootDriverTypeKEXT);␊ |
681 | ␉␉␉}␊ |
682 | ␉␉}␊ |
683 | ␉␉module = module->nextModule;␊ |
684 | ␉}␊ |
685 | ␊ |
686 | ␉return 0;␊ |
687 | }␊ |
688 | ␊ |
689 | //==========================================================================␊ |
690 | // MatchPersonalities␊ |
691 | ␊ |
692 | static long␊ |
693 | MatchPersonalities( void )␊ |
694 | {␊ |
695 | ␉/* IONameMatch support not implemented */␊ |
696 | ␉return 0;␊ |
697 | }␊ |
698 | ␊ |
699 | //==========================================================================␊ |
700 | // MatchLibraries␊ |
701 | ␊ |
702 | static long␊ |
703 | MatchLibraries( void )␊ |
704 | {␊ |
705 | ␉TagPtr prop, prop2;␊ |
706 | ␉ModulePtr module, module2;␊ |
707 | ␉long done;␊ |
708 | ␊ |
709 | ␉do {␊ |
710 | ␉␉done = 1;␊ |
711 | ␉␉module = gModuleHead;␊ |
712 | ␊ |
713 | ␉␉while (module != 0)␊ |
714 | ␉␉{␊ |
715 | ␉␉␉if (module->willLoad == 1)␊ |
716 | ␉␉␉{␊ |
717 | ␉␉␉␉prop = XMLGetProperty(module->dict, kPropOSBundleLibraries);␊ |
718 | ␊ |
719 | ␉␉␉␉if (prop != 0)␊ |
720 | ␉␉␉␉{␊ |
721 | ␉␉␉␉␉prop = prop->tag;␊ |
722 | ␊ |
723 | ␉␉␉␉␉while (prop != 0)␊ |
724 | ␉␉␉␉␉{␊ |
725 | ␉␉␉␉␉␉module2 = gModuleHead;␊ |
726 | ␊ |
727 | ␉␉␉␉␉␉while (module2 != 0)␊ |
728 | ␉␉␉␉␉␉{␊ |
729 | ␉␉␉␉␉␉␉prop2 = XMLGetProperty(module2->dict, kPropCFBundleIdentifier);␊ |
730 | ␊ |
731 | ␉␉␉␉␉␉␉if ((prop2 != 0) && (!strcmp(prop->string, prop2->string)))␊ |
732 | ␉␉␉␉␉␉␉{␊ |
733 | ␉␉␉␉␉␉␉␉if (module2->willLoad == 0)␊ |
734 | ␉␉␉␉␉␉␉␉{␊ |
735 | ␉␉␉␉␉␉␉␉␉module2->willLoad = 1;␊ |
736 | ␉␉␉␉␉␉␉␉}␊ |
737 | ␉␉␉␉␉␉␉␉break;␊ |
738 | ␉␉␉␉␉␉␉}␊ |
739 | ␉␉␉␉␉␉␉module2 = module2->nextModule;␊ |
740 | ␉␉␉␉␉␉}␊ |
741 | ␉␉␉␉␉␉prop = prop->tagNext;␊ |
742 | ␉␉␉␉␉}␊ |
743 | ␉␉␉␉}␊ |
744 | ␉␉␉␉module->willLoad = 2;␊ |
745 | ␉␉␉␉done = 0;␊ |
746 | ␉␉␉}␊ |
747 | ␉␉␉module = module->nextModule;␊ |
748 | ␉␉}␊ |
749 | ␉}␊ |
750 | ␉while (!done);␊ |
751 | ␊ |
752 | ␉return 0;␊ |
753 | }␊ |
754 | ␊ |
755 | ␊ |
756 | //==========================================================================␊ |
757 | // FindModule␊ |
758 | ␊ |
759 | #if NOTDEF␊ |
760 | static ModulePtr␊ |
761 | FindModule( char * name )␊ |
762 | {␊ |
763 | ␉ModulePtr module;␊ |
764 | ␉TagPtr prop;␊ |
765 | ␊ |
766 | ␉module = gModuleHead;␊ |
767 | ␊ |
768 | ␉while (module != 0)␊ |
769 | ␉{␊ |
770 | ␉␉prop = GetProperty(module->dict, kPropCFBundleIdentifier);␊ |
771 | ␊ |
772 | ␉␉if ((prop != 0) && !strcmp(name, prop->string)) {␊ |
773 | ␉␉␉break;␊ |
774 | ␉␉}␊ |
775 | ␊ |
776 | ␉␉module = module->nextModule;␊ |
777 | ␉}␊ |
778 | ␊ |
779 | ␉return module;␊ |
780 | }␊ |
781 | #endif /* NOTDEF */␊ |
782 | ␊ |
783 | //==========================================================================␊ |
784 | // ParseXML␊ |
785 | ␊ |
786 | static long␊ |
787 | ParseXML( char * buffer, ModulePtr * module, TagPtr * personalities )␊ |
788 | {␊ |
789 | ␉long length, pos;␊ |
790 | ␉TagPtr moduleDict, required;␊ |
791 | ␉ModulePtr tmpModule;␊ |
792 | ␊ |
793 | ␉pos = 0;␊ |
794 | ␊ |
795 | ␉while (1)␊ |
796 | ␉{␊ |
797 | ␉␉length = XMLParseNextTag(buffer + pos, &moduleDict);␊ |
798 | ␉␉if (length == -1) {␊ |
799 | ␉␉␉break;␊ |
800 | ␉␉}␊ |
801 | ␊ |
802 | ␉␉pos += length;␊ |
803 | ␊ |
804 | ␉␉if (moduleDict == 0) {␊ |
805 | ␉␉␉continue;␊ |
806 | ␉␉}␊ |
807 | ␉␉if (moduleDict->type == kTagTypeDict) {␊ |
808 | ␉␉␉break;␊ |
809 | ␉␉}␊ |
810 | ␉␉XMLFreeTag(moduleDict);␊ |
811 | ␉}␊ |
812 | ␊ |
813 | ␉if (length == -1) {␊ |
814 | ␉␉return -1;␊ |
815 | ␉}␊ |
816 | ␊ |
817 | ␉required = XMLGetProperty(moduleDict, kPropOSBundleRequired);␊ |
818 | ␊ |
819 | ␉if ( (required == 0) || (required->type != kTagTypeString) || !strcmp(required->string, "Safe Boot"))␊ |
820 | ␉{␊ |
821 | ␉␉XMLFreeTag(moduleDict);␊ |
822 | ␉␉return -2;␊ |
823 | ␉}␊ |
824 | ␊ |
825 | ␉tmpModule = malloc(sizeof(Module));␊ |
826 | ␉if (tmpModule == 0) {␊ |
827 | ␉␉XMLFreeTag(moduleDict);␊ |
828 | ␉␉return -1;␊ |
829 | ␉}␊ |
830 | ␉tmpModule->dict = moduleDict;␊ |
831 | ␊ |
832 | ␉// For now, load any module that has OSBundleRequired != "Safe Boot".␊ |
833 | ␊ |
834 | ␉tmpModule->willLoad = 1;␊ |
835 | ␊ |
836 | ␉*module = tmpModule;␊ |
837 | ␊ |
838 | ␉// Get the personalities.␊ |
839 | ␊ |
840 | ␉*personalities = XMLGetProperty(moduleDict, kPropIOKitPersonalities);␊ |
841 | ␊ |
842 | ␉return 0;␊ |
843 | }␊ |
844 | ␊ |
845 | #if NOTDEF␊ |
846 | static char gPlatformName[64];␊ |
847 | #endif␊ |
848 | ␊ |
849 | char *gDarwinBuildVerStr = "Darwin Kernel Version"; // Bungo␊ |
850 | ␊ |
851 | long␊ |
852 | DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize)␊ |
853 | {␊ |
854 | ␉long ret = 0;␊ |
855 | ␉compressed_kernel_header * kernel_header = (compressed_kernel_header *) binary;␊ |
856 | ␉u_int32_t uncompressed_size = 0, size = 0, adler32 = 0;␊ |
857 | ␉void *buffer = NULL;␊ |
858 | ␉unsigned long len = 0;␊ |
859 | ␉␊ |
860 | /*#if 0␊ |
861 | ␉printf("kernel header:\n");␊ |
862 | ␉printf("signature: 0x%x\n", kernel_header->signature);␊ |
863 | ␉printf("compress_type: 0x%x\n", kernel_header->compress_type);␊ |
864 | ␉printf("adler32: 0x%x\n", kernel_header->adler32);␊ |
865 | ␉printf("uncompressed_size: 0x%x\n", kernel_header->uncompressed_size);␊ |
866 | ␉printf("compressed_size: 0x%x\n", kernel_header->compressed_size);␊ |
867 | ␉getchar();␊ |
868 | #endif*/␊ |
869 | ␊ |
870 | ␉if (kernel_header->signature == OSSwapBigToHostConstInt32('comp'))␊ |
871 | ␉{␊ |
872 | ␉␉DBG("Decompressing Kernel: ");␊ |
873 | ␊ |
874 | ␉␉if ((kernel_header->compress_type != OSSwapBigToHostConstInt32('lzss')) &&␊ |
875 | ␉␉␉(kernel_header->compress_type != OSSwapBigToHostConstInt32('lzvn')))␊ |
876 | ␉␉{␊ |
877 | ␉␉␉error("ERROR: kernel compression is bad!\n");␊ |
878 | ␉␉␉return -1;␊ |
879 | ␉␉}␊ |
880 | #if NOTDEF␊ |
881 | ␉␉if (kernel_header->platform_name[0] && strcmp(gPlatformName, kernel_header->platform_name))␊ |
882 | ␉␉{␊ |
883 | ␉␉␉return -1;␊ |
884 | ␉␉}␊ |
885 | ␉␉if (kernel_header->root_path[0] && strcmp(gBootFile, kernel_header->root_path))␊ |
886 | ␉␉{␊ |
887 | ␉␉␉return -1;␊ |
888 | ␉␉}␊ |
889 | #endif␊ |
890 | ␉␉uncompressed_size = OSSwapBigToHostInt32(kernel_header->uncompressed_size);␊ |
891 | ␉␉binary = buffer = malloc(uncompressed_size);␊ |
892 | ␊ |
893 | ␉␉// MinusZwei␊ |
894 | ␉␉size = 0;␊ |
895 | ␉␉switch (kernel_header->compress_type)␊ |
896 | ␉␉{␊ |
897 | ␉␉␉case OSSwapBigToHostConstInt32('lzvn'):␊ |
898 | ␉␉␉␉size = decompress_lzvn( binary, uncompressed_size, &kernel_header->data[0], OSSwapBigToHostInt32(kernel_header->compressed_size));␊ |
899 | ␉␉␉␉break;␊ |
900 | ␊ |
901 | ␉␉␉case OSSwapBigToHostConstInt32('lzss'):␊ |
902 | ␉␉␉␉size = decompress_lzss( (u_int8_t *)binary, uncompressed_size, &kernel_header->data[0], OSSwapBigToHostInt32(kernel_header->compressed_size));␊ |
903 | ␉␉␉␉break;␊ |
904 | ␊ |
905 | ␉␉␉default:␊ |
906 | ␉␉␉␉break;␊ |
907 | ␉␉}␊ |
908 | ␉␉// MinusZwei␊ |
909 | ␊ |
910 | ␉␉if (uncompressed_size != size) {␊ |
911 | ␉␉␉error("ERROR: size mismatch from lzss (found: %x, expected: %x).\n", size, uncompressed_size);␊ |
912 | ␉␉␉return -1;␊ |
913 | ␉␉}␊ |
914 | ␊ |
915 | ␉␉adler32 = Adler32(binary, uncompressed_size);␊ |
916 | ␉␉if (OSSwapBigToHostInt32(kernel_header->adler32) != adler32)␊ |
917 | ␉␉{␊ |
918 | ␉␉␉error("ERROR: adler mismatch (found: %x, expected: %x).\n", adler32, OSSwapBigToHostInt32(kernel_header->adler32));␊ |
919 | ␉␉␉return -1;␊ |
920 | ␉␉}␊ |
921 | ␊ |
922 | ␉␉DBG("OK.\n");␊ |
923 | ␉}␊ |
924 | ␉␊ |
925 | ␉ret = ThinFatFile(&binary, &len);␊ |
926 | ␉if (ret == 0 && len == 0 && archCpuType==CPU_TYPE_X86_64)␊ |
927 | ␉{␊ |
928 | ␉␉archCpuType=CPU_TYPE_I386;␊ |
929 | ␉␉ret = ThinFatFile(&binary, &len);␊ |
930 | ␉}␊ |
931 | ␊ |
932 | ␉// Bungo: no range checking, sorry␊ |
933 | ␉size = 0;␊ |
934 | ␉while (memcmp((uint8_t *)binary + size, (uint8_t *)gDarwinBuildVerStr, 21)) {␊ |
935 | ␉␉size++;␊ |
936 | ␉}␊ |
937 | ␉gDarwinBuildVerStr = (char *)binary + size;␊ |
938 | ␊ |
939 | ␉// Notify modules that the kernel has been decompressed, thinned and is about to be decoded␊ |
940 | ␉execute_hook("DecodeKernel", (void*)binary, NULL, NULL, NULL);␊ |
941 | ␊ |
942 | ␉ret = DecodeMachO(binary, rentry, raddr, rsize);␊ |
943 | ␉if (ret < 0 && archCpuType == CPU_TYPE_X86_64)␊ |
944 | ␉{␊ |
945 | ␉␉archCpuType = CPU_TYPE_I386;␊ |
946 | ␉␉ret = DecodeMachO(binary, rentry, raddr, rsize);␊ |
947 | ␉}␊ |
948 | ␊ |
949 | ␉return ret;␊ |
950 | }␊ |
951 | |