]> git.saurik.com Git - apple/xnu.git/blame - iokit/Families/IONDRVSupport/IOPEFLoader.h
xnu-123.5.tar.gz
[apple/xnu.git] / iokit / Families / IONDRVSupport / IOPEFLoader.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*
23 * Copyright (c) 1997 Apple Computer, Inc.
24 *
25 *
26 * HISTORY
27 *
28 * sdouglas 22 Oct 97 - first checked in.
29 * sdouglas 21 July 98 - start IOKit
30 * sdouglas 21 July 98 - start IOKit
31 */
32
33
34#ifndef _IOKIT_IOPEFLOADER_H
35#define _IOKIT_IOPEFLOADER_H
36
37
38#include <IOKit/ndrvsupport/IOMacOSTypes.h>
39#include <IOKit/ndrvsupport/IONDRVSupport.h>
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45
46enum {
47 cfragFirstErrCode = -2800, /* The first value in the range of CFM errors.*/
48 cfragContextIDErr = -2800, /* The context ID was not valid.*/
49 cfragConnectionIDErr = -2801, /* The connection ID was not valid.*/
50 cfragNoSymbolErr = -2802, /* The specified symbol was not found.*/
51 cfragNoSectionErr = -2803, /* The specified section was not found.*/
52 cfragNoLibraryErr = -2804, /* The named library was not found.*/
53 cfragDupRegistrationErr = -2805, /* The registration name was already in use.*/
54 cfragFragmentFormatErr = -2806, /* A fragment's container format is unknown.*/
55 cfragUnresolvedErr = -2807, /* A fragment had "hard" unresolved imports.*/
56 cfragNoPositionErr = -2808, /* The registration insertion point was not found.*/
57 cfragNoPrivateMemErr = -2809, /* Out of memory for internal bookkeeping.*/
58 cfragNoClientMemErr = -2810, /* Out of memory for fragment mapping or section instances.*/
59 cfragNoIDsErr = -2811, /* No more CFM IDs for contexts, connections, etc.*/
60 cfragInitOrderErr = -2812, /* */
61 cfragImportTooOldErr = -2813, /* An import library was too old for a client.*/
62 cfragImportTooNewErr = -2814, /* An import library was too new for a client.*/
63 cfragInitLoopErr = -2815, /* Circularity in required initialization order.*/
64 cfragInitAtBootErr = -2816, /* A boot library has an initialization function. (System 7 only)*/
65 cfragLibConnErr = -2817, /* */
66 cfragCFMStartupErr = -2818, /* Internal error during CFM initialization.*/
67 cfragCFMInternalErr = -2819, /* An internal inconstistancy has been detected.*/
68 cfragFragmentCorruptErr = -2820, /* A fragment's container was corrupt (known format).*/
69 cfragInitFunctionErr = -2821, /* A fragment's initialization routine returned an error.*/
70 cfragNoApplicationErr = -2822, /* No application member found in the cfrg resource.*/
71 cfragArchitectureErr = -2823, /* A fragment has an unacceptable architecture.*/
72 cfragFragmentUsageErr = -2824, /* A semantic error in usage of the fragment.*/
73 cfragFileSizeErr = -2825, /* A file was too large to be mapped.*/
74 cfragNotClosureErr = -2826, /* The closure ID was actually a connection ID.*/
75 cfragNoRegistrationErr = -2827, /* The registration name was not found.*/
76 cfragContainerIDErr = -2828, /* The fragment container ID was not valid.*/
77 cfragClosureIDErr = -2829, /* The closure ID was not valid.*/
78 cfragAbortClosureErr = -2830 /* Used by notification handlers to abort a closure.*/
79};
80
81enum {
82 paramErr = -50,
83 unimpErr = -4
84};
85
86
87typedef UInt32 CFragVersionNumber;
88enum {
89 kNullCFragVersion = 0,
90 kWildcardCFragVersion = 0xFFFFFFFF
91};
92
93typedef UInt8 CFragSymbolClass;
94enum {
95 kCodeCFragSymbol = 0,
96 kDataCFragSymbol = 1,
97 kTVectorCFragSymbol = 2,
98 kTOCCFragSymbol = 3,
99 kGlueCFragSymbol = 4
100};
101
102enum {
103 kUnresolvedCFragSymbolAddress = 0
104};
105
106typedef UInt32 CFragShortVersionPair;
107#define ComposeCFragShortVersionPair(current,older) (current << 16 | older)
108#define GetCFragShortVersionCurrent(version) (version >> 16)
109#define GetCFragShortVersionOlder(version) (version & 0xFFFF)
110
111
112enum {
113 kMainCFragSymbolIndex = -1,
114 kInitCFragSymbolIndex = -2,
115 kTermCFragSymbolIndex = -3
116};
117
118typedef void * PCodeInstance;
119
120OSStatus
121PCodeOpen( LogicalAddress container, ByteCount containerSize, PCodeInstance * instance );
122OSStatus
123PCodeClose( PCodeInstance instance );
124OSStatus
125PCodeInstantiate( PCodeInstance instance,
126 IONDRVUndefinedSymbolHandler handler, void * self );
127OSStatus
128PCodeFindExport( PCodeInstance instance, const char * symbolName, LogicalAddress * address, CFragSymbolClass * symbolClass );
129OSStatus
130PCodeFindMain( PCodeInstance instance, LogicalAddress * mainAddress );
131
132static __inline__ unsigned int get_R2(void)
133{
134 unsigned int result;
135 __asm__ volatile("mr %0, r2" : "=r" (result));
136 return result;
137}
138
139static __inline__ void set_R2(unsigned int val)
140{
141 __asm__ volatile("mr r2,%0" : : "r" (val));
142 return;
143}
144
145#ifdef __cplusplus
146}
147#endif
148
149#endif /* ! _IOKIT_IOPEFLOADER_H */
150