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_ia64.c,v 1.3 2005/11/13 00:14:07 debug Exp $ |
* $Id: cpu_ia64.c,v 1.13 2006/07/16 13:32:26 debug Exp $ |
29 |
* |
* |
30 |
* IA64 CPU emulation. |
* IA64 CPU emulation. |
31 |
* |
* |
55 |
int ia64_cpu_new(struct cpu *cpu, struct memory *mem, |
int ia64_cpu_new(struct cpu *cpu, struct memory *mem, |
56 |
struct machine *machine, int cpu_id, char *cpu_type_name) |
struct machine *machine, int cpu_id, char *cpu_type_name) |
57 |
{ |
{ |
|
int i; |
|
|
|
|
58 |
if (strcasecmp(cpu_type_name, "IA64") != 0) |
if (strcasecmp(cpu_type_name, "IA64") != 0) |
59 |
return 0; |
return 0; |
60 |
|
|
61 |
|
cpu->run_instr = ia64_run_instr; |
62 |
cpu->memory_rw = ia64_memory_rw; |
cpu->memory_rw = ia64_memory_rw; |
63 |
cpu->update_translation_table = ia64_update_translation_table; |
cpu->update_translation_table = ia64_update_translation_table; |
64 |
cpu->invalidate_translation_caches = |
cpu->invalidate_translation_caches = |
71 |
debug("%s", cpu->name); |
debug("%s", cpu->name); |
72 |
} |
} |
73 |
|
|
|
/* Create the default virtual->physical->host translation: */ |
|
|
cpu->cd.ia64.vph_default_page = malloc(sizeof(struct ia64_vph_page)); |
|
|
if (cpu->cd.ia64.vph_default_page == NULL) { |
|
|
fprintf(stderr, "out of memory in ia64_cpu_new()\n"); |
|
|
exit(1); |
|
|
} |
|
|
memset(cpu->cd.ia64.vph_default_page, 0, sizeof(struct ia64_vph_page)); |
|
|
for (i=0; i<IA64_LEVEL0; i++) |
|
|
cpu->cd.ia64.vph_table0[i] = cpu->cd.ia64.vph_table0_kernel[i] |
|
|
= cpu->cd.ia64.vph_default_page; |
|
|
|
|
74 |
return 1; |
return 1; |
75 |
} |
} |
76 |
|
|
139 |
if (gprs) { |
if (gprs) { |
140 |
symbol = get_symbol_name(&cpu->machine->symbol_context, |
symbol = get_symbol_name(&cpu->machine->symbol_context, |
141 |
cpu->pc, &offset); |
cpu->pc, &offset); |
142 |
debug("cpu%i:\t pc = 0x%016llx", x, (long long)cpu->pc); |
debug("cpu%i:\t pc = 0x%016"PRIx64, x, (uint64_t)cpu->pc); |
143 |
debug(" <%s>\n", symbol != NULL? symbol : " no symbol "); |
debug(" <%s>\n", symbol != NULL? symbol : " no symbol "); |
144 |
|
|
145 |
/* TODO */ |
/* TODO */ |
148 |
|
|
149 |
|
|
150 |
/* |
/* |
151 |
|
* mips_cpu_tlbdump(): |
152 |
|
* |
153 |
|
* Called from the debugger to dump the TLB in a readable format. |
154 |
|
* x is the cpu number to dump, or -1 to dump all CPUs. |
155 |
|
* |
156 |
|
* If rawflag is nonzero, then the TLB contents isn't formated nicely, |
157 |
|
* just dumped. |
158 |
|
*/ |
159 |
|
void ia64_cpu_tlbdump(struct machine *m, int x, int rawflag) |
160 |
|
{ |
161 |
|
} |
162 |
|
|
163 |
|
|
164 |
|
/* |
165 |
|
* ia64_cpu_gdb_stub(): |
166 |
|
* |
167 |
|
* Execute a "remote GDB" command. Returns a newly allocated response string |
168 |
|
* on success, NULL on failure. |
169 |
|
*/ |
170 |
|
char *ia64_cpu_gdb_stub(struct cpu *cpu, char *cmd) |
171 |
|
{ |
172 |
|
fatal("ia64_cpu_gdb_stub(): TODO\n"); |
173 |
|
return NULL; |
174 |
|
} |
175 |
|
|
176 |
|
|
177 |
|
/* |
178 |
* ia64_cpu_interrupt(): |
* ia64_cpu_interrupt(): |
179 |
*/ |
*/ |
180 |
int ia64_cpu_interrupt(struct cpu *cpu, uint64_t irq_nr) |
int ia64_cpu_interrupt(struct cpu *cpu, uint64_t irq_nr) |
207 |
* cpu->pc for relative addresses. |
* cpu->pc for relative addresses. |
208 |
*/ |
*/ |
209 |
int ia64_cpu_disassemble_instr(struct cpu *cpu, unsigned char *ib, |
int ia64_cpu_disassemble_instr(struct cpu *cpu, unsigned char *ib, |
210 |
int running, uint64_t dumpaddr, int bintrans) |
int running, uint64_t dumpaddr) |
211 |
{ |
{ |
212 |
uint64_t offset; |
uint64_t offset; |
213 |
char *symbol; |
char *symbol; |
223 |
if (cpu->machine->ncpus > 1 && running) |
if (cpu->machine->ncpus > 1 && running) |
224 |
debug("cpu%i:\t", cpu->cpu_id); |
debug("cpu%i:\t", cpu->cpu_id); |
225 |
|
|
226 |
debug("%016llx: ", (long long)dumpaddr); |
debug("%016"PRIx64": ", (uint64_t) dumpaddr); |
227 |
|
|
228 |
debug("TODO\n"); |
debug("TODO\n"); |
229 |
|
|