/[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 33 by dpavlin, Mon Oct 8 16:20:58 2007 UTC revision 34 by dpavlin, Mon Oct 8 16:21:17 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2005-2006  Anders Gavare.  All rights reserved.   *  Copyright (C) 2005-2007  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 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: cpu_arm.c,v 1.64 2006/09/09 09:04:32 debug Exp $   *  $Id: cpu_arm.c,v 1.67 2006/12/30 13:30:53 debug Exp $
29   *   *
30   *  ARM CPU emulation.   *  ARM CPU emulation.
31   *   *
# Line 42  Line 42 
42    
43  #include "arm_cpu_types.h"  #include "arm_cpu_types.h"
44  #include "cpu.h"  #include "cpu.h"
45    #include "interrupt.h"
46  #include "machine.h"  #include "machine.h"
47  #include "memory.h"  #include "memory.h"
48  #include "misc.h"  #include "misc.h"
# Line 68  static int arm_exception_to_mode[N_ARM_E Line 69  static int arm_exception_to_mode[N_ARM_E
69  void arm_pc_to_pointers(struct cpu *cpu);  void arm_pc_to_pointers(struct cpu *cpu);
70  #include "quick_pc_to_pointers.h"  #include "quick_pc_to_pointers.h"
71    
72    void arm_irq_interrupt_assert(struct interrupt *interrupt);
73    void arm_irq_interrupt_deassert(struct interrupt *interrupt);
74    
75    
76  /*  /*
77   *  arm_cpu_new():   *  arm_cpu_new():
# Line 169  int arm_cpu_new(struct cpu *cpu, struct Line 173  int arm_cpu_new(struct cpu *cpu, struct
173          for (i=0; i<N_ARM_REGS - 1; i++)          for (i=0; i<N_ARM_REGS - 1; i++)
174                  CPU_SETTINGS_ADD_REGISTER32(arm_regname[i], cpu->cd.arm.r[i]);                  CPU_SETTINGS_ADD_REGISTER32(arm_regname[i], cpu->cd.arm.r[i]);
175    
176            /*  Register the CPU's "IRQ" and "FIQ" interrupts:  */
177            {
178                    struct interrupt template;
179                    char name[50];
180                    snprintf(name, sizeof(name), "%s.irq", cpu->path);
181    
182                    memset(&template, 0, sizeof(template));
183                    template.line = 0;
184                    template.name = name;
185                    template.extra = cpu;
186                    template.interrupt_assert = arm_irq_interrupt_assert;
187                    template.interrupt_deassert = arm_irq_interrupt_deassert;
188                    interrupt_handler_register(&template);
189    
190                    /*  FIQ: TODO  */
191            }
192    
193    
194          return 1;          return 1;
195  }  }
196    
# Line 777  char *arm_cpu_gdb_stub(struct cpu *cpu, Line 799  char *arm_cpu_gdb_stub(struct cpu *cpu,
799    
800    
801  /*  /*
802   *  arm_cpu_interrupt():   *  arm_irq_interrupt_assert():
  *  
  *  0..31 are used as footbridge interrupt numbers, 32..47 = ISA,  
  *  64 is used as a "re-assert" signal to cpu->machine->md_interrupt().  
  *  
  *  TODO: don't hardcode to footbridge!  
803   */   */
804  int arm_cpu_interrupt(struct cpu *cpu, uint64_t irq_nr)  void arm_irq_interrupt_assert(struct interrupt *interrupt)
805  {  {
806          /*  fatal("arm_cpu_interrupt(): 0x%x\n", (int)irq_nr);  */          struct cpu *cpu = (struct cpu *) interrupt->extra;
807          if (irq_nr <= 64) {          cpu->cd.arm.irq_asserted = 1;
                 if (cpu->machine->md_interrupt != NULL)  
                         cpu->machine->md_interrupt(cpu->machine,  
                             cpu, irq_nr, 1);  
                 else  
                         fatal("arm_cpu_interrupt(): irq_nr=%i md_interrupt =="  
                             " NULL\n", (int)irq_nr);  
         } else {  
                 /*  Assert ARM IRQs:  */  
                 cpu->cd.arm.irq_asserted = 1;  
         }  
   
         return 1;  
808  }  }
809    
810    
811  /*  /*
812   *  arm_cpu_interrupt_ack():   *  arm_irq_interrupt_deassert():
813   */   */
814  int arm_cpu_interrupt_ack(struct cpu *cpu, uint64_t irq_nr)  void arm_irq_interrupt_deassert(struct interrupt *interrupt)
815  {  {
816          if (irq_nr <= 64) {          struct cpu *cpu = (struct cpu *) interrupt->extra;
817                  if (cpu->machine->md_interrupt != NULL)          cpu->cd.arm.irq_asserted = 0;
                         cpu->machine->md_interrupt(cpu->machine,  
                             cpu, irq_nr, 0);  
         } else {  
                 /*  De-assert ARM IRQs:  */  
                 cpu->cd.arm.irq_asserted = 0;  
         }  
   
         return 1;  
818  }  }
819    
820    

Legend:
Removed from v.33  
changed lines
  Added in v.34

  ViewVC Help
Powered by ViewVC 1.1.26