1 /* Generate targ-vals.h and targ-map.c. */
12 static struct tdefs sys_tdefs
[] = {
14 #include "nltvals.def"
19 static struct tdefs errno_tdefs
[] = {
21 #include "nltvals.def"
26 static struct tdefs open_tdefs
[] = {
28 #include "nltvals.def"
34 gen_targ_vals_h (void)
38 printf ("/* Target header values needed by the simulator and gdb. */\n");
39 printf ("/* This file is machine generated by gentmap.c. */\n\n");
41 printf ("#ifndef TARG_VALS_H\n");
42 printf ("#define TARG_VALS_H\n\n");
44 printf ("/* syscall values */\n");
45 for (t
= &sys_tdefs
[0]; t
->symbol
; ++t
)
46 printf ("#define TARGET_%s %d\n", t
->symbol
, t
->value
);
49 printf ("/* errno values */\n");
50 for (t
= &errno_tdefs
[0]; t
->symbol
; ++t
)
51 printf ("#define TARGET_%s %d\n", t
->symbol
, t
->value
);
54 printf ("/* open flag values */\n");
55 for (t
= &open_tdefs
[0]; t
->symbol
; ++t
)
56 printf ("#define TARGET_%s 0x%x\n", t
->symbol
, t
->value
);
59 printf ("#endif /* TARG_VALS_H */\n");
67 printf ("/* Target value mapping utilities needed by the simulator and gdb. */\n");
68 printf ("/* This file is machine generated by gentmap.c. */\n\n");
70 printf ("#include \"config.h\"\n");
71 printf ("#include <errno.h>\n");
72 printf ("#include <fcntl.h>\n");
73 printf ("#include \"ansidecl.h\"\n");
74 printf ("#include \"gdb/callback.h\"\n");
75 printf ("#include \"targ-vals.h\"\n");
78 printf ("/* syscall mapping table */\n");
79 printf ("CB_TARGET_DEFS_MAP cb_init_syscall_map[] = {\n");
80 for (t
= &sys_tdefs
[0]; t
->symbol
; ++t
)
82 printf ("#ifdef CB_%s\n", t
->symbol
);
83 /* Skip the "SYS_" prefix for the name. */
84 printf (" { \"%s\", CB_%s, TARGET_%s },\n", t
->symbol
+ 4, t
->symbol
, t
->symbol
);
87 printf (" { 0, -1, -1 }\n");
90 printf ("/* errno mapping table */\n");
91 printf ("CB_TARGET_DEFS_MAP cb_init_errno_map[] = {\n");
92 for (t
= &errno_tdefs
[0]; t
->symbol
; ++t
)
94 printf ("#ifdef %s\n", t
->symbol
);
95 printf (" { \"%s\", %s, TARGET_%s },\n", t
->symbol
, t
->symbol
, t
->symbol
);
98 printf (" { 0, 0, 0 }\n");
101 printf ("/* open flags mapping table */\n");
102 printf ("CB_TARGET_DEFS_MAP cb_init_open_map[] = {\n");
103 for (t
= &open_tdefs
[0]; t
->symbol
; ++t
)
105 printf ("#ifdef %s\n", t
->symbol
);
106 printf (" { \"%s\", %s, TARGET_%s },\n", t
->symbol
, t
->symbol
, t
->symbol
);
109 printf (" { 0, -1, -1 }\n");
114 main (int argc
, char *argv
[])
119 if (strcmp (argv
[1], "-h") == 0)
121 else if (strcmp (argv
[1], "-c") == 0)