2013-09-17 23:03:54 -04:00
|
|
|
#ifndef _MMU_RB_H
|
|
|
|
#define _MMU_RB_H
|
|
|
|
|
|
|
|
enum rb_type_t
|
|
|
|
{
|
2014-04-01 18:18:52 -04:00
|
|
|
RB_INVALID = 0, //invalid
|
|
|
|
RB_1, //1 word
|
|
|
|
RB_4, //4 word
|
|
|
|
RB_8, //8 word
|
2013-09-17 23:03:54 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*bytes of each rb_type*/
|
|
|
|
extern ARMword rb_masks[];
|
|
|
|
|
|
|
|
#define RB_WORD_NUM 8
|
|
|
|
typedef struct rb_entry_s
|
|
|
|
{
|
2014-04-01 18:18:52 -04:00
|
|
|
ARMword data[RB_WORD_NUM]; //array to store data
|
|
|
|
ARMword va; //first word va
|
|
|
|
int type; //rb type
|
|
|
|
fault_t fault; //fault set by rb alloc
|
2013-09-17 23:03:54 -04:00
|
|
|
} rb_entry_t;
|
|
|
|
|
|
|
|
typedef struct rb_s
|
|
|
|
{
|
2014-04-01 18:18:52 -04:00
|
|
|
int num;
|
|
|
|
rb_entry_t *entrys;
|
2013-09-17 23:03:54 -04:00
|
|
|
} rb_s;
|
|
|
|
|
|
|
|
/*mmu_rb_init
|
2014-04-01 18:18:52 -04:00
|
|
|
* @rb_t :rb_t to init
|
|
|
|
* @num :number of entry
|
2013-09-17 23:03:54 -04:00
|
|
|
* */
|
|
|
|
int mmu_rb_init (rb_s * rb_t, int num);
|
|
|
|
|
|
|
|
/*mmu_rb_exit*/
|
|
|
|
void mmu_rb_exit (rb_s * rb_t);
|
|
|
|
|
|
|
|
|
|
|
|
/*mmu_rb_search
|
2014-04-01 18:18:52 -04:00
|
|
|
* @rb_t :rb_t to serach
|
|
|
|
* @va :va address to math
|
2013-09-17 23:03:54 -04:00
|
|
|
*
|
2014-04-01 18:18:52 -04:00
|
|
|
* $ NULL :not match
|
|
|
|
* NO-NULL:
|
2013-09-17 23:03:54 -04:00
|
|
|
* */
|
|
|
|
rb_entry_t *mmu_rb_search (rb_s * rb_t, ARMword va);
|
|
|
|
|
|
|
|
|
|
|
|
void mmu_rb_invalidate_entry (rb_s * rb_t, int i);
|
|
|
|
void mmu_rb_invalidate_all (rb_s * rb_t);
|
|
|
|
void mmu_rb_load (ARMul_State * state, rb_s * rb_t, int i_rb,
|
2014-04-01 18:18:52 -04:00
|
|
|
int type, ARMword va);
|
2013-09-17 23:03:54 -04:00
|
|
|
|
|
|
|
#endif /*_MMU_RB_H_*/
|