/[dynamips]/trunk/ppc32.h
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/ppc32.h

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

upstream/dynamips-0.2.7-RC1/ppc32.h revision 7 by dpavlin, Sat Oct 6 16:23:47 2007 UTC upstream/dynamips-0.2.7-RC2/ppc32.h revision 8 by dpavlin, Sat Oct 6 16:24:54 2007 UTC
# Line 68  Line 68 
68  #define PPC32_EXC_TRACE     0x00000D00   /* Trace */  #define PPC32_EXC_TRACE     0x00000D00   /* Trace */
69  #define PPC32_EXC_FPU_HLP   0x00000E00   /* Floating-Point Assist */  #define PPC32_EXC_FPU_HLP   0x00000E00   /* Floating-Point Assist */
70    
71    /* Condition Register (CR) is accessed through 8 fields of 4 bits */
72    #define ppc32_get_cr_field(n)  ((n) >> 2)
73    #define ppc32_get_cr_bit(n)    (~(n) & 0x03)
74    
75    /* Positions of LT, GT, EQ and SO bits in CR fields */
76    #define PPC32_CR_LT_BIT  3
77    #define PPC32_CR_GT_BIT  2
78    #define PPC32_CR_EQ_BIT  1
79    #define PPC32_CR_SO_BIT  0
80    
81  /* CR0 (Condition Register Field 0) bits */  /* CR0 (Condition Register Field 0) bits */
82  #define PPC32_CR0_LT_BIT    31  #define PPC32_CR0_LT_BIT    31
83  #define PPC32_CR0_LT        (1 << PPC32_CR0_LT_BIT)   /* Negative */  #define PPC32_CR0_LT        (1 << PPC32_CR0_LT_BIT)   /* Negative */
# Line 281  struct cpu_ppc { Line 291  struct cpu_ppc {
291     volatile m_uint32_t irq_pending,irq_check;     volatile m_uint32_t irq_pending,irq_check;
292    
293     /* XER, Condition Register, Link Register, Count Register */     /* XER, Condition Register, Link Register, Count Register */
294     m_uint32_t xer,cr,lr,ctr,reserve;     m_uint32_t xer,lr,ctr,reserve;
295     m_uint32_t xer_ca;     m_uint32_t xer_ca;
296    
297       /* Condition Register (CR) fields */
298       u_int cr_fields[8];
299    
300     /* MTS caches (Instruction+Data) */     /* MTS caches (Instruction+Data) */
301     mts32_entry_t *mts_cache[2];     mts32_entry_t *mts_cache[2];
302    
303     /* Code page translation cache */     /* Code page translation cache and physical page mapping */
304     ppc32_jit_tcb_t **exec_phys_map;     ppc32_jit_tcb_t **exec_blk_map,**exec_phys_map;
305    
306     /* Virtual address to physical page translation */     /* Virtual address to physical page translation */
307     fastcall int (*translate)(cpu_ppc_t *cpu,m_uint32_t vaddr,u_int cid,     fastcall int (*translate)(cpu_ppc_t *cpu,m_uint32_t vaddr,u_int cid,
# Line 391  struct cpu_ppc { Line 404  struct cpu_ppc {
404     /* Fast memory operations use */     /* Fast memory operations use */
405     u_int fast_memop;     u_int fast_memop;
406    
407     /* IRQ idling preemption */     /* Direct block jump */
408     u_int irq_idle_preempt[32];     u_int exec_blk_direct_jump;
409    
410     /* Current exec page (non-JIT) info */     /* Current exec page (non-JIT) info */
411     m_uint64_t njm_exec_page;     m_uint64_t njm_exec_page;
# Line 409  struct cpu_ppc { Line 422  struct cpu_ppc {
422     u_int breakpoints_enabled;     u_int breakpoints_enabled;
423  };  };
424    
425    #define PPC32_CR_FIELD_OFFSET(f) \
426       (OFFSET(cpu_ppc_t,cr_fields)+((f) * sizeof(u_int)))
427    
428    /* Get the full CR register */
429    static forced_inline m_uint32_t ppc32_get_cr(cpu_ppc_t *cpu)
430    {
431       m_uint32_t cr = 0;
432       int i;
433    
434       for(i=0;i<8;i++)
435          cr |= cpu->cr_fields[i] << (28 - (i << 2));
436    
437       return(cr);
438    }
439    
440    /* Set the CR fields given a CR value */
441    static forced_inline void ppc32_set_cr(cpu_ppc_t *cpu,m_uint32_t cr)
442    {
443       int i;
444    
445       for(i=0;i<8;i++)
446          cpu->cr_fields[i] = (cr >> (28 - (i << 2))) & 0x0F;
447    }
448    
449    /* Get a CR bit */
450    static forced_inline m_uint32_t ppc32_read_cr_bit(cpu_ppc_t *cpu,u_int bit)
451    {
452       m_uint32_t res;
453    
454       res = cpu->cr_fields[ppc32_get_cr_field(bit)] >> ppc32_get_cr_bit(bit);
455       return(res & 0x01);
456    }
457    
458    /* Set a CR bit */
459    static forced_inline void ppc32_set_cr_bit(cpu_ppc_t *cpu,u_int bit)
460    {
461       cpu->cr_fields[ppc32_get_cr_field(bit)] |= 1 << ppc32_get_cr_bit(bit);
462    }
463    
464    /* Clear a CR bit */
465    static forced_inline void ppc32_clear_cr_bit(cpu_ppc_t *cpu,u_int bit)
466    {
467       cpu->cr_fields[ppc32_get_cr_field(bit)] &= ~(1 << ppc32_get_cr_bit(bit));
468    }
469    
470  /* Reset a PowerPC CPU */  /* Reset a PowerPC CPU */
471  int ppc32_reset(cpu_ppc_t *cpu);  int ppc32_reset(cpu_ppc_t *cpu);
472    

Legend:
Removed from v.7  
changed lines
  Added in v.8

  ViewVC Help
Powered by ViewVC 1.1.26