Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Trunk/i386/include/mach/mig.h

1/*
2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31
32/*
33 * Mach MIG Subsystem Interfaces
34 */
35
36#ifndef_MACH_MIG_H_
37#define _MACH_MIG_H_
38
39#include <stdint.h>
40#include <mach/port.h>
41#include <mach/message.h>
42#include <mach/vm_types.h>
43
44#include <sys/cdefs.h>
45
46#if defined(MACH_KERNEL)
47
48#if defined(BSMALL_LATER)
49/* Really small configurations don't need type checking */
50#define __MigTypeCheck 0
51#else
52/* Turn MIG type checking on by default for kernel */
53#define __MigTypeCheck 1
54#endif
55#define __MigKernelSpecificCode 1
56#define _MIG_KERNEL_SPECIFIC_CODE_ 1
57
58/* Otherwise check legacy setting (temporary) */
59#elif defined(TypeCheck)
60
61#define __MigTypeCheck TypeCheck
62
63#elif !defined(__MigTypeCheck)
64
65/* otherwise, default MIG type checking on - except in small configurations */
66#if defined(BSMALL)
67#define __MigTypeCheck 0
68#else
69#define __MigTypeCheck 1
70#endif
71
72#endif /* !defined(__MigTypeCheck) */
73
74/*
75 * Pack MIG message structs.
76 * This is an indicator of the need to view shared structs in a
77 * binary-compatible format - and MIG message structs are no different.
78 */
79#define __MigPackStructs 1
80
81/*
82 * Definition for MIG-generated server stub routines. These routines
83 * unpack the request message, call the server procedure, and pack the
84 * reply message.
85 */
86typedef void(*mig_stub_routine_t) (mach_msg_header_t *InHeadP,
87 mach_msg_header_t *OutHeadP);
88
89typedef mig_stub_routine_t mig_routine_t;
90
91/*
92 * Definition for MIG-generated server routine. This routine takes a
93 * message, and returns the appropriate stub function for handling that
94 * message.
95 */
96typedef mig_routine_t (*mig_server_routine_t) (mach_msg_header_t *InHeadP);
97
98/*
99 * Generic definition for implementation routines. These routines do
100 * the real work associated with this request. This generic type is
101 * used for keeping the pointers in the subsystem array.
102 */
103typedef kern_return_t (*mig_impl_routine_t)(void);
104
105typedef mach_msg_type_descriptor_t routine_arg_descriptor;
106typedef mach_msg_type_descriptor_t *routine_arg_descriptor_t;
107typedef mach_msg_type_descriptor_t *mig_routine_arg_descriptor_t;
108
109#define MIG_ROUTINE_ARG_DESCRIPTOR_NULL ((mig_routine_arg_descriptor_t)0)
110
111struct routine_descriptor {
112mig_impl_routine_timpl_routine;/* Server work func pointer */
113mig_stub_routine_tstub_routine;/* Unmarshalling func pointer */
114unsigned intargc;/* Number of argument words */
115unsigned intdescr_count;/* Number complex descriptors */
116routine_arg_descriptor_t
117arg_descr;/* pointer to descriptor array*/
118unsigned intmax_reply_msg;/* Max size for reply msg */
119};
120typedef struct routine_descriptor *routine_descriptor_t;
121
122typedef struct routine_descriptor mig_routine_descriptor;
123typedef mig_routine_descriptor *mig_routine_descriptor_t;
124
125#define MIG_ROUTINE_DESCRIPTOR_NULL ((mig_routine_descriptor_t)0)
126
127typedef struct mig_subsystem {
128mig_server_routine_t server;/* pointer to demux routine*/
129mach_msg_id_t start;/* Min routine number */
130mach_msg_id_t end;/* Max routine number + 1 */
131mach_msg_size_t maxsize;/* Max reply message size */
132vm_address_t reserved;/* reserved for MIG use */
133mig_routine_descriptor
134 routine[1];/* Routine descriptor array */
135} *mig_subsystem_t;
136
137#define MIG_SUBSYSTEM_NULL((mig_subsystem_t)0)
138
139typedef struct mig_symtab {
140char*ms_routine_name;
141intms_routine_number;
142void (*ms_routine)(void);/* Since the functions in the
143 * symbol table have unknown
144 * signatures, this is the best
145 * we can do...
146 */
147} mig_symtab_t;
148
149
150__BEGIN_DECLS
151
152/* Client side reply port allocate */
153extern mach_port_t mig_get_reply_port(void);
154
155/* Client side reply port deallocate */
156extern void mig_dealloc_reply_port(mach_port_t reply_port);
157
158/* Client side reply port "deallocation" */
159extern void mig_put_reply_port(mach_port_t reply_port);
160
161/* Bounded string copy */
162extern int mig_strncpy(char*dest, const char *src,intlen);
163
164
165/* Allocate memory for out-of-line mig structures */
166extern void mig_allocate(vm_address_t *, vm_size_t);
167
168/* Deallocate memory used for out-of-line mig structures */
169extern void mig_deallocate(vm_address_t, vm_size_t);
170
171
172__END_DECLS
173
174#endif/* _MACH_MIG_H_ */
175

Archive Download this file

Revision: 1622