1 /* Generate targ-vals.h and targ-map.c. */
10 static struct tdefs sys_tdefs
[] = {
12 #include "targ-vals.def"
17 static struct tdefs errno_tdefs
[] = {
19 #include "targ-vals.def"
24 static struct tdefs open_tdefs
[] = {
26 #include "targ-vals.def"
36 printf ("/* Target header values needed by the simulator and gdb. */\n");
37 printf ("/* This file is machine generated by gentmap.c. */\n\n");
39 printf ("#ifndef TARG_VALS_H\n");
40 printf ("#define TARG_VALS_H\n\n");
42 printf ("/* syscall values */\n");
43 for (t
= &sys_tdefs
[0]; t
->symbol
; ++t
)
44 printf ("#define TARGET_%s %d\n", t
->symbol
, t
->value
);
47 printf ("/* errno values */\n");
48 for (t
= &errno_tdefs
[0]; t
->symbol
; ++t
)
49 printf ("#define TARGET_%s %d\n", t
->symbol
, t
->value
);
52 printf ("/* open flag values */\n");
53 for (t
= &open_tdefs
[0]; t
->symbol
; ++t
)
54 printf ("#define TARGET_%s 0x%x\n", t
->symbol
, t
->value
);
57 printf ("#endif /* TARG_VALS_H */\n");
65 printf ("/* Target value mapping utilities needed by the simulator and gdb. */\n");
66 printf ("/* This file is machine generated by gentmap.c. */\n\n");
68 printf ("#include <errno.h>\n");
69 printf ("#include <fcntl.h>\n");
70 printf ("#include \"ansidecl.h\"\n");
71 printf ("#include \"gdb/callback.h\"\n");
72 printf ("#include \"targ-vals.h\"\n");
75 printf ("/* syscall mapping table */\n");
76 printf ("CB_TARGET_DEFS_MAP cb_init_syscall_map[] = {\n");
77 for (t
= &sys_tdefs
[0]; t
->symbol
; ++t
)
79 printf ("#ifdef CB_%s\n", t
->symbol
);
80 printf (" { CB_%s, TARGET_%s },\n", t
->symbol
, t
->symbol
);
83 printf (" { -1, -1 }\n");
86 printf ("/* errno mapping table */\n");
87 printf ("CB_TARGET_DEFS_MAP cb_init_errno_map[] = {\n");
88 for (t
= &errno_tdefs
[0]; t
->symbol
; ++t
)
90 printf ("#ifdef %s\n", t
->symbol
);
91 printf (" { %s, TARGET_%s },\n", t
->symbol
, t
->symbol
);
94 printf (" { 0, 0 }\n");
97 printf ("/* open flags mapping table */\n");
98 printf ("CB_TARGET_DEFS_MAP cb_init_open_map[] = {\n");
99 for (t
= &open_tdefs
[0]; t
->symbol
; ++t
)
101 printf ("#ifdef %s\n", t
->symbol
);
102 printf (" { %s, TARGET_%s },\n", t
->symbol
, t
->symbol
);
105 printf (" { -1, -1 }\n");
117 if (strcmp (argv
[1], "-h") == 0)
119 else if (strcmp (argv
[1], "-c") == 0)