#ifndef _TB_H_
#define _TB_H_

//#define ALIGN(val,align)	(((val) + ((align) - 1)) & ~((align) - 1))
#define ALIGN(val,align)	(val - val % align)

#define TB_INSN_LEN_MAX		300
#define TB_LEN			32

typedef struct tb_cache_s {
	struct list_head	list;
	ARMword			addr;
	uint8_t			*tp;
}tb_cache_t;

typedef struct tb_s {
	int			ted;	//0 not translated	1 already translated
	struct list_head	cache;	//if set ted = 0 must clear it
}tb_t;

extern uint8_t *	tb_find(ARMul_State * state, ARMword addr);
extern int		tb_setdirty(ARMul_State * state, ARMword addr, mem_bank_t *mbp);

#ifndef TEA_OUT
//#define TEA_DEBUG
#ifdef TEA_DEBUG
#define TEA_OUT(a)	a
#else
#define TEA_OUT(a)
#endif
#endif

#endif	//_TB_H_
