--- upstream/dynamips-0.2.7-RC1/utils.h 2007/10/06 16:23:47 7 +++ upstream/dynamips-0.2.7/utils.h 2007/10/06 16:29:14 10 @@ -22,6 +22,20 @@ #define TRUE 1 #endif +/* Host CPU Types */ +#define CPU_x86 0 +#define CPU_amd64 1 +#define CPU_nojit 2 + +/* Number of host registers available for JIT */ +#if JIT_CPU == CPU_x86 +#define JIT_HOST_NREG 8 +#elif JIT_CPU == CPU_amd64 +#define JIT_HOST_NREG 16 +#else +#define JIT_HOST_NREG 0 +#endif + /* Endianness */ #define ARCH_BIG_ENDIAN 0x4321 #define ARCH_LITTLE_ENDIAN 0x1234 @@ -99,9 +113,11 @@ typedef m_uint64_t m_tmcnt_t; /* Forward declarations */ +typedef struct cpu_gen cpu_gen_t; typedef struct vm_instance vm_instance_t; typedef struct mips64_jit_tcb mips64_jit_tcb_t; typedef struct ppc32_jit_tcb ppc32_jit_tcb_t; +typedef struct jit_op jit_op_t; /* Translated block function pointer */ typedef void (*insn_tblock_fptr)(void); @@ -157,8 +173,9 @@ #define MTS_INV_ENTRY_MASK 0x00000001 /* MTS entry flags */ -#define MTS_FLAG_DEV 0x000000001 /* Virtual device used */ -#define MTS_FLAG_COW 0x000000002 /* Copy-On-Write */ +#define MTS_FLAG_DEV 0x000000001 /* Virtual device used */ +#define MTS_FLAG_COW 0x000000002 /* Copy-On-Write */ +#define MTS_FLAG_EXEC 0x000000004 /* Exec page */ /* Virtual TLB entry (32-bit MMU) */ typedef struct mts32_entry mts32_entry_t; @@ -178,6 +195,16 @@ m_uint32_t flags; /* Flags */ }__attribute__ ((aligned(16))); +/* Host register allocation */ +#define HREG_FLAG_ALLOC_LOCKED 1 +#define HREG_FLAG_ALLOC_FORCED 2 + +struct hreg_map { + int hreg,vreg; + int flags; + struct hreg_map *prev,*next; +}; + /* Global logfile */ extern FILE *log_file; @@ -359,4 +386,7 @@ /* Byte-swap a memory block */ void mem_bswap32(void *ptr,size_t len); +/* Reverse a byte */ +m_uint8_t m_reverse_u8(m_uint8_t val); + #endif