1 |
/* |
/* |
2 |
* Copyright (C) 2005-2006 Anders Gavare. All rights reserved. |
* Copyright (C) 2005-2007 Anders Gavare. All rights reserved. |
3 |
* |
* |
4 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
5 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: generate_head.c,v 1.15 2006/04/19 18:55:57 debug Exp $ |
* $Id: generate_head.c,v 1.26 2007/04/10 17:26:20 debug Exp $ |
29 |
*/ |
*/ |
30 |
|
|
31 |
#include <stdio.h> |
#include <stdio.h> |
71 |
|
|
72 |
printf("\n/* AUTOMATICALLY GENERATED! Do not edit. */\n\n"); |
printf("\n/* AUTOMATICALLY GENERATED! Do not edit. */\n\n"); |
73 |
|
|
74 |
|
printf("#include <assert.h>\n"); |
75 |
|
printf("#include \"debugger.h\"\n"); |
76 |
|
|
77 |
printf("#define DYNTRANS_MAX_VPH_TLB_ENTRIES " |
printf("#define DYNTRANS_MAX_VPH_TLB_ENTRIES " |
78 |
"%s_MAX_VPH_TLB_ENTRIES\n", uppercase(a)); |
"%s_MAX_VPH_TLB_ENTRIES\n", uppercase(a)); |
79 |
printf("#define DYNTRANS_ARCH %s\n", a); |
printf("#define DYNTRANS_ARCH %s\n", a); |
131 |
"#define instr32(n) %s32_instr_ ## n\n\n", a); |
"#define instr32(n) %s32_instr_ ## n\n\n", a); |
132 |
printf("#endif\n\n"); |
printf("#endif\n\n"); |
133 |
|
|
|
printf("/* This is for marking a physical page as containing" |
|
|
"\n combined instructions: */\n"); |
|
|
printf("#define combined (cpu->cd.%s.cur_physpage->flags " |
|
|
"|= COMBINATIONS)\n", a); |
|
|
|
|
134 |
printf("\n#define X(n) void %s_instr_ ## n(struct cpu *cpu, \\\n" |
printf("\n#define X(n) void %s_instr_ ## n(struct cpu *cpu, \\\n" |
135 |
" struct %s_instr_call *ic)\n", a, a); |
" struct %s_instr_call *ic)\n", a, a); |
136 |
|
|
137 |
printf("\n/*\n * nothing: Do nothing.\n *\n" |
printf("\n/*\n * nothing: Do nothing.\n *\n" |
138 |
" * The difference between this function and a \"nop\" " |
" * The difference between this function and a \"nop\" " |
139 |
"instruction is that\n * this function does not increase " |
"instruction is that\n * this function does not increase " |
140 |
"the program counter or the number of\n * translated " |
"the program counter. It is used to \"get out\" of running in " |
141 |
"instructions. It is used to \"get out\" of running in " |
"translated\n * mode.\n */\n"); |
|
"translated\n * mode.\n *\n" |
|
|
" * IMPORTANT NOTE: Do a cpu->running_translated = 0;\n" |
|
|
" * before setting cpu->cd.%s.next_ic = " |
|
|
"¬hing_call;\n */\n", a); |
|
142 |
printf("X(nothing)\n{\n"); |
printf("X(nothing)\n{\n"); |
|
printf("\tcpu->n_translated_instrs --;\n"); |
|
143 |
printf("\tcpu->cd.%s.next_ic --;\n", a); |
printf("\tcpu->cd.%s.next_ic --;\n", a); |
144 |
printf("}\n\n"); |
printf("}\n\n"); |
145 |
|
|
146 |
printf("#ifdef DYNTRANS_VARIABLE_INSTRUCTION_LENGTH\n"); |
/* Ugly special hacks for SH[34]: */ |
147 |
printf("static struct %s_instr_call nothing_call = { " |
if (strcasecmp(argv[1], "sh") == 0) { |
148 |
"instr(nothing), {0,0,0} };\n", a); |
printf("static struct %s_instr_call nothing_call = { " |
149 |
printf("#else\n"); |
"instr(nothing), {0,0} };\n", a); |
150 |
printf("static struct %s_instr_call nothing_call = { " |
} else { |
151 |
"instr(nothing), {0,0,0} };\n", a); |
printf("static struct %s_instr_call nothing_call = { " |
152 |
printf("#endif\n"); |
"instr(nothing), {0,0,0} };\n", a); |
153 |
|
} |
154 |
|
|
155 |
printf("\n"); |
printf("\n"); |
156 |
|
|