/[gxemul]/trunk/src/cpus/cpu_arm.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_arm.c

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

revision 37 by dpavlin, Mon Oct 8 16:21:17 2007 UTC revision 38 by dpavlin, Mon Oct 8 16:21:53 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: cpu_arm.c,v 1.67 2006/12/30 13:30:53 debug Exp $   *  $Id: cpu_arm.c,v 1.68 2007/03/26 02:01:35 debug Exp $
29   *   *
30   *  ARM CPU emulation.   *  ARM CPU emulation.
31   *   *
# Line 726  void arm_cpu_tlbdump(struct machine *m, Line 726  void arm_cpu_tlbdump(struct machine *m,
726  }  }
727    
728    
 static void add_response_word(struct cpu *cpu, char *r, uint32_t value,  
         size_t maxlen)  
 {  
         if (cpu->byte_order == EMUL_LITTLE_ENDIAN) {  
                 value = ((value & 0xff) << 24) +  
                         ((value & 0xff00) << 8) +  
                         ((value & 0xff0000) >> 8) +  
                         ((value & 0xff000000) >> 24);  
         }  
         snprintf(r + strlen(r), maxlen - strlen(r), "%08"PRIx32, value);  
 }  
   
   
 /*  
  *  arm_cpu_gdb_stub():  
  *  
  *  Execute a "remote GDB" command. Returns a newly allocated response string  
  *  on success, NULL on failure.  
  */  
 char *arm_cpu_gdb_stub(struct cpu *cpu, char *cmd)  
 {  
         if (strcmp(cmd, "g") == 0) {  
                 /*  15 gprs, pc, 8 fprs, fps, cpsr.  */  
                 int i;  
                 char *r;  
                 size_t len = 1 + 18 * sizeof(uint32_t);  
                 r = malloc(len);  
                 if (r == NULL) {  
                         fprintf(stderr, "out of memory\n");  
                         exit(1);  
                 }  
                 r[0] = '\0';  
                 for (i=0; i<15; i++)  
                         add_response_word(cpu, r, cpu->cd.arm.r[i], len);  
                 add_response_word(cpu, r, cpu->pc, len);  
                 /*  TODO: fprs:  */  
                 for (i=0; i<8; i++)  
                         add_response_word(cpu, r, 0, len);  
                 /*  TODO: fps  */  
                 add_response_word(cpu, r, 0, len);  
                 add_response_word(cpu, r, cpu->cd.arm.cpsr, len);  
                 return r;  
         }  
   
         if (cmd[0] == 'p') {  
                 int regnr = strtol(cmd + 1, NULL, 16);  
                 size_t len = 2 * sizeof(uint32_t) + 1;  
                 char *r = malloc(len);  
                 r[0] = '\0';  
                 if (regnr == ARM_PC) {  
                         add_response_word(cpu, r, cpu->pc, len);  
                 } else if (regnr >= 0 && regnr < ARM_PC) {  
                         add_response_word(cpu, r, cpu->cd.arm.r[regnr], len);  
                 } else if (regnr >= 0x10 && regnr <= 0x17) {  
                         /*  TODO: fprs  */  
                         add_response_word(cpu, r, 0, len);  
                         add_response_word(cpu, r, 0, len);  
                         add_response_word(cpu, r, 0, len);  
                 } else if (regnr == 0x18) {  
                         /*  TODO: fps  */  
                         add_response_word(cpu, r, 0, len);  
                 } else if (regnr == 0x19) {  
                         add_response_word(cpu, r, cpu->cd.arm.cpsr, len);  
                 }  
                 return r;  
         }  
   
         fatal("arm_cpu_gdb_stub(): TODO\n");  
         return NULL;  
 }  
   
   
729  /*  /*
730   *  arm_irq_interrupt_assert():   *  arm_irq_interrupt_assert():
731     *  arm_irq_interrupt_deassert():
732   */   */
733  void arm_irq_interrupt_assert(struct interrupt *interrupt)  void arm_irq_interrupt_assert(struct interrupt *interrupt)
734  {  {
735          struct cpu *cpu = (struct cpu *) interrupt->extra;          struct cpu *cpu = (struct cpu *) interrupt->extra;
736          cpu->cd.arm.irq_asserted = 1;          cpu->cd.arm.irq_asserted = 1;
737  }  }
   
   
 /*  
  *  arm_irq_interrupt_deassert():  
  */  
738  void arm_irq_interrupt_deassert(struct interrupt *interrupt)  void arm_irq_interrupt_deassert(struct interrupt *interrupt)
739  {  {
740          struct cpu *cpu = (struct cpu *) interrupt->extra;          struct cpu *cpu = (struct cpu *) interrupt->extra;

Legend:
Removed from v.37  
changed lines
  Added in v.38

  ViewVC Help
Powered by ViewVC 1.1.26