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.4 2005/10/22 12:22:14 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> |
44 |
"#include \"machine.h\"\n" |
"#include \"machine.h\"\n" |
45 |
"#include \"memory.h\"\n" |
"#include \"memory.h\"\n" |
46 |
"#include \"misc.h\"\n" |
"#include \"misc.h\"\n" |
47 |
"#include \"arm_quick_pc_to_pointers.h\"\n" |
"#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"); |
54 |
|
printf("extern void arm_pc_to_pointers(struct cpu *);\n"); |
55 |
|
|
56 |
for (reg=0; reg<=1; reg++) |
for (reg=0; reg<=1; reg++) |
57 |
for (p=0; p<=1; p++) |
for (p=0; p<=1; p++) |
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 (l==0 && s==1 && h==0) |
/* l=0, s=1, h=0 means LDRD */ |
|
continue; |
|
185 |
/* l=0, s=1, h=1 means STRD */ |
/* 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_" |
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 (l==0 && s==1 && h==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 (l==0 && s==1 && h==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", |