1 // license:BSD-3-Clause
2 // copyright-holders:Aaron Giles
3 /***************************************************************************
7 Generic virtual TLB implementation.
9 ***************************************************************************/
18 /***************************************************************************
20 ***************************************************************************/
22 #define VTLB_FLAGS_MASK 0xff
24 #define VTLB_READ_ALLOWED 0x01 /* (1 << TRANSLATE_READ) */
25 #define VTLB_WRITE_ALLOWED 0x02 /* (1 << TRANSLATE_WRITE) */
26 #define VTLB_FETCH_ALLOWED 0x04 /* (1 << TRANSLATE_FETCH) */
27 #define VTLB_FLAG_VALID 0x08
28 #define VTLB_USER_READ_ALLOWED 0x10 /* (1 << TRANSLATE_READ_USER) */
29 #define VTLB_USER_WRITE_ALLOWED 0x20 /* (1 << TRANSLATE_WRITE_USER) */
30 #define VTLB_USER_FETCH_ALLOWED 0x40 /* (1 << TRANSLATE_FETCH_USER) */
31 #define VTLB_FLAG_FIXED 0x80
35 /***************************************************************************
37 ***************************************************************************/
39 /* represents an entry in the VTLB */
40 typedef UINT32 vtlb_entry;
43 /* opaque structure describing VTLB state */
48 /***************************************************************************
50 ***************************************************************************/
53 /* ----- initialization/teardown ----- */
55 /* allocate a new VTLB for the given CPU */
56 vtlb_state *vtlb_alloc(void *cpu, address_spacenum space, int fixed_entries, int dynamic_entries);
58 /* free an allocated VTLB */
59 void vtlb_free(vtlb_state *vtlb);
62 /* ----- filling ----- */
64 /* called by the CPU core in response to an unmapped access */
65 int vtlb_fill(vtlb_state *vtlb, offs_t address, int intention);
67 /* load a fixed VTLB entry */
68 void vtlb_load(vtlb_state *vtlb, int entrynum, int numpages, offs_t address, vtlb_entry value);
70 /* load a dynamic VTLB entry */
71 void vtlb_dynload(vtlb_state *vtlb, UINT32 index, offs_t address, vtlb_entry value);
73 /* ----- flushing ----- */
75 /* flush all knowledge from the dynamic part of the VTLB */
76 void vtlb_flush_dynamic(vtlb_state *vtlb);
78 /* flush knowledge of a particular address from the VTLB */
79 void vtlb_flush_address(vtlb_state *vtlb, offs_t address);
82 /* ----- accessors ----- */
84 /* return a pointer to the base of the linear VTLB lookup table */
85 const vtlb_entry *vtlb_table(vtlb_state *vtlb);
88 #endif /* __VTLB_H__ */