]>
git.saurik.com Git - apple/libc.git/blob - ppc/sys/genassym.h
729dfa9fd7b1b88bce6217919309651d31ed5323
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
23 * genassym.h -- macros of use with genassym.c and assymdefs.c
26 #import <architecture/ppc/reg_help.h>
27 #import <architecture/ppc/macro_help.h>
29 #define PRINT_OFFSET(ptr_type, field) \
31 print_define("", #ptr_type, #field); \
32 print_hex((unsigned) &(((ptr_type)0)->field)); \
35 #define PRINT_BIT_FIELD(reg_type, field) \
38 CONTENTS(__reg) = 0; \
39 __reg.field = (typeof (__reg.field)) -1; \
40 print_define("", #reg_type, #field); \
41 print_hex(CONTENTS(__reg)); \
44 #define PRINT_ENUM(item) \
46 print_define("", "", #item); \
47 print_hex((unsigned)item); \
50 #define PRINT_DEFINE(macro) \
52 print_define("", "", #macro); \
53 print_str(STRINGIFY(macro)); \
56 #define PRINT_CONSTANT(macro) \
58 print_define("", "", #macro); \
59 print_hex((unsigned)macro); \
62 #define PRINT_REGADDR(macro) \
64 print_define("", "", #macro); \
65 print_hex((unsigned) ¯o); \
68 #define PRINT_REG_PAIR(struct_ptr, name0, name1) \
70 print_define("", #struct_ptr, #name0 "_" #name1); \
71 print_hex((unsigned) &(((struct_ptr)0)->U_##name0##_##name1)); \
74 #define PRINT_BIT_POS(reg_type, field) \
77 CONTENTS(__reg) = 0; \
79 print_define("", #reg_type, #field "_BIT"); \
80 print_dec((int) bit_num(#reg_type, #field, CONTENTS(__reg))); \
83 #define PRINT_FIELD_INFO(reg_type, field) \
86 CONTENTS(__reg) = 0; \
88 print_define("", #reg_type, #field "_OFF"); \
89 print_dec((int) bit_num(#reg_type, #field, CONTENTS(__reg))); \
90 print_define("", #reg_type, #field "_WIDTH"); \
91 print_dec((int) field_width(#reg_type, #field, CONTENTS(__reg)));\
94 #define PRINT_L2_SIZE(type) \
96 print_define("L2_SIZEOF", #type, ""); \
97 print_dec((int) log2(sizeof(type), #type)); \
100 #define PRINT_SIZEOF(type) \
102 print_define("SIZEOF", #type, ""); \
103 print_dec((int) sizeof(type)); \
106 #define PRINT_L2_CONSTANT(macro) \
108 print_define("L2", "", #macro); \
109 print_dec((int) log2(macro, #macro)); \
116 extern void comment(cmt_level_t level
, const char *cmt
);
117 extern void print_define(const char *prefix
, const char *type_name
,
119 extern void print_dec(int val
);
120 extern void print_hex(unsigned val
);
121 extern void print_str(const char *str
);
122 extern unsigned bit_num(char *reg_type
, char *field
, unsigned bits
);
123 extern unsigned field_width(char *reg_type
, char *field
, unsigned bits
);
124 extern unsigned log2(unsigned val
, char *type
);
125 extern void assymdefs(void);