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.12 2006/06/24 21:47:23 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 |
|
|
70 |
debug("%s", cpu->name); |
debug("%s", cpu->name); |
71 |
} |
} |
72 |
|
|
|
/* 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; |
|
|
|
|
73 |
return 1; |
return 1; |
74 |
} |
} |
75 |
|
|
138 |
if (gprs) { |
if (gprs) { |
139 |
symbol = get_symbol_name(&cpu->machine->symbol_context, |
symbol = get_symbol_name(&cpu->machine->symbol_context, |
140 |
cpu->pc, &offset); |
cpu->pc, &offset); |
141 |
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); |
142 |
debug(" <%s>\n", symbol != NULL? symbol : " no symbol "); |
debug(" <%s>\n", symbol != NULL? symbol : " no symbol "); |
143 |
|
|
144 |
/* TODO */ |
/* TODO */ |
147 |
|
|
148 |
|
|
149 |
/* |
/* |
150 |
|
* mips_cpu_tlbdump(): |
151 |
|
* |
152 |
|
* Called from the debugger to dump the TLB in a readable format. |
153 |
|
* x is the cpu number to dump, or -1 to dump all CPUs. |
154 |
|
* |
155 |
|
* If rawflag is nonzero, then the TLB contents isn't formated nicely, |
156 |
|
* just dumped. |
157 |
|
*/ |
158 |
|
void ia64_cpu_tlbdump(struct machine *m, int x, int rawflag) |
159 |
|
{ |
160 |
|
} |
161 |
|
|
162 |
|
|
163 |
|
/* |
164 |
|
* ia64_cpu_gdb_stub(): |
165 |
|
* |
166 |
|
* Execute a "remote GDB" command. Returns a newly allocated response string |
167 |
|
* on success, NULL on failure. |
168 |
|
*/ |
169 |
|
char *ia64_cpu_gdb_stub(struct cpu *cpu, char *cmd) |
170 |
|
{ |
171 |
|
fatal("ia64_cpu_gdb_stub(): TODO\n"); |
172 |
|
return NULL; |
173 |
|
} |
174 |
|
|
175 |
|
|
176 |
|
/* |
177 |
* ia64_cpu_interrupt(): |
* ia64_cpu_interrupt(): |
178 |
*/ |
*/ |
179 |
int ia64_cpu_interrupt(struct cpu *cpu, uint64_t irq_nr) |
int ia64_cpu_interrupt(struct cpu *cpu, uint64_t irq_nr) |
206 |
* cpu->pc for relative addresses. |
* cpu->pc for relative addresses. |
207 |
*/ |
*/ |
208 |
int ia64_cpu_disassemble_instr(struct cpu *cpu, unsigned char *ib, |
int ia64_cpu_disassemble_instr(struct cpu *cpu, unsigned char *ib, |
209 |
int running, uint64_t dumpaddr, int bintrans) |
int running, uint64_t dumpaddr) |
210 |
{ |
{ |
211 |
uint64_t offset; |
uint64_t offset; |
212 |
char *symbol; |
char *symbol; |
222 |
if (cpu->machine->ncpus > 1 && running) |
if (cpu->machine->ncpus > 1 && running) |
223 |
debug("cpu%i:\t", cpu->cpu_id); |
debug("cpu%i:\t", cpu->cpu_id); |
224 |
|
|
225 |
debug("%016llx: ", (long long)dumpaddr); |
debug("%016"PRIx64": ", (uint64_t) dumpaddr); |
226 |
|
|
227 |
debug("TODO\n"); |
debug("TODO\n"); |
228 |
|
|