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: cpu_hppa.c,v 1.6 2005/11/17 21:26:06 debug Exp $ |
* $Id: cpu_hppa.c,v 1.13 2006/06/16 18:31:25 debug Exp $ |
29 |
* |
* |
30 |
* HP PA-RISC CPU emulation. |
* HP PA-RISC CPU emulation. |
31 |
* |
* |
88 |
debug("%s", cpu->name); |
debug("%s", cpu->name); |
89 |
} |
} |
90 |
|
|
91 |
|
hppa_init_64bit_dummy_tables(cpu); |
92 |
|
|
93 |
return 1; |
return 1; |
94 |
} |
} |
95 |
|
|
138 |
|
|
139 |
debug("cpu%i: pc = 0x", x); |
debug("cpu%i: pc = 0x", x); |
140 |
if (bits32) |
if (bits32) |
141 |
debug("%08x", (int)cpu->pc); |
debug("%08"PRIx32, (uint32_t) cpu->pc); |
142 |
else |
else |
143 |
debug("%016llx", (long long)cpu->pc); |
debug("%016"PRIx64, (uint64_t) cpu->pc); |
144 |
debug(" <%s>\n", symbol != NULL? symbol : " no symbol "); |
debug(" <%s>\n", symbol != NULL? symbol : " no symbol "); |
145 |
|
|
146 |
if (bits32) { |
if (bits32) { |
148 |
for (i=0; i<nregs; i++) { |
for (i=0; i<nregs; i++) { |
149 |
if ((i % 4) == 0) |
if ((i % 4) == 0) |
150 |
debug("cpu%i:", x); |
debug("cpu%i:", x); |
151 |
debug(" r%02i = 0x%08x ", i, |
debug(" r%02i = 0x%08"PRIx32" ", i, |
152 |
(int)cpu->cd.hppa.r[i]); |
(uint32_t)cpu->cd.hppa.r[i]); |
153 |
if ((i % 4) == 3) |
if ((i % 4) == 3) |
154 |
debug("\n"); |
debug("\n"); |
155 |
} |
} |
159 |
int r = (i >> 1) + ((i & 1) << 4); |
int r = (i >> 1) + ((i & 1) << 4); |
160 |
if ((i % 2) == 0) |
if ((i % 2) == 0) |
161 |
debug("cpu%i:", x); |
debug("cpu%i:", x); |
162 |
debug(" r%02i = 0x%016llx ", r, |
debug(" r%02i = 0x%016"PRIx64" ", r, |
163 |
(long long)cpu->cd.hppa.r[r]); |
(uint64_t) cpu->cd.hppa.r[r]); |
164 |
if ((i % 2) == 1) |
if ((i % 2) == 1) |
165 |
debug("\n"); |
debug("\n"); |
166 |
} |
} |
193 |
|
|
194 |
|
|
195 |
/* |
/* |
196 |
|
* hppa_cpu_tlbdump(): |
197 |
|
* |
198 |
|
* Called from the debugger to dump the TLB in a readable format. |
199 |
|
* x is the cpu number to dump, or -1 to dump all CPUs. |
200 |
|
* |
201 |
|
* If rawflag is nonzero, then the TLB contents isn't formated nicely, |
202 |
|
* just dumped. |
203 |
|
*/ |
204 |
|
void hppa_cpu_tlbdump(struct machine *m, int x, int rawflag) |
205 |
|
{ |
206 |
|
} |
207 |
|
|
208 |
|
|
209 |
|
/* |
210 |
|
* hppa_cpu_gdb_stub(): |
211 |
|
* |
212 |
|
* Execute a "remote GDB" command. Returns a newly allocated response string |
213 |
|
* on success, NULL on failure. |
214 |
|
*/ |
215 |
|
char *hppa_cpu_gdb_stub(struct cpu *cpu, char *cmd) |
216 |
|
{ |
217 |
|
fatal("hppa_cpu_gdb_stub(): TODO\n"); |
218 |
|
return NULL; |
219 |
|
} |
220 |
|
|
221 |
|
|
222 |
|
/* |
223 |
* hppa_cpu_interrupt(): |
* hppa_cpu_interrupt(): |
224 |
*/ |
*/ |
225 |
int hppa_cpu_interrupt(struct cpu *cpu, uint64_t irq_nr) |
int hppa_cpu_interrupt(struct cpu *cpu, uint64_t irq_nr) |
252 |
* cpu->pc for relative addresses. |
* cpu->pc for relative addresses. |
253 |
*/ |
*/ |
254 |
int hppa_cpu_disassemble_instr(struct cpu *cpu, unsigned char *instr, |
int hppa_cpu_disassemble_instr(struct cpu *cpu, unsigned char *instr, |
255 |
int running, uint64_t dumpaddr, int bintrans) |
int running, uint64_t dumpaddr) |
256 |
{ |
{ |
257 |
uint64_t offset; |
uint64_t offset; |
258 |
uint32_t iword; |
uint32_t iword; |
270 |
debug("cpu%i: ", cpu->cpu_id); |
debug("cpu%i: ", cpu->cpu_id); |
271 |
|
|
272 |
if (cpu->cd.hppa.bits == 32) |
if (cpu->cd.hppa.bits == 32) |
273 |
debug("%08x", (int)dumpaddr); |
debug("%08"PRIx32, (uint32_t) dumpaddr); |
274 |
else |
else |
275 |
debug("%016llx", (long long)dumpaddr); |
debug("%016"PRIx64, (uint64_t) dumpaddr); |
276 |
|
|
277 |
if (cpu->byte_order == EMUL_BIG_ENDIAN) |
if (cpu->byte_order == EMUL_BIG_ENDIAN) |
278 |
iword = (instr[0] << 24) + (instr[1] << 16) + (instr[2] << 8) |
iword = (instr[0] << 24) + (instr[1] << 16) + (instr[2] << 8) |
281 |
iword = (instr[3] << 24) + (instr[2] << 16) + (instr[1] << 8) |
iword = (instr[3] << 24) + (instr[2] << 16) + (instr[1] << 8) |
282 |
+ instr[0]; |
+ instr[0]; |
283 |
|
|
284 |
debug(": %08x\t", iword); |
debug(": %08"PRIx32"\t", (uint32_t) iword); |
285 |
|
|
286 |
/* |
/* |
287 |
* Decode the instruction: |
* Decode the instruction: |