xref: /titanic_41/usr/src/cmd/geniconvtbl/iconv_tm.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1999 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef _ICONV_TM_H
28*7c478bd9Sstevel@tonic-gate #define	_ICONV_TM_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate 
33*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
34*7c478bd9Sstevel@tonic-gate extern "C" {
35*7c478bd9Sstevel@tonic-gate #endif
36*7c478bd9Sstevel@tonic-gate 
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate #include <inttypes.h>
39*7c478bd9Sstevel@tonic-gate #include <sys/isa_defs.h>
40*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate #if !defined(DEBUG)
44*7c478bd9Sstevel@tonic-gate #define	NDEBUG	/* for assert() */
45*7c478bd9Sstevel@tonic-gate #endif /* DEBUG */
46*7c478bd9Sstevel@tonic-gate 
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate #if defined(DEBUG)
49*7c478bd9Sstevel@tonic-gate #define	ENABLE_TRACE
50*7c478bd9Sstevel@tonic-gate #endif /* DEBUG */
51*7c478bd9Sstevel@tonic-gate 
52*7c478bd9Sstevel@tonic-gate #define	MAXSEQUENCE	(128)
53*7c478bd9Sstevel@tonic-gate #define	MAXREGID	(256)
54*7c478bd9Sstevel@tonic-gate #define	MAXNAMELENGTH	(255)
55*7c478bd9Sstevel@tonic-gate 
56*7c478bd9Sstevel@tonic-gate /*
57*7c478bd9Sstevel@tonic-gate  * ITM Identifier
58*7c478bd9Sstevel@tonic-gate  */
59*7c478bd9Sstevel@tonic-gate 
60*7c478bd9Sstevel@tonic-gate #define	ITM_IDENT_LEN			(4)
61*7c478bd9Sstevel@tonic-gate #define	ITM_IDENT_0			(0x49)
62*7c478bd9Sstevel@tonic-gate #define	ITM_IDENT_1			(0x54)
63*7c478bd9Sstevel@tonic-gate #define	ITM_IDENT_2			(0x4d)
64*7c478bd9Sstevel@tonic-gate #define	ITM_IDENT_3			(0x00)
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate 
67*7c478bd9Sstevel@tonic-gate /*
68*7c478bd9Sstevel@tonic-gate  * ITM Platform Specification
69*7c478bd9Sstevel@tonic-gate  */
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate #define	ITM_SPEC_LEN			(4)
72*7c478bd9Sstevel@tonic-gate #define	ITM_SPEC_0			(0)
73*7c478bd9Sstevel@tonic-gate #define	ITM_SPEC_1			(0)
74*7c478bd9Sstevel@tonic-gate #define	ITM_SPEC_2			(0)
75*7c478bd9Sstevel@tonic-gate #define	ITM_SPEC_3_UNSPECIFIED		(0)
76*7c478bd9Sstevel@tonic-gate #define	ITM_SPEC_3_32_BIG_ENDIAN	(1)
77*7c478bd9Sstevel@tonic-gate #define	ITM_SPEC_3_32_LITTLE_ENDIAN	(2)
78*7c478bd9Sstevel@tonic-gate #define	ITM_SPEC_3_64_BIG_ENDIAN	(3)
79*7c478bd9Sstevel@tonic-gate #define	ITM_SPEC_3_64_LITTLE_ENDIAN	(4)
80*7c478bd9Sstevel@tonic-gate 
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate /*
83*7c478bd9Sstevel@tonic-gate  * ITM Version
84*7c478bd9Sstevel@tonic-gate  */
85*7c478bd9Sstevel@tonic-gate 
86*7c478bd9Sstevel@tonic-gate #define	ITM_VER_LEN			(4)
87*7c478bd9Sstevel@tonic-gate #define	ITM_VER_0			(0)
88*7c478bd9Sstevel@tonic-gate #define	ITM_VER_1			(0)
89*7c478bd9Sstevel@tonic-gate #define	ITM_VER_2			(0)
90*7c478bd9Sstevel@tonic-gate #define	ITM_VER_3			(1)
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate 
93*7c478bd9Sstevel@tonic-gate /*
94*7c478bd9Sstevel@tonic-gate  * PADDING
95*7c478bd9Sstevel@tonic-gate  */
96*7c478bd9Sstevel@tonic-gate #define	ITM_PAD_LEN			(4)
97*7c478bd9Sstevel@tonic-gate 
98*7c478bd9Sstevel@tonic-gate 
99*7c478bd9Sstevel@tonic-gate /*
100*7c478bd9Sstevel@tonic-gate  * Generic offset&pointer/data/string
101*7c478bd9Sstevel@tonic-gate  */
102*7c478bd9Sstevel@tonic-gate typedef uint32_t	pad_t;
103*7c478bd9Sstevel@tonic-gate typedef ulong_t		itm_type_t;
104*7c478bd9Sstevel@tonic-gate typedef uintptr_t	itm_place2_t;	/* position of data */
105*7c478bd9Sstevel@tonic-gate typedef size_t		itm_size_t;
106*7c478bd9Sstevel@tonic-gate typedef long		itm_num_t;
107*7c478bd9Sstevel@tonic-gate typedef union itm_place_union {
108*7c478bd9Sstevel@tonic-gate 	int64_t		itm_64d;	/* positon of real data */
109*7c478bd9Sstevel@tonic-gate 	struct {
110*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
111*7c478bd9Sstevel@tonic-gate 		pad_t		pad;
112*7c478bd9Sstevel@tonic-gate #endif
113*7c478bd9Sstevel@tonic-gate 		itm_place2_t   ptr;
114*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
115*7c478bd9Sstevel@tonic-gate 		pad_t		pad;
116*7c478bd9Sstevel@tonic-gate #endif
117*7c478bd9Sstevel@tonic-gate 	}itm_place_union_struct;
118*7c478bd9Sstevel@tonic-gate 	char			itm_c[8];
119*7c478bd9Sstevel@tonic-gate }	itm_place_t;
120*7c478bd9Sstevel@tonic-gate #define	itm_ptr	itm_place_union_struct.ptr
121*7c478bd9Sstevel@tonic-gate #define	itm_pad	itm_place_union_struct.pad
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate 
124*7c478bd9Sstevel@tonic-gate typedef struct {
125*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
126*7c478bd9Sstevel@tonic-gate 	pad_t		pad;
127*7c478bd9Sstevel@tonic-gate #endif
128*7c478bd9Sstevel@tonic-gate 	itm_size_t	size;		/* size in bytes */
129*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
130*7c478bd9Sstevel@tonic-gate 	pad_t		pad;
131*7c478bd9Sstevel@tonic-gate #endif
132*7c478bd9Sstevel@tonic-gate 
133*7c478bd9Sstevel@tonic-gate 	itm_place_t	place;		/* place of data */
134*7c478bd9Sstevel@tonic-gate } itm_data_t;
135*7c478bd9Sstevel@tonic-gate 
136*7c478bd9Sstevel@tonic-gate 
137*7c478bd9Sstevel@tonic-gate /*
138*7c478bd9Sstevel@tonic-gate  * Generic place table information
139*7c478bd9Sstevel@tonic-gate  */
140*7c478bd9Sstevel@tonic-gate 
141*7c478bd9Sstevel@tonic-gate typedef struct {
142*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
143*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
144*7c478bd9Sstevel@tonic-gate #endif
145*7c478bd9Sstevel@tonic-gate 	itm_size_t	size;		/* size in bytes */
146*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
147*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
148*7c478bd9Sstevel@tonic-gate #endif
149*7c478bd9Sstevel@tonic-gate 
150*7c478bd9Sstevel@tonic-gate 	itm_place_t	place;		/* place of place table */
151*7c478bd9Sstevel@tonic-gate 
152*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
153*7c478bd9Sstevel@tonic-gate 	pad_t		pad2;
154*7c478bd9Sstevel@tonic-gate #endif
155*7c478bd9Sstevel@tonic-gate 	itm_num_t	number;		/* number of entry */
156*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
157*7c478bd9Sstevel@tonic-gate 	pad_t		pad2;
158*7c478bd9Sstevel@tonic-gate #endif
159*7c478bd9Sstevel@tonic-gate } itm_place_tbl_info_t;
160*7c478bd9Sstevel@tonic-gate 
161*7c478bd9Sstevel@tonic-gate 
162*7c478bd9Sstevel@tonic-gate /*
163*7c478bd9Sstevel@tonic-gate  * Generic place table section
164*7c478bd9Sstevel@tonic-gate  */
165*7c478bd9Sstevel@tonic-gate 
166*7c478bd9Sstevel@tonic-gate typedef struct {
167*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
168*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
169*7c478bd9Sstevel@tonic-gate #endif
170*7c478bd9Sstevel@tonic-gate 	itm_size_t	size;		/* size in bytes */
171*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
172*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
173*7c478bd9Sstevel@tonic-gate #endif
174*7c478bd9Sstevel@tonic-gate 
175*7c478bd9Sstevel@tonic-gate 	itm_place_t	place;		/* place of table section */
176*7c478bd9Sstevel@tonic-gate 
177*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
178*7c478bd9Sstevel@tonic-gate 	pad_t		pad2;
179*7c478bd9Sstevel@tonic-gate #endif
180*7c478bd9Sstevel@tonic-gate 	itm_num_t	number;		/* number of table */
181*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
182*7c478bd9Sstevel@tonic-gate 	pad_t		pad2;
183*7c478bd9Sstevel@tonic-gate #endif
184*7c478bd9Sstevel@tonic-gate 
185*7c478bd9Sstevel@tonic-gate } itm_section_info_t;
186*7c478bd9Sstevel@tonic-gate 
187*7c478bd9Sstevel@tonic-gate 
188*7c478bd9Sstevel@tonic-gate /*
189*7c478bd9Sstevel@tonic-gate  * Generic table header
190*7c478bd9Sstevel@tonic-gate  */
191*7c478bd9Sstevel@tonic-gate 
192*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_MASK		(0x000000ffUL)
193*7c478bd9Sstevel@tonic-gate 
194*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_NONE		(0x00000000UL)
195*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_ITM		(0x00000001UL)
196*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_DIREC		(0x00000002UL)
197*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_COND		(0x00000003UL)
198*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_MAP		(0x00000004UL)
199*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_OP		(0x00000005UL)
200*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_RANGE		(0x00000006UL)
201*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_ESCAPESEQ	(0x00000007UL)
202*7c478bd9Sstevel@tonic-gate 
203*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_NONE_NONE		(ITM_TBL_NONE  | 0x00000000UL)
204*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_DIREC_NONE		(ITM_TBL_DIREC | 0x00000000UL)
205*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_DIREC_RESET		(ITM_TBL_DIREC | 0x00000100UL)
206*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_COND_NONE		(ITM_TBL_COND  | 0x00000000UL)
207*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_MAP_NONE		(ITM_TBL_MAP   | 0x00000000UL)
208*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_MAP_INDEX_FIXED_1_1	(ITM_TBL_MAP   | 0x00000100UL)
209*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_MAP_INDEX_FIXED		(ITM_TBL_MAP   | 0x00000200UL)
210*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_MAP_LOOKUP		(ITM_TBL_MAP   | 0x00000300UL)
211*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_MAP_HASH		(ITM_TBL_MAP   | 0x00000400UL)
212*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_MAP_DENSE_ENC		(ITM_TBL_MAP   | 0x00000500UL)
213*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_MAP_VAR			(ITM_TBL_MAP   | 0x00000600UL)
214*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_OP_NONE			(ITM_TBL_OP    | 0x00000000UL)
215*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_OP_INIT			(ITM_TBL_OP    | 0x00000100UL)
216*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_OP_RESET		(ITM_TBL_OP    | 0x00000200UL)
217*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_RANGE_NONE		(ITM_TBL_RANGE | 0x00000000UL)
218*7c478bd9Sstevel@tonic-gate #define	ITM_TBL_ESCAPESEQ_NONE		(ITM_TBL_ESCAPESEQ | 0x00000000UL)
219*7c478bd9Sstevel@tonic-gate 
220*7c478bd9Sstevel@tonic-gate typedef struct {
221*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
222*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
223*7c478bd9Sstevel@tonic-gate #endif
224*7c478bd9Sstevel@tonic-gate 	itm_type_t	type;		/* type of table */
225*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
226*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
227*7c478bd9Sstevel@tonic-gate #endif
228*7c478bd9Sstevel@tonic-gate 	itm_place_t	name;		/* name of table */
229*7c478bd9Sstevel@tonic-gate 
230*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
231*7c478bd9Sstevel@tonic-gate 	pad_t		pad2;
232*7c478bd9Sstevel@tonic-gate #endif
233*7c478bd9Sstevel@tonic-gate 	itm_size_t	size;		/* size of table */
234*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
235*7c478bd9Sstevel@tonic-gate 	pad_t		pad2;
236*7c478bd9Sstevel@tonic-gate #endif
237*7c478bd9Sstevel@tonic-gate 
238*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
239*7c478bd9Sstevel@tonic-gate 	pad_t		pad3;
240*7c478bd9Sstevel@tonic-gate #endif
241*7c478bd9Sstevel@tonic-gate 	itm_num_t	number;		/* number of entry */
242*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
243*7c478bd9Sstevel@tonic-gate 	pad_t		pad3;
244*7c478bd9Sstevel@tonic-gate #endif
245*7c478bd9Sstevel@tonic-gate } itm_tbl_hdr_t;
246*7c478bd9Sstevel@tonic-gate 
247*7c478bd9Sstevel@tonic-gate 
248*7c478bd9Sstevel@tonic-gate /*
249*7c478bd9Sstevel@tonic-gate  * Iconv Code Set Translation Module (ITM) header
250*7c478bd9Sstevel@tonic-gate  */
251*7c478bd9Sstevel@tonic-gate 
252*7c478bd9Sstevel@tonic-gate typedef struct {
253*7c478bd9Sstevel@tonic-gate 	unsigned char	ident[ITM_IDENT_LEN];	/* identifier */
254*7c478bd9Sstevel@tonic-gate 	unsigned char	spec[ITM_SPEC_LEN];	/* platform specification */
255*7c478bd9Sstevel@tonic-gate 	unsigned char	version[ITM_VER_LEN];	/* version */
256*7c478bd9Sstevel@tonic-gate 	unsigned char	padding[ITM_PAD_LEN];	/* padding  */
257*7c478bd9Sstevel@tonic-gate 
258*7c478bd9Sstevel@tonic-gate 
259*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
260*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
261*7c478bd9Sstevel@tonic-gate #endif
262*7c478bd9Sstevel@tonic-gate 	itm_size_t	itm_hdr_size;		/* ITM header size */
263*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
264*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
265*7c478bd9Sstevel@tonic-gate #endif
266*7c478bd9Sstevel@tonic-gate 
267*7c478bd9Sstevel@tonic-gate 	itm_place_t	itm_size;		/* size of ITM (file size) */
268*7c478bd9Sstevel@tonic-gate 	itm_data_t	type_id;		/* type identifier */
269*7c478bd9Sstevel@tonic-gate 	itm_data_t	interpreter;		/* interpreter */
270*7c478bd9Sstevel@tonic-gate 	itm_place_t	op_init_tbl;		/* init operation table */
271*7c478bd9Sstevel@tonic-gate 	itm_place_t	op_reset_tbl;		/* reset operation table */
272*7c478bd9Sstevel@tonic-gate 	itm_place_t	direc_init_tbl;		/* initial direction table */
273*7c478bd9Sstevel@tonic-gate 
274*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
275*7c478bd9Sstevel@tonic-gate 	pad_t		pad3;
276*7c478bd9Sstevel@tonic-gate #endif
277*7c478bd9Sstevel@tonic-gate 	itm_num_t	reg_num;		/* number of register */
278*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
279*7c478bd9Sstevel@tonic-gate 	pad_t		pad3;
280*7c478bd9Sstevel@tonic-gate #endif
281*7c478bd9Sstevel@tonic-gate 
282*7c478bd9Sstevel@tonic-gate 	itm_place_t	info_hdr;		/* ITM Info header */
283*7c478bd9Sstevel@tonic-gate } itm_hdr_t;
284*7c478bd9Sstevel@tonic-gate 
285*7c478bd9Sstevel@tonic-gate 
286*7c478bd9Sstevel@tonic-gate /*
287*7c478bd9Sstevel@tonic-gate  * ITM Info header
288*7c478bd9Sstevel@tonic-gate  */
289*7c478bd9Sstevel@tonic-gate typedef struct {
290*7c478bd9Sstevel@tonic-gate 	itm_section_info_t	str_sec;	/* string section */
291*7c478bd9Sstevel@tonic-gate 	itm_section_info_t	direc_tbl_sec;	/* direction table section */
292*7c478bd9Sstevel@tonic-gate 	itm_section_info_t	cond_tbl_sec;	/* condition table section */
293*7c478bd9Sstevel@tonic-gate 	itm_section_info_t	map_tbl_sec;	/* map table section */
294*7c478bd9Sstevel@tonic-gate 	itm_section_info_t	op_tbl_sec;	/* operation table section */
295*7c478bd9Sstevel@tonic-gate 	itm_section_info_t	range_tbl_sec;	/* range section */
296*7c478bd9Sstevel@tonic-gate 	itm_section_info_t	escapeseq_tbl_sec; /* escapeseq section */
297*7c478bd9Sstevel@tonic-gate 	itm_section_info_t	data_sec;	/* data section */
298*7c478bd9Sstevel@tonic-gate 	itm_section_info_t	name_sec;	/* name section */
299*7c478bd9Sstevel@tonic-gate 
300*7c478bd9Sstevel@tonic-gate 	itm_place_tbl_info_t	str_plc_tbl;	/* string info */
301*7c478bd9Sstevel@tonic-gate 	itm_place_tbl_info_t	direc_plc_tbl;	/* direction table info */
302*7c478bd9Sstevel@tonic-gate 	itm_place_tbl_info_t	cond_plc_tbl;	/* condition table info */
303*7c478bd9Sstevel@tonic-gate 	itm_place_tbl_info_t	map_plc_tbl;	/* map table info */
304*7c478bd9Sstevel@tonic-gate 	itm_place_tbl_info_t	op_plc_tbl;	/* operation table info */
305*7c478bd9Sstevel@tonic-gate 	itm_place_tbl_info_t	range_plc_tbl;	/* range info */
306*7c478bd9Sstevel@tonic-gate 	itm_place_tbl_info_t	escapeseq_plc_tbl; /* escape info */
307*7c478bd9Sstevel@tonic-gate 	itm_place_tbl_info_t	data_plc_tbl;	/* data info */
308*7c478bd9Sstevel@tonic-gate 	itm_place_tbl_info_t	name_plc_tbl;	/* name info */
309*7c478bd9Sstevel@tonic-gate 	itm_place_tbl_info_t	reg_plc_tbl;	/* register name info */
310*7c478bd9Sstevel@tonic-gate } itm_info_hdr_t;
311*7c478bd9Sstevel@tonic-gate 
312*7c478bd9Sstevel@tonic-gate 
313*7c478bd9Sstevel@tonic-gate /*
314*7c478bd9Sstevel@tonic-gate  * Direction
315*7c478bd9Sstevel@tonic-gate  */
316*7c478bd9Sstevel@tonic-gate 
317*7c478bd9Sstevel@tonic-gate typedef enum {
318*7c478bd9Sstevel@tonic-gate 	ITM_ACTION_NONE,	/* not used */
319*7c478bd9Sstevel@tonic-gate 	ITM_ACTION_DIRECTION,	/* direction */
320*7c478bd9Sstevel@tonic-gate 	ITM_ACTION_MAP,		/* map */
321*7c478bd9Sstevel@tonic-gate 	ITM_ACTION_OPERATION	/* operation */
322*7c478bd9Sstevel@tonic-gate } itm_action_type_t;
323*7c478bd9Sstevel@tonic-gate 
324*7c478bd9Sstevel@tonic-gate typedef struct {
325*7c478bd9Sstevel@tonic-gate 	itm_place_t		condition;
326*7c478bd9Sstevel@tonic-gate 	itm_place_t		action;
327*7c478bd9Sstevel@tonic-gate } itm_direc_t;
328*7c478bd9Sstevel@tonic-gate 
329*7c478bd9Sstevel@tonic-gate 
330*7c478bd9Sstevel@tonic-gate /*
331*7c478bd9Sstevel@tonic-gate  * Condition
332*7c478bd9Sstevel@tonic-gate  */
333*7c478bd9Sstevel@tonic-gate 
334*7c478bd9Sstevel@tonic-gate typedef enum {
335*7c478bd9Sstevel@tonic-gate 	ITM_COND_NONE = 0,	/* not used */
336*7c478bd9Sstevel@tonic-gate 	ITM_COND_BETWEEN = 1,	/* input data is inside of ranges */
337*7c478bd9Sstevel@tonic-gate 	ITM_COND_EXPR = 2,	/* expression */
338*7c478bd9Sstevel@tonic-gate 	ITM_COND_ESCAPESEQ = 3	/* escape sequense */
339*7c478bd9Sstevel@tonic-gate } itm_cond_type_t;
340*7c478bd9Sstevel@tonic-gate 
341*7c478bd9Sstevel@tonic-gate typedef struct {
342*7c478bd9Sstevel@tonic-gate 	pad_t		pad;
343*7c478bd9Sstevel@tonic-gate 	itm_cond_type_t	type;
344*7c478bd9Sstevel@tonic-gate 	union {
345*7c478bd9Sstevel@tonic-gate 		itm_place_t	place;
346*7c478bd9Sstevel@tonic-gate 		itm_data_t	data;
347*7c478bd9Sstevel@tonic-gate 	}		operand;
348*7c478bd9Sstevel@tonic-gate } itm_cond_t;
349*7c478bd9Sstevel@tonic-gate 
350*7c478bd9Sstevel@tonic-gate typedef struct {
351*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
352*7c478bd9Sstevel@tonic-gate 	pad_t		pad;
353*7c478bd9Sstevel@tonic-gate #endif
354*7c478bd9Sstevel@tonic-gate 	itm_size_t	len;
355*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
356*7c478bd9Sstevel@tonic-gate 	pad_t		pad;
357*7c478bd9Sstevel@tonic-gate #endif
358*7c478bd9Sstevel@tonic-gate } itm_range_hdr_t;
359*7c478bd9Sstevel@tonic-gate 
360*7c478bd9Sstevel@tonic-gate typedef struct {
361*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
362*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
363*7c478bd9Sstevel@tonic-gate #endif
364*7c478bd9Sstevel@tonic-gate 	itm_size_t	len_min;
365*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
366*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
367*7c478bd9Sstevel@tonic-gate #endif
368*7c478bd9Sstevel@tonic-gate 
369*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
370*7c478bd9Sstevel@tonic-gate 	pad_t		pad2;
371*7c478bd9Sstevel@tonic-gate #endif
372*7c478bd9Sstevel@tonic-gate 	itm_size_t	len_max;
373*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
374*7c478bd9Sstevel@tonic-gate 	pad_t		pad2;
375*7c478bd9Sstevel@tonic-gate #endif
376*7c478bd9Sstevel@tonic-gate } itm_escapeseq_hdr_t;
377*7c478bd9Sstevel@tonic-gate 
378*7c478bd9Sstevel@tonic-gate 
379*7c478bd9Sstevel@tonic-gate /*
380*7c478bd9Sstevel@tonic-gate  * Map table: octet-sequence to octet-sequence: index
381*7c478bd9Sstevel@tonic-gate  */
382*7c478bd9Sstevel@tonic-gate 
383*7c478bd9Sstevel@tonic-gate typedef struct {
384*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
385*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
386*7c478bd9Sstevel@tonic-gate #endif
387*7c478bd9Sstevel@tonic-gate 	itm_size_t	source_len;	/* source length */
388*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
389*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
390*7c478bd9Sstevel@tonic-gate #endif
391*7c478bd9Sstevel@tonic-gate 
392*7c478bd9Sstevel@tonic-gate 
393*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
394*7c478bd9Sstevel@tonic-gate 	pad_t		pad2;
395*7c478bd9Sstevel@tonic-gate #endif
396*7c478bd9Sstevel@tonic-gate 	itm_size_t	result_len;	/* result length */
397*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
398*7c478bd9Sstevel@tonic-gate 	pad_t		pad2;
399*7c478bd9Sstevel@tonic-gate #endif
400*7c478bd9Sstevel@tonic-gate 
401*7c478bd9Sstevel@tonic-gate 	itm_place_t	start;		/* start offset */
402*7c478bd9Sstevel@tonic-gate 	itm_place_t	end;		/* end offset */
403*7c478bd9Sstevel@tonic-gate 
404*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
405*7c478bd9Sstevel@tonic-gate 	pad_t		pad3_num;
406*7c478bd9Sstevel@tonic-gate #endif
407*7c478bd9Sstevel@tonic-gate 	itm_num_t	default_error;
408*7c478bd9Sstevel@tonic-gate /*
409*7c478bd9Sstevel@tonic-gate  *		-1:path through
410*7c478bd9Sstevel@tonic-gate  *		 0:with default value
411*7c478bd9Sstevel@tonic-gate  *		 1:with error table
412*7c478bd9Sstevel@tonic-gate  *		 2:without error table
413*7c478bd9Sstevel@tonic-gate  */
414*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
415*7c478bd9Sstevel@tonic-gate 	pad_t		pad3_num;
416*7c478bd9Sstevel@tonic-gate #endif
417*7c478bd9Sstevel@tonic-gate 
418*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
419*7c478bd9Sstevel@tonic-gate 	pad_t		pad4_num;
420*7c478bd9Sstevel@tonic-gate #endif
421*7c478bd9Sstevel@tonic-gate 	itm_num_t	error_num;
422*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
423*7c478bd9Sstevel@tonic-gate 	pad_t		pad4_num;
424*7c478bd9Sstevel@tonic-gate #endif
425*7c478bd9Sstevel@tonic-gate 
426*7c478bd9Sstevel@tonic-gate 
427*7c478bd9Sstevel@tonic-gate } itm_map_idx_fix_hdr_t;
428*7c478bd9Sstevel@tonic-gate 
429*7c478bd9Sstevel@tonic-gate /*
430*7c478bd9Sstevel@tonic-gate  * Map table: octet-sequence to octet-sequence: lookup
431*7c478bd9Sstevel@tonic-gate  */
432*7c478bd9Sstevel@tonic-gate 
433*7c478bd9Sstevel@tonic-gate typedef struct {
434*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
435*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
436*7c478bd9Sstevel@tonic-gate #endif
437*7c478bd9Sstevel@tonic-gate 	itm_size_t	source_len;	/* source length */
438*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
439*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
440*7c478bd9Sstevel@tonic-gate #endif
441*7c478bd9Sstevel@tonic-gate 
442*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
443*7c478bd9Sstevel@tonic-gate 	pad_t		pad2;
444*7c478bd9Sstevel@tonic-gate #endif
445*7c478bd9Sstevel@tonic-gate 	itm_size_t	result_len;	/* result length */
446*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
447*7c478bd9Sstevel@tonic-gate 	pad_t		pad2;
448*7c478bd9Sstevel@tonic-gate #endif
449*7c478bd9Sstevel@tonic-gate 
450*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
451*7c478bd9Sstevel@tonic-gate 	pad_t		pad3_num;
452*7c478bd9Sstevel@tonic-gate #endif
453*7c478bd9Sstevel@tonic-gate 	itm_num_t	default_error;
454*7c478bd9Sstevel@tonic-gate /*
455*7c478bd9Sstevel@tonic-gate  *		-1:path through
456*7c478bd9Sstevel@tonic-gate  *		 0:with default value
457*7c478bd9Sstevel@tonic-gate  *		 1:with error table
458*7c478bd9Sstevel@tonic-gate  *		 2:without error table
459*7c478bd9Sstevel@tonic-gate  */
460*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
461*7c478bd9Sstevel@tonic-gate 	pad_t		pad3_num;
462*7c478bd9Sstevel@tonic-gate #endif
463*7c478bd9Sstevel@tonic-gate 
464*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
465*7c478bd9Sstevel@tonic-gate 	pad_t		pad4_num;
466*7c478bd9Sstevel@tonic-gate #endif
467*7c478bd9Sstevel@tonic-gate 	itm_num_t	error_num;
468*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
469*7c478bd9Sstevel@tonic-gate 	pad_t		pad4_num;
470*7c478bd9Sstevel@tonic-gate #endif
471*7c478bd9Sstevel@tonic-gate } itm_map_lookup_hdr_t;
472*7c478bd9Sstevel@tonic-gate 
473*7c478bd9Sstevel@tonic-gate /*
474*7c478bd9Sstevel@tonic-gate  * Map table: octet-sequence to octet-sequence: hash
475*7c478bd9Sstevel@tonic-gate  */
476*7c478bd9Sstevel@tonic-gate 
477*7c478bd9Sstevel@tonic-gate typedef struct {
478*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
479*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
480*7c478bd9Sstevel@tonic-gate #endif
481*7c478bd9Sstevel@tonic-gate 	itm_size_t	source_len;	/* source length */
482*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
483*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
484*7c478bd9Sstevel@tonic-gate #endif
485*7c478bd9Sstevel@tonic-gate 
486*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
487*7c478bd9Sstevel@tonic-gate 	pad_t		pad2;
488*7c478bd9Sstevel@tonic-gate #endif
489*7c478bd9Sstevel@tonic-gate 	itm_size_t	result_len;	/* result length */
490*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
491*7c478bd9Sstevel@tonic-gate 	pad_t		pad2;
492*7c478bd9Sstevel@tonic-gate #endif
493*7c478bd9Sstevel@tonic-gate 
494*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
495*7c478bd9Sstevel@tonic-gate 	pad_t		pad3;
496*7c478bd9Sstevel@tonic-gate #endif
497*7c478bd9Sstevel@tonic-gate 	itm_size_t	hash_tbl_size;	/* hash table size */
498*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
499*7c478bd9Sstevel@tonic-gate 	pad_t		pad3;
500*7c478bd9Sstevel@tonic-gate #endif
501*7c478bd9Sstevel@tonic-gate 
502*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
503*7c478bd9Sstevel@tonic-gate 	pad_t		pad4;
504*7c478bd9Sstevel@tonic-gate #endif
505*7c478bd9Sstevel@tonic-gate 	itm_num_t	hash_tbl_num;	/* hash table entryies */
506*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
507*7c478bd9Sstevel@tonic-gate 	pad_t		pad4;
508*7c478bd9Sstevel@tonic-gate #endif
509*7c478bd9Sstevel@tonic-gate 
510*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
511*7c478bd9Sstevel@tonic-gate 	pad_t		pad5;
512*7c478bd9Sstevel@tonic-gate #endif
513*7c478bd9Sstevel@tonic-gate 	itm_size_t	hash_of_size;	/* hash overflow table size */
514*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
515*7c478bd9Sstevel@tonic-gate 	pad_t		pad5;
516*7c478bd9Sstevel@tonic-gate #endif
517*7c478bd9Sstevel@tonic-gate 
518*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
519*7c478bd9Sstevel@tonic-gate 	pad_t		pad6;
520*7c478bd9Sstevel@tonic-gate #endif
521*7c478bd9Sstevel@tonic-gate 	itm_num_t	hash_of_num;	/* hash overflow table entryies */
522*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
523*7c478bd9Sstevel@tonic-gate 	pad_t		pad6;
524*7c478bd9Sstevel@tonic-gate #endif
525*7c478bd9Sstevel@tonic-gate 
526*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
527*7c478bd9Sstevel@tonic-gate 	pad_t		pad7_num;
528*7c478bd9Sstevel@tonic-gate #endif
529*7c478bd9Sstevel@tonic-gate 	itm_num_t	default_error;
530*7c478bd9Sstevel@tonic-gate /*
531*7c478bd9Sstevel@tonic-gate  *		-1:path through
532*7c478bd9Sstevel@tonic-gate  *		 0:with default value
533*7c478bd9Sstevel@tonic-gate  *		 1:with error table
534*7c478bd9Sstevel@tonic-gate  *		 2:without error table
535*7c478bd9Sstevel@tonic-gate  */
536*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
537*7c478bd9Sstevel@tonic-gate 	pad_t		pad7_num;
538*7c478bd9Sstevel@tonic-gate #endif
539*7c478bd9Sstevel@tonic-gate 
540*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
541*7c478bd9Sstevel@tonic-gate 	pad_t		pad8_num;
542*7c478bd9Sstevel@tonic-gate #endif
543*7c478bd9Sstevel@tonic-gate 	itm_num_t	error_num;
544*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
545*7c478bd9Sstevel@tonic-gate 	pad_t		pad8_num;
546*7c478bd9Sstevel@tonic-gate #endif
547*7c478bd9Sstevel@tonic-gate 
548*7c478bd9Sstevel@tonic-gate } itm_map_hash_hdr_t;
549*7c478bd9Sstevel@tonic-gate 
550*7c478bd9Sstevel@tonic-gate /*
551*7c478bd9Sstevel@tonic-gate  * Map table: octet-sequence to octet-sequence: dense encoding
552*7c478bd9Sstevel@tonic-gate  */
553*7c478bd9Sstevel@tonic-gate 
554*7c478bd9Sstevel@tonic-gate typedef struct {
555*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
556*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
557*7c478bd9Sstevel@tonic-gate #endif
558*7c478bd9Sstevel@tonic-gate 	itm_size_t	source_len;	/* source length */
559*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
560*7c478bd9Sstevel@tonic-gate 	pad_t		pad1;
561*7c478bd9Sstevel@tonic-gate #endif
562*7c478bd9Sstevel@tonic-gate 
563*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
564*7c478bd9Sstevel@tonic-gate 	pad_t		pad2;
565*7c478bd9Sstevel@tonic-gate #endif
566*7c478bd9Sstevel@tonic-gate 	itm_size_t	result_len;	/* result length */
567*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
568*7c478bd9Sstevel@tonic-gate 	pad_t		pad2;
569*7c478bd9Sstevel@tonic-gate #endif
570*7c478bd9Sstevel@tonic-gate 
571*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
572*7c478bd9Sstevel@tonic-gate 	pad_t		pad3_num;
573*7c478bd9Sstevel@tonic-gate #endif
574*7c478bd9Sstevel@tonic-gate 	itm_num_t	default_error;
575*7c478bd9Sstevel@tonic-gate /*
576*7c478bd9Sstevel@tonic-gate  *		-1:path through
577*7c478bd9Sstevel@tonic-gate  *		 0:with default value
578*7c478bd9Sstevel@tonic-gate  *		 1:with error table
579*7c478bd9Sstevel@tonic-gate  *		 2:without error table
580*7c478bd9Sstevel@tonic-gate  */
581*7c478bd9Sstevel@tonic-gate 
582*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
583*7c478bd9Sstevel@tonic-gate 	pad_t		pad3_num;
584*7c478bd9Sstevel@tonic-gate #endif
585*7c478bd9Sstevel@tonic-gate 
586*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
587*7c478bd9Sstevel@tonic-gate 	pad_t		pad4_num;
588*7c478bd9Sstevel@tonic-gate #endif
589*7c478bd9Sstevel@tonic-gate 	itm_num_t	error_num;
590*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
591*7c478bd9Sstevel@tonic-gate 	pad_t		pad4_num;
592*7c478bd9Sstevel@tonic-gate #endif
593*7c478bd9Sstevel@tonic-gate } itm_map_dense_enc_hdr_t;
594*7c478bd9Sstevel@tonic-gate 
595*7c478bd9Sstevel@tonic-gate 
596*7c478bd9Sstevel@tonic-gate 
597*7c478bd9Sstevel@tonic-gate /*
598*7c478bd9Sstevel@tonic-gate  * Operation
599*7c478bd9Sstevel@tonic-gate  */
600*7c478bd9Sstevel@tonic-gate 
601*7c478bd9Sstevel@tonic-gate typedef enum {	/* Operation Type */
602*7c478bd9Sstevel@tonic-gate 	ITM_OP_NONE,		/* not used */
603*7c478bd9Sstevel@tonic-gate 	ITM_OP_ERROR,		/* error */
604*7c478bd9Sstevel@tonic-gate 	ITM_OP_ERROR_D,		/* error */
605*7c478bd9Sstevel@tonic-gate 	ITM_OP_OUT,		/* output */
606*7c478bd9Sstevel@tonic-gate 	ITM_OP_OUT_D,		/* output */
607*7c478bd9Sstevel@tonic-gate 	ITM_OP_OUT_S,		/* output */
608*7c478bd9Sstevel@tonic-gate 	ITM_OP_OUT_R,		/* output */
609*7c478bd9Sstevel@tonic-gate 	ITM_OP_OUT_INVD,	/* output */
610*7c478bd9Sstevel@tonic-gate 	ITM_OP_DISCARD,		/* discard */
611*7c478bd9Sstevel@tonic-gate 	ITM_OP_DISCARD_D,	/* discard */
612*7c478bd9Sstevel@tonic-gate 	ITM_OP_EXPR,		/* expression */
613*7c478bd9Sstevel@tonic-gate 	ITM_OP_IF,		/* if */
614*7c478bd9Sstevel@tonic-gate 	ITM_OP_IF_ELSE,		/* if_else */
615*7c478bd9Sstevel@tonic-gate 	ITM_OP_DIRECTION,	/* switch direction */
616*7c478bd9Sstevel@tonic-gate 	ITM_OP_MAP,		/* use map */
617*7c478bd9Sstevel@tonic-gate 	ITM_OP_OPERATION,	/* invoke operation */
618*7c478bd9Sstevel@tonic-gate 	ITM_OP_INIT,		/* invoke init operation */
619*7c478bd9Sstevel@tonic-gate 	ITM_OP_RESET,		/* invoke reset operation */
620*7c478bd9Sstevel@tonic-gate 	ITM_OP_BREAK,		/* break */
621*7c478bd9Sstevel@tonic-gate 	ITM_OP_RETURN,		/* return */
622*7c478bd9Sstevel@tonic-gate 	ITM_OP_PRINTCHR,	/* print out argument as character */
623*7c478bd9Sstevel@tonic-gate 	ITM_OP_PRINTHD,		/* print out argument as hexadecimal */
624*7c478bd9Sstevel@tonic-gate 	ITM_OP_PRINTINT		/* print out argument as integer */
625*7c478bd9Sstevel@tonic-gate } itm_op_type_t;
626*7c478bd9Sstevel@tonic-gate 
627*7c478bd9Sstevel@tonic-gate typedef struct {
628*7c478bd9Sstevel@tonic-gate 	pad_t				pad;
629*7c478bd9Sstevel@tonic-gate 	itm_op_type_t			type;
630*7c478bd9Sstevel@tonic-gate 	itm_place_t			name;
631*7c478bd9Sstevel@tonic-gate 
632*7c478bd9Sstevel@tonic-gate 	union {
633*7c478bd9Sstevel@tonic-gate 		itm_place_t		operand[3];
634*7c478bd9Sstevel@tonic-gate 		itm_data_t		value;
635*7c478bd9Sstevel@tonic-gate 		struct {
636*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
637*7c478bd9Sstevel@tonic-gate 			pad_t		pad_num;
638*7c478bd9Sstevel@tonic-gate #endif
639*7c478bd9Sstevel@tonic-gate 			itm_num_t	num;
640*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
641*7c478bd9Sstevel@tonic-gate 			pad_t		pad_num;
642*7c478bd9Sstevel@tonic-gate #endif
643*7c478bd9Sstevel@tonic-gate 		}			itm_op_num;
644*7c478bd9Sstevel@tonic-gate 	}		data;
645*7c478bd9Sstevel@tonic-gate } itm_op_t;
646*7c478bd9Sstevel@tonic-gate #define	itm_opnum itm_op_num.num
647*7c478bd9Sstevel@tonic-gate #define	itm_oppad itm_op_num.pad_num
648*7c478bd9Sstevel@tonic-gate 
649*7c478bd9Sstevel@tonic-gate /*
650*7c478bd9Sstevel@tonic-gate  * Expression
651*7c478bd9Sstevel@tonic-gate  */
652*7c478bd9Sstevel@tonic-gate 
653*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_PROTO(type, op0, op1)	ITM_EXPR_##type##_##op0##_##op1
654*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_BIN(type)			\
655*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_PROTO(type, E, E),		\
656*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_PROTO(type, E, D),		\
657*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_PROTO(type, E, R),		\
658*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_PROTO(type, E, INVD),		\
659*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_PROTO(type, D, E),		\
660*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_PROTO(type, D, D),		\
661*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_PROTO(type, D, R),		\
662*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_PROTO(type, D, INVD),		\
663*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_PROTO(type, R, E),		\
664*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_PROTO(type, R, D),		\
665*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_PROTO(type, R, R),		\
666*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_PROTO(type, R, INVD),		\
667*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_PROTO(type, INVD, E),		\
668*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_PROTO(type, INVD, D),		\
669*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_PROTO(type, INVD, R),		\
670*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_PROTO(type, INVD, INVD)
671*7c478bd9Sstevel@tonic-gate 
672*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_PLUS		ITM_EXPR_PLUS_E_E
673*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_MINUS		ITM_EXPR_MINUS_E_E
674*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_MUL		ITM_EXPR_MUL_E_E
675*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_DIV		ITM_EXPR_DIV_E_E
676*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_MOD		ITM_EXPR_MOD_E_E
677*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_SHIFT_L	ITM_EXPR_SHIFT_L_E_E
678*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_SHIFT_R	ITM_EXPR_SHIFT_R_E_E
679*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_OR		ITM_EXPR_OR_E_E
680*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_XOR		ITM_EXPR_XOR_E_E
681*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_AND		ITM_EXPR_AND_E_E
682*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_EQ		ITM_EXPR_EQ_E_E
683*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_NE		ITM_EXPR_NE_E_E
684*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_GT		ITM_EXPR_GT_E_E
685*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_GE		ITM_EXPR_GE_E_E
686*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_LT		ITM_EXPR_LT_E_E
687*7c478bd9Sstevel@tonic-gate #define	ITM_EXPR_LE		ITM_EXPR_LE_E_E
688*7c478bd9Sstevel@tonic-gate 
689*7c478bd9Sstevel@tonic-gate typedef enum {	/* Expression Type */
690*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_NONE,		/* not used */
691*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_NOP,		/* not used */
692*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_NAME,		/* not used */
693*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_INT,		/* integer */
694*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_SEQ,		/* byte sequence */
695*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_REG,		/* register */
696*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_IN_VECTOR,	/* in[expr] */
697*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_IN_VECTOR_D,	/* in[DECIMAL] */
698*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_OUT,		/* out */
699*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_TRUE,		/* true */
700*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_FALSE,		/* false */
701*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_IN,		/* input data */
702*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_UMINUS,	/* unary minus */
703*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_BIN(PLUS),	/* A +	B */
704*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_BIN(MINUS),	/* A -	B */
705*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_BIN(MUL),	/* A *	B */
706*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_BIN(DIV),	/* A /	B */
707*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_BIN(MOD),	/* A %	B */
708*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_BIN(SHIFT_L),	/* A << B */
709*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_BIN(SHIFT_R),	/* A >> B */
710*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_BIN(OR),	/* A |	B */
711*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_BIN(XOR),	/* A ^	B */
712*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_BIN(AND),	/* A &	B */
713*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_BIN(EQ),	/* A == B */
714*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_BIN(NE),	/* A != B */
715*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_BIN(GT),	/* A >	B */
716*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_BIN(GE),	/* A >= B */
717*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_BIN(LT),	/* A <	B */
718*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_BIN(LE),	/* A <= B */
719*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_NOT,		/*   !A	  */
720*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_NEG,		/*   ~A	  */
721*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_LOR,		/* A || B */
722*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_LAND,		/* A && B */
723*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_ASSIGN,	/* A  = B */
724*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_OUT_ASSIGN,	/* out = A */
725*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_IN_EQ,		/* in == A */
726*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_IF,		/* if  */
727*7c478bd9Sstevel@tonic-gate 	ITM_EXPR_ELSE		/* else */
728*7c478bd9Sstevel@tonic-gate } itm_expr_type_t;
729*7c478bd9Sstevel@tonic-gate 
730*7c478bd9Sstevel@tonic-gate #define	ITM_OPERAND_EXPR	(0)
731*7c478bd9Sstevel@tonic-gate #define	ITM_OPERAND_PLACE	(1)
732*7c478bd9Sstevel@tonic-gate #define	ITM_OPERAND_VALUE	(2)
733*7c478bd9Sstevel@tonic-gate #define	ITM_OPERAND_REGISTER	(3)
734*7c478bd9Sstevel@tonic-gate 
735*7c478bd9Sstevel@tonic-gate typedef struct {
736*7c478bd9Sstevel@tonic-gate 	pad_t			pad;
737*7c478bd9Sstevel@tonic-gate 	itm_expr_type_t		type;
738*7c478bd9Sstevel@tonic-gate 	union {
739*7c478bd9Sstevel@tonic-gate 		itm_place_t		operand[2];
740*7c478bd9Sstevel@tonic-gate 		itm_data_t		value;
741*7c478bd9Sstevel@tonic-gate 		struct {
742*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && !defined(_LITTLE_ENDIAN)
743*7c478bd9Sstevel@tonic-gate 			pad_t		pad_num;
744*7c478bd9Sstevel@tonic-gate #endif
745*7c478bd9Sstevel@tonic-gate 			itm_num_t	num;
746*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && defined(_LITTLE_ENDIAN)
747*7c478bd9Sstevel@tonic-gate 			pad_t		pad_num;
748*7c478bd9Sstevel@tonic-gate #endif
749*7c478bd9Sstevel@tonic-gate 		}			itm_ex_num;
750*7c478bd9Sstevel@tonic-gate 	}	data;
751*7c478bd9Sstevel@tonic-gate } itm_expr_t;
752*7c478bd9Sstevel@tonic-gate #define	itm_exnum itm_ex_num.num
753*7c478bd9Sstevel@tonic-gate #define	itm_expad itm_ex_num.pad_num
754*7c478bd9Sstevel@tonic-gate 
755*7c478bd9Sstevel@tonic-gate 
756*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
757*7c478bd9Sstevel@tonic-gate }
758*7c478bd9Sstevel@tonic-gate #endif
759*7c478bd9Sstevel@tonic-gate 
760*7c478bd9Sstevel@tonic-gate #endif /* !_ICONV_TM_H */
761