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