1 /* Generate targ-vals.h and targ-map.c. */
11 static struct tdefs sys_tdefs[] = {
13 #include "targ-vals.def"
18 static struct tdefs errno_tdefs[] = {
20 #include "targ-vals.def"
25 static struct tdefs open_tdefs[] = {
27 #include "targ-vals.def"
37 printf ("/* Target header values needed by the simulator and gdb. */\n");
38 printf ("/* This file is machine generated by gentmap.c. */\n\n");
40 printf ("#ifndef TARG_VALS_H\n");
41 printf ("#define TARG_VALS_H\n\n");
43 printf ("/* syscall values */\n");
44 for (t = &sys_tdefs[0]; t->symbol; ++t)
45 printf ("#define TARGET_%s %d\n", t->symbol, t->value);
48 printf ("/* errno values */\n");
49 for (t = &errno_tdefs[0]; t->symbol; ++t)
50 printf ("#define TARGET_%s %d\n", t->symbol, t->value);
53 printf ("/* open flag values */\n");
54 for (t = &open_tdefs[0]; t->symbol; ++t)
55 printf ("#define TARGET_%s 0x%x\n", t->symbol, t->value);
58 printf ("#endif /* TARG_VALS_H */\n");
66 printf ("/* Target value mapping utilities needed by the simulator and gdb. */\n");
67 printf ("/* This file is machine generated by gentmap.c. */\n\n");
69 printf ("#include \"config.h\"\n");
70 printf ("#include <errno.h>\n");
71 printf ("#include <fcntl.h>\n");
72 printf ("#include \"ansidecl.h\"\n");
73 printf ("#include \"gdb/callback.h\"\n");
74 printf ("#include \"targ-vals.h\"\n");
77 printf ("/* syscall mapping table */\n");
78 printf ("CB_TARGET_DEFS_MAP cb_init_syscall_map[] = {\n");
79 for (t = &sys_tdefs[0]; t->symbol; ++t)
81 printf ("#ifdef CB_%s\n", t->symbol);
82 printf (" { CB_%s, TARGET_%s },\n", t->symbol, t->symbol);
85 printf (" { -1, -1 }\n");
88 printf ("/* errno mapping table */\n");
89 printf ("CB_TARGET_DEFS_MAP cb_init_errno_map[] = {\n");
90 for (t = &errno_tdefs[0]; t->symbol; ++t)
92 printf ("#ifdef %s\n", t->symbol);
93 printf (" { %s, TARGET_%s },\n", t->symbol, t->symbol);
96 printf (" { 0, 0 }\n");
99 printf ("/* open flags mapping table */\n");
100 printf ("CB_TARGET_DEFS_MAP cb_init_open_map[] = {\n");
101 for (t = &open_tdefs[0]; t->symbol; ++t)
103 printf ("#ifdef %s\n", t->symbol);
104 printf (" { %s, TARGET_%s },\n", t->symbol, t->symbol);
107 printf (" { -1, -1 }\n");
119 if (strcmp (argv[1], "-h") == 0)
121 else if (strcmp (argv[1], "-c") == 0)