/[gxemul]/trunk/src/cpus/cpu_hppa.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/cpus/cpu_hppa.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 18 by dpavlin, Mon Oct 8 16:19:11 2007 UTC revision 26 by dpavlin, Mon Oct 8 16:20:10 2007 UTC
# Line 1  Line 1 
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:
# Line 15  Line 15 
15   *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND   *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16   *  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE   *  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17   *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE   *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18   *  ARE DISCLAIMED.  IN NO EVENT HPPAALL THE AUTHOR OR CONTRIBUTORS BE LIABLE     *  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE  
19   *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL   *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20   *  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS   *  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21   *  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)   *  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: cpu_hppa.c,v 1.2 2005/10/22 17:24:20 debug Exp $   *  $Id: cpu_hppa.c,v 1.14 2006/06/24 21:47:23 debug Exp $
29   *   *
30   *  HP PA-RISC CPU emulation.   *  HP PA-RISC CPU emulation.
31   *   *
# Line 83  int hppa_cpu_new(struct cpu *cpu, struct Line 83  int hppa_cpu_new(struct cpu *cpu, struct
83                      hppa_invalidate_code_translation;                      hppa_invalidate_code_translation;
84          }          }
85    
86          /*  Only hppaow name and caches etc for CPU nr 0 (in SMP machines):  */          /*  Only show name and caches etc for CPU nr 0 (in SMP machines):  */
87          if (cpu_id == 0) {          if (cpu_id == 0) {
88                  debug("%s", cpu->name);                  debug("%s", cpu->name);
89          }          }
# Line 125  void hppa_cpu_dumpinfo(struct cpu *cpu) Line 125  void hppa_cpu_dumpinfo(struct cpu *cpu)
125  void hppa_cpu_register_dump(struct cpu *cpu, int gprs, int coprocs)  void hppa_cpu_register_dump(struct cpu *cpu, int gprs, int coprocs)
126  {  {
127          char *symbol;          char *symbol;
128          uint64_t offset, tmp;          uint64_t offset;
129          int i, x = cpu->cpu_id, nregs = 32;          int i, x = cpu->cpu_id, nregs = 32;
130          int bits32 = cpu->cd.hppa.bits == 32;          int bits32 = cpu->cd.hppa.bits == 32;
131    
# Line 136  void hppa_cpu_register_dump(struct cpu * Line 136  void hppa_cpu_register_dump(struct cpu *
136    
137                  debug("cpu%i: pc  = 0x", x);                  debug("cpu%i: pc  = 0x", x);
138                  if (bits32)                  if (bits32)
139                          debug("%08x", (int)cpu->pc);                          debug("%08"PRIx32, (uint32_t) cpu->pc);
140                  else                  else
141                          debug("%016llx", (long long)cpu->pc);                          debug("%016"PRIx64, (uint64_t) cpu->pc);
142                  debug("  <%s>\n", symbol != NULL? symbol : " no symbol ");                  debug("  <%s>\n", symbol != NULL? symbol : " no symbol ");
143    
144                  if (bits32) {                  if (bits32) {
# Line 146  void hppa_cpu_register_dump(struct cpu * Line 146  void hppa_cpu_register_dump(struct cpu *
146                          for (i=0; i<nregs; i++) {                          for (i=0; i<nregs; i++) {
147                                  if ((i % 4) == 0)                                  if ((i % 4) == 0)
148                                          debug("cpu%i:", x);                                          debug("cpu%i:", x);
149                                  debug(" r%02i = 0x%08x ", i,                                  debug(" r%02i = 0x%08"PRIx32" ", i,
150                                      (int)cpu->cd.hppa.r[i]);                                      (uint32_t)cpu->cd.hppa.r[i]);
151                                  if ((i % 4) == 3)                                  if ((i % 4) == 3)
152                                          debug("\n");                                          debug("\n");
153                          }                          }
# Line 157  void hppa_cpu_register_dump(struct cpu * Line 157  void hppa_cpu_register_dump(struct cpu *
157                                  int r = (i >> 1) + ((i & 1) << 4);                                  int r = (i >> 1) + ((i & 1) << 4);
158                                  if ((i % 2) == 0)                                  if ((i % 2) == 0)
159                                          debug("cpu%i:", x);                                          debug("cpu%i:", x);
160                                  debug(" r%02i = 0x%016llx ", r,                                  debug(" r%02i = 0x%016"PRIx64" ", r,
161                                      (long long)cpu->cd.hppa.r[r]);                                      (uint64_t) cpu->cd.hppa.r[r]);
162                                  if ((i % 2) == 1)                                  if ((i % 2) == 1)
163                                          debug("\n");                                          debug("\n");
164                          }                          }
# Line 191  void hppa_cpu_register_match(struct mach Line 191  void hppa_cpu_register_match(struct mach
191    
192    
193  /*  /*
  *  hppa_cpu_show_full_statistics():  
  *  
  *  Show detailed statistics on opcode usage on each cpu.  
  */  
 void hppa_cpu_show_full_statistics(struct machine *m)  
 {  
         fatal("hppa_cpu_show_full_statistics(): TODO\n");  
 }  
   
   
 /*  
194   *  hppa_cpu_tlbdump():   *  hppa_cpu_tlbdump():
195   *   *
196   *  Called from the debugger to dump the TLB in a readable format.   *  Called from the debugger to dump the TLB in a readable format.
# Line 212  void hppa_cpu_show_full_statistics(struc Line 201  void hppa_cpu_show_full_statistics(struc
201   */   */
202  void hppa_cpu_tlbdump(struct machine *m, int x, int rawflag)  void hppa_cpu_tlbdump(struct machine *m, int x, int rawflag)
203  {  {
204          fatal("hppa_cpu_tlbdump(): TODO\n");  }
205    
206    
207    /*
208     *  hppa_cpu_gdb_stub():
209     *
210     *  Execute a "remote GDB" command. Returns a newly allocated response string
211     *  on success, NULL on failure.
212     */
213    char *hppa_cpu_gdb_stub(struct cpu *cpu, char *cmd)
214    {
215            fatal("hppa_cpu_gdb_stub(): TODO\n");
216            return NULL;
217  }  }
218    
219    
# Line 242  int hppa_cpu_interrupt_ack(struct cpu *c Line 243  int hppa_cpu_interrupt_ack(struct cpu *c
243   *  Convert an instruction word into human readable format, for instruction   *  Convert an instruction word into human readable format, for instruction
244   *  tracing.   *  tracing.
245   *   *
246   *  If running is 1, cpu->pc hppaould be the address of the instruction.   *  If running is 1, cpu->pc should be the address of the instruction.
247   *   *
248   *  If running is 0, things that depend on the runtime environment (eg.   *  If running is 0, things that depend on the runtime environment (eg.
249   *  register contents) will not be hppaown, and addr will be used instead of   *  register contents) will not be shown, and addr will be used instead of
250   *  cpu->pc for relative addresses.   *  cpu->pc for relative addresses.
251   */   */
252  int hppa_cpu_disassemble_instr(struct cpu *cpu, unsigned char *instr,  int hppa_cpu_disassemble_instr(struct cpu *cpu, unsigned char *instr,
253          int running, uint64_t dumpaddr, int bintrans)          int running, uint64_t dumpaddr)
254  {  {
255          uint64_t offset, addr;          uint64_t offset;
256          uint32_t iword;          uint32_t iword;
257          int hi6;          char *symbol;
         char *symbol, *mnem = "ERROR";  
258    
259          if (running)          if (running)
260                  dumpaddr = cpu->pc;                  dumpaddr = cpu->pc;
# Line 268  int hppa_cpu_disassemble_instr(struct cp Line 268  int hppa_cpu_disassemble_instr(struct cp
268                  debug("cpu%i: ", cpu->cpu_id);                  debug("cpu%i: ", cpu->cpu_id);
269    
270          if (cpu->cd.hppa.bits == 32)          if (cpu->cd.hppa.bits == 32)
271                  debug("%08x", (int)dumpaddr);                  debug("%08"PRIx32, (uint32_t) dumpaddr);
272          else          else
273                  debug("%016llx", (long long)dumpaddr);                  debug("%016"PRIx64, (uint64_t) dumpaddr);
274    
275          if (cpu->byte_order == EMUL_BIG_ENDIAN)          if (cpu->byte_order == EMUL_BIG_ENDIAN)
276                  iword = (instr[0] << 24) + (instr[1] << 16) + (instr[2] << 8)                  iword = (instr[0] << 24) + (instr[1] << 16) + (instr[2] << 8)
# Line 279  int hppa_cpu_disassemble_instr(struct cp Line 279  int hppa_cpu_disassemble_instr(struct cp
279                  iword = (instr[3] << 24) + (instr[2] << 16) + (instr[1] << 8)                  iword = (instr[3] << 24) + (instr[2] << 16) + (instr[1] << 8)
280                      + instr[0];                      + instr[0];
281    
282          debug(": %08x\t", iword);          debug(": %08"PRIx32"\t", (uint32_t) iword);
283    
284          /*          /*
285           *  Decode the instruction:           *  Decode the instruction:

Legend:
Removed from v.18  
changed lines
  Added in v.26

  ViewVC Help
Powered by ViewVC 1.1.26