]>
git.saurik.com Git - apple/libc.git/blob - ppc/sys/genassym.h
409770341402e9ba73a0dd0123a3ff106ca1be13
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 * genassym.h -- macros of use with genassym.c and assymdefs.c
27 #import <architecture/ppc/reg_help.h>
28 #import <architecture/ppc/macro_help.h>
30 #define PRINT_OFFSET(ptr_type, field) \
32 print_define("", #ptr_type, #field); \
33 print_hex((unsigned) &(((ptr_type)0)->field)); \
36 #define PRINT_BIT_FIELD(reg_type, field) \
39 CONTENTS(__reg) = 0; \
40 __reg.field = (typeof (__reg.field)) -1; \
41 print_define("", #reg_type, #field); \
42 print_hex(CONTENTS(__reg)); \
45 #define PRINT_ENUM(item) \
47 print_define("", "", #item); \
48 print_hex((unsigned)item); \
51 #define PRINT_DEFINE(macro) \
53 print_define("", "", #macro); \
54 print_str(STRINGIFY(macro)); \
57 #define PRINT_CONSTANT(macro) \
59 print_define("", "", #macro); \
60 print_hex((unsigned)macro); \
63 #define PRINT_REGADDR(macro) \
65 print_define("", "", #macro); \
66 print_hex((unsigned) ¯o); \
69 #define PRINT_REG_PAIR(struct_ptr, name0, name1) \
71 print_define("", #struct_ptr, #name0 "_" #name1); \
72 print_hex((unsigned) &(((struct_ptr)0)->U_##name0##_##name1)); \
75 #define PRINT_BIT_POS(reg_type, field) \
78 CONTENTS(__reg) = 0; \
80 print_define("", #reg_type, #field "_BIT"); \
81 print_dec((int) bit_num(#reg_type, #field, CONTENTS(__reg))); \
84 #define PRINT_FIELD_INFO(reg_type, field) \
87 CONTENTS(__reg) = 0; \
89 print_define("", #reg_type, #field "_OFF"); \
90 print_dec((int) bit_num(#reg_type, #field, CONTENTS(__reg))); \
91 print_define("", #reg_type, #field "_WIDTH"); \
92 print_dec((int) field_width(#reg_type, #field, CONTENTS(__reg)));\
95 #define PRINT_L2_SIZE(type) \
97 print_define("L2_SIZEOF", #type, ""); \
98 print_dec((int) log2(sizeof(type), #type)); \
101 #define PRINT_SIZEOF(type) \
103 print_define("SIZEOF", #type, ""); \
104 print_dec((int) sizeof(type)); \
107 #define PRINT_L2_CONSTANT(macro) \
109 print_define("L2", "", #macro); \
110 print_dec((int) log2(macro, #macro)); \
117 extern void comment(cmt_level_t level
, const char *cmt
);
118 extern void print_define(const char *prefix
, const char *type_name
,
120 extern void print_dec(int val
);
121 extern void print_hex(unsigned val
);
122 extern void print_str(const char *str
);
123 extern unsigned bit_num(char *reg_type
, char *field
, unsigned bits
);
124 extern unsigned field_width(char *reg_type
, char *field
, unsigned bits
);
125 extern unsigned log2(unsigned val
, char *type
);
126 extern void assymdefs(void);