mirror of
https://github.com/holub/mame
synced 2025-10-07 17:27:06 +03:00

space by index. Update functions and methods that accepted an address space index to take an address_spacenum instead. Note that this means you can't use a raw integer in ADDRESS_SPACE macros, so instead of 0 use the enumerated AS_0. Standardized the project on the shortened constants AS_* over the older ADDRESS_SPACE_*. Removed the latter to prevent confusion. Also centralized the location of these definitions to memory.h.
89 lines
2.5 KiB
C
89 lines
2.5 KiB
C
/***************************************************************************
|
|
|
|
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__
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
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(device_t *cpu, address_spacenum 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 /* __VTLB_H__ */
|