1 |
/* |
/* |
2 |
* Copyright (C) 2005 Anders Gavare. All rights reserved. |
* Copyright (C) 2005-2006 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_arm_loadstore.c,v 1.1 2005/08/29 14:36:41 debug Exp $ |
* $Id: generate_arm_loadstore.c,v 1.6 2006/02/16 19:49:04 debug Exp $ |
29 |
*/ |
*/ |
30 |
|
|
31 |
#include <stdio.h> |
#include <stdio.h> |
41 |
printf("\n/* AUTOMATICALLY GENERATED! Do not edit. */\n\n"); |
printf("\n/* AUTOMATICALLY GENERATED! Do not edit. */\n\n"); |
42 |
printf("#include <stdio.h>\n#include <stdlib.h>\n" |
printf("#include <stdio.h>\n#include <stdlib.h>\n" |
43 |
"#include \"cpu.h\"\n" |
"#include \"cpu.h\"\n" |
44 |
|
"#include \"machine.h\"\n" |
45 |
"#include \"memory.h\"\n" |
"#include \"memory.h\"\n" |
46 |
"#include \"misc.h\"\n" |
"#include \"misc.h\"\n" |
47 |
|
"#define DYNTRANS_PC_TO_POINTERS arm_pc_to_pointers\n" |
48 |
|
"#include \"quick_pc_to_pointers.h\"\n" |
49 |
"#define reg(x) (*((uint32_t *)(x)))\n"); |
"#define reg(x) (*((uint32_t *)(x)))\n"); |
50 |
printf("extern void arm_instr_nop(struct cpu *, " |
printf("extern void arm_instr_nop(struct cpu *, " |
51 |
"struct arm_instr_call *);\n"); |
"struct arm_instr_call *);\n"); |
52 |
printf("extern void arm_instr_invalid(struct cpu *, " |
printf("extern void arm_instr_invalid(struct cpu *, " |
53 |
"struct arm_instr_call *);\n"); |
"struct arm_instr_call *);\n"); |
|
printf("extern uint32_t R(struct cpu *, struct arm_instr_call *," |
|
|
" uint32_t, int);\n"); |
|
54 |
printf("extern void arm_pc_to_pointers(struct cpu *);\n"); |
printf("extern void arm_pc_to_pointers(struct cpu *);\n"); |
55 |
|
|
56 |
for (reg=0; reg<=1; reg++) |
for (reg=0; reg<=1; reg++) |
181 |
for (l=0; l<=1; l++) { |
for (l=0; l<=1; l++) { |
182 |
if (s==0 && h==0) |
if (s==0 && h==0) |
183 |
continue; |
continue; |
184 |
if (s==1 && l==0) |
/* l=0, s=1, h=0 means LDRD */ |
185 |
continue; |
/* l=0, s=1, h=1 means STRD */ |
186 |
|
|
187 |
printf("#define A__NAME__general arm_instr_%s_" |
printf("#define A__NAME__general arm_instr_%s_" |
188 |
"%s_%s_%s_%s_%s_%s__general\n", |
"%s_%s_%s_%s_%s_%s__general\n", |
258 |
printf("\tarm_instr_nop"); |
printf("\tarm_instr_nop"); |
259 |
else if (s==0 && h==0) |
else if (s==0 && h==0) |
260 |
printf("\tarm_instr_invalid"); |
printf("\tarm_instr_invalid"); |
|
else if (s==1 && l==0) |
|
|
printf("\tarm_instr_invalid"); |
|
261 |
else |
else |
262 |
printf("\tarm_instr_%s_%s_%s_%s_%s_%s_%s%s%s", |
printf("\tarm_instr_%s_%s_%s_%s_%s_%s_%s%s%s", |
263 |
l? "load" : "store", |
l? "load" : "store", |
291 |
printf("\tarm_instr_nop"); |
printf("\tarm_instr_nop"); |
292 |
else if (s==0 && h==0) |
else if (s==0 && h==0) |
293 |
printf("\tarm_instr_invalid"); |
printf("\tarm_instr_invalid"); |
|
else if (s==1 && l==0) |
|
|
printf("\tarm_instr_invalid"); |
|
294 |
else |
else |
295 |
printf("\tarm_instr_%s_%s_%s_%s_%s_%s_" |
printf("\tarm_instr_%s_%s_%s_%s_%s_%s_" |
296 |
"%s_pc%s%s", l? "load" : "store", |
"%s_pc%s%s", l? "load" : "store", |