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

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

upstream/dynamips-0.2.6-RC5/utils.h revision 6 by dpavlin, Sat Oct 6 16:09:07 2007 UTC upstream/dynamips-0.2.7-RC1/utils.h revision 7 by dpavlin, Sat Oct 6 16:23:47 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   * Cisco 7200 (Predator) simulation platform.   * Cisco router simulation platform.
3   * Copyright (c) 2005,2006 Christophe Fillot (cf@utc.fr)   * Copyright (c) 2005,2006 Christophe Fillot (cf@utc.fr)
4   */   */
5    
# Line 100  typedef m_uint64_t m_tmcnt_t; Line 100  typedef m_uint64_t m_tmcnt_t;
100    
101  /* Forward declarations */  /* Forward declarations */
102  typedef struct vm_instance vm_instance_t;  typedef struct vm_instance vm_instance_t;
103  typedef struct insn_block insn_block_t;  typedef struct mips64_jit_tcb mips64_jit_tcb_t;
104    typedef struct ppc32_jit_tcb ppc32_jit_tcb_t;
105    
106    /* Translated block function pointer */
107    typedef void (*insn_tblock_fptr)(void);
108    
109    /* Host executable page */
110  typedef struct insn_exec_page insn_exec_page_t;  typedef struct insn_exec_page insn_exec_page_t;
111    struct insn_exec_page {
112       u_char *ptr;
113       insn_exec_page_t *next;
114    };
115    
116  /* MIPS instruction */  /* MIPS instruction */
117  typedef m_uint32_t mips_insn_t;  typedef m_uint32_t mips_insn_t;
118    
119    /* PowerPC instruction */
120    typedef m_uint32_t ppc_insn_t;
121    
122  /* Max and min macro */  /* Max and min macro */
123  #define m_max(a,b) (((a) > (b)) ? (a) : (b))  #define m_max(a,b) (((a) > (b)) ? (a) : (b))
124  #define m_min(a,b) (((a) < (b)) ? (a) : (b))  #define m_min(a,b) (((a) < (b)) ? (a) : (b))
# Line 140  typedef struct { Line 153  typedef struct {
153     m_uint32_t tlb_index;     m_uint32_t tlb_index;
154  }mts_map_t;  }mts_map_t;
155    
156    /* Invalid VTLB entry */
157    #define MTS_INV_ENTRY_MASK  0x00000001
158    
159    /* MTS entry flags */
160    #define MTS_FLAG_DEV  0x000000001   /* Virtual device used */
161    #define MTS_FLAG_COW  0x000000002   /* Copy-On-Write */
162    
163    /* Virtual TLB entry (32-bit MMU) */
164    typedef struct mts32_entry mts32_entry_t;
165    struct mts32_entry {
166       m_uint32_t gvpa;   /* Guest Virtual Page Address */
167       m_uint32_t gppa;   /* Guest Physical Page Address */
168       m_iptr_t   hpa;    /* Host Page Address */
169       m_uint32_t flags;  /* Flags */
170    }__attribute__ ((aligned(16)));
171    
172    /* Virtual TLB entry (64-bit MMU) */
173    typedef struct mts64_entry mts64_entry_t;
174    struct mts64_entry {
175       m_uint64_t gvpa;   /* Guest Virtual Page Address */
176       m_uint64_t gppa;   /* Guest Physical Page Address */
177       m_iptr_t   hpa;    /* Host Page Address */
178       m_uint32_t flags;  /* Flags */
179    }__attribute__ ((aligned(16)));
180    
181  /* Global logfile */  /* Global logfile */
182  extern FILE *log_file;  extern FILE *log_file;
183    
# Line 165  static forced_inline m_int64_t sign_exte Line 203  static forced_inline m_int64_t sign_exte
203     return (x << len) >> len;     return (x << len) >> len;
204  }  }
205    
206    /* Sign-extension (32-bit) */
207    static forced_inline m_int32_t sign_extend_32(m_int32_t x,int len)
208    {
209       len = 32 - len;
210       return (x << len) >> len;
211    }
212    
213  /* Extract bits from a 32-bit values */  /* Extract bits from a 32-bit values */
214  static inline int bits(m_uint32_t val,int start,int end)  static inline int bits(m_uint32_t val,int start,int end)
215  {  {
# Line 311  int memzone_open_file(char *filename,u_c Line 356  int memzone_open_file(char *filename,u_c
356  /* Compute NVRAM checksum */  /* Compute NVRAM checksum */
357  m_uint16_t nvram_cksum(m_uint16_t *ptr,size_t count);  m_uint16_t nvram_cksum(m_uint16_t *ptr,size_t count);
358    
359    /* Byte-swap a memory block */
360    void mem_bswap32(void *ptr,size_t len);
361    
362  #endif  #endif

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

  ViewVC Help
Powered by ViewVC 1.1.26