diff options
author | 2008-06-16 03:12:49 +0000 | |
---|---|---|
committer | 2008-06-16 03:12:49 +0000 | |
commit | 5deab27d6d41791498aac45246d3b7cc5ea6281f (patch) | |
tree | 56c1910008a5e3df2cc6ea0034b409044765d041 /src/emu/cpu/vtlb.h | |
parent | cd0703d80ab10309a691929f66efd792b5fff6ca (diff) |
Created common virtual TLB managment module.
Updated MIPS and PowerPC code to make use of it.
Diffstat (limited to 'src/emu/cpu/vtlb.h')
-rw-r--r-- | src/emu/cpu/vtlb.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/src/emu/cpu/vtlb.h b/src/emu/cpu/vtlb.h new file mode 100644 index 00000000000..c6b2045e7cd --- /dev/null +++ b/src/emu/cpu/vtlb.h @@ -0,0 +1,89 @@ +/*************************************************************************** + + vtlb.h + + Generic virtual TLB implementation. + + Copyright Aaron Giles + Released for general non-commercial use under the MAME license + Visit http://mamedev.org for licensing and usage restrictions. + +***************************************************************************/ + +#pragma once + +#ifndef __VTLB_H__ +#define __VTLB_H__ + +#include "cpuintrf.h" + + +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +#define VTLB_FLAGS_MASK 0xff + +#define VTLB_READ_ALLOWED 0x01 /* (1 << TRANSLATE_READ) */ +#define VTLB_WRITE_ALLOWED 0x02 /* (1 << TRANSLATE_WRITE) */ +#define VTLB_FETCH_ALLOWED 0x04 /* (1 << TRANSLATE_FETCH) */ +#define VTLB_FLAG_VALID 0x08 +#define VTLB_USER_READ_ALLOWED 0x10 /* (1 << TRANSLATE_READ_USER) */ +#define VTLB_USER_WRITE_ALLOWED 0x20 /* (1 << TRANSLATE_WRITE_USER) */ +#define VTLB_USER_FETCH_ALLOWED 0x40 /* (1 << TRANSLATE_FETCH_USER) */ +#define VTLB_FLAG_FIXED 0x80 + + + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +/* represents an entry in the VTLB */ +typedef UINT32 vtlb_entry; + + +/* opaque structure describing VTLB state */ +typedef struct _vtlb_state vtlb_state; + + + +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ + + +/* ----- initialization/teardown ----- */ + +/* allocate a new VTLB for the given CPU */ +vtlb_state *vtlb_alloc(int cpunum, int space, int fixed_entries, int dynamic_entries); + +/* free an allocated VTLB */ +void vtlb_free(vtlb_state *vtlb); + + +/* ----- filling ----- */ + +/* called by the CPU core in response to an unmapped access */ +int vtlb_fill(vtlb_state *vtlb, offs_t address, int intention); + +/* load a fixed VTLB entry */ +void vtlb_load(vtlb_state *vtlb, int entrynum, int numpages, offs_t address, vtlb_entry value); + + +/* ----- flushing ----- */ + +/* flush all knowledge from the dynamic part of the VTLB */ +void vtlb_flush_dynamic(vtlb_state *vtlb); + +/* flush knowledge of a particular address from the VTLB */ +void vtlb_flush_address(vtlb_state *vtlb, offs_t address); + + +/* ----- accessors ----- */ + +/* return a pointer to the base of the linear VTLB lookup table */ +const vtlb_entry *vtlb_table(vtlb_state *vtlb); + + +#endif |