#include <mempage.h>
Collaboration diagram for oe_pagetable:
Definition at line 58 of file mempage.h.
Public Member Functions | |
oe_pagetable (void) | |
Construct empty page table. | |
~oe_pagetable (void) | |
Destroy page table. | |
void | init (void) |
Initialize page table. | |
void | uninit (void) |
Deinitialize page table. | |
uint32 | create_pagetable (uint32 numpages, uint32 page_size) |
Create page table. | |
int | get_num_pages () |
Return total number of accessible pages. | |
int | alloc_page (int page_num) |
Allocate real memory from heap for given virtual memory page. | |
int | deallocate_page (int page_num) |
Deallocate real memory for given page. | |
void | set_page_flags (int page_num, OE_PT_FLAG added_flags) |
Sets given set of permission flags for the page. | |
void | unset_page_flags (int page_num, OE_PT_FLAG removed_flags) |
Disables given set of permission flags for the page. | |
OE_INLINE uint8 | read_mem8 (void *cpu_ref, uint32 paddr) |
Read 8-bit value from memory. | |
OE_INLINE uint16 | read_mem16 (void *cpu_ref, uint32 paddr) |
Read 16-bit value from memory. | |
OE_INLINE uint32 | read_mem32 (void *cpu_ref, uint32 paddr) |
Read 32-bit value from memory. | |
OE_INLINE void | write_mem8 (void *cpu_ref, uint32 paddr, uint8 dat) |
Write 8-bit value to memory. | |
OE_INLINE void | write_mem16 (void *cpu_ref, uint32 paddr, uint16 dat) |
Write 16-bit value to memory. | |
OE_INLINE void | write_mem32 (void *cpu_ref, uint32 paddr, uint32 dat) |
Write 32-bit value to memory. | |
OE_INLINE uint8 | forced_read_mem8 (void *cpu_ref, uint32 paddr) |
Read 8-bit value from memory without possibility for the user callback fallback. | |
OE_INLINE uint16 | forced_read_mem16 (void *cpu_ref, uint32 paddr) |
Read 16-bit value from memory without possibility for the user callback fallback. | |
OE_INLINE uint32 | forced_read_mem32 (void *cpu_ref, uint32 paddr) |
Read 32-bit value from memory without possibility for the user callback fallback. | |
OE_INLINE void | forced_write_mem8 (void *cpu_ref, uint32 paddr, uint8 dat) |
Write 8-bit value to memory without possibility for the user callback fallback. | |
OE_INLINE void | forced_write_mem16 (void *cpu_ref, uint32 paddr, uint16 dat) |
Write 16-bit value to memory without possibility for the user callback fallback. | |
OE_INLINE void | forced_write_mem32 (void *cpu_ref, uint32 paddr, uint32 dat) |
Write 32-bit value to memory without possibility for the user callback fallback. | |
Public Attributes | |
oe_pagetable_ptrtable * | calls |
Callback function pointers, should be set up by the user. | |
OE_PT_FLAG * | flags |
uint8 ** | mem |
Array of pointers to memory blocks, one block per page, if block is NULL - will cause "callback" to be called on access. | |
uint32 | mask |
uint32 | shift |
uint32 | size |
uint32 | clamp |
oe_pagetable::oe_pagetable | ( | void | ) |
oe_pagetable::~oe_pagetable | ( | void | ) |
void oe_pagetable::init | ( | void | ) |
Initialize page table.
Definition at line 97 of file mempage.cpp.
Referenced by CPU_RCA1802::init(), CPU_M65C02::init(), and oe_pagetable().
void oe_pagetable::uninit | ( | void | ) |
Deinitialize page table.
Definition at line 106 of file mempage.cpp.
Referenced by create_pagetable(), and ~oe_pagetable().
uint32 oe_pagetable::create_pagetable | ( | uint32 | numpages, | |
uint32 | page_size | |||
) |
Create page table.
Number of pages * (page_size). Note that page_size has to be a power of 2 or the function will fail (with non-zero (error) return value)!
Definition at line 41 of file mempage.cpp.
Referenced by RCASTUDIO2::init(), HW_R6545::init(), NES::init(), Commodore64::init(), HW_MOS6567::init(), and PPU::setmapper().
int oe_pagetable::get_num_pages | ( | ) | [inline] |
int oe_pagetable::alloc_page | ( | int | page_num | ) | [inline] |
Allocate real memory from heap for given virtual memory page.
page_num | page number to allocate. |
int oe_pagetable::deallocate_page | ( | int | page_num | ) | [inline] |
void oe_pagetable::set_page_flags | ( | int | page_num, | |
OE_PT_FLAG | added_flags | |||
) | [inline] |
void oe_pagetable::unset_page_flags | ( | int | page_num, | |
OE_PT_FLAG | removed_flags | |||
) | [inline] |
OE_INLINE uint8 oe_pagetable::read_mem8 | ( | void * | cpu_ref, | |
uint32 | paddr | |||
) | [inline] |
Read 8-bit value from memory.
cpu_ref | is opaque pointer which will be passed unchanged to the callback if called. | |
paddr | flat address in memory. |
Definition at line 158 of file mempage.h.
Referenced by CPU_RCA1802::cycle(), CPU_M65C02::cycle(), CPU_RCA1802::DMA_OUT(), PPU::readreg(), CPU_M65C02::reset(), and PPU::writereg().
OE_INLINE uint16 oe_pagetable::read_mem16 | ( | void * | cpu_ref, | |
uint32 | paddr | |||
) | [inline] |
OE_INLINE uint32 oe_pagetable::read_mem32 | ( | void * | cpu_ref, | |
uint32 | paddr | |||
) | [inline] |
OE_INLINE void oe_pagetable::write_mem8 | ( | void * | cpu_ref, | |
uint32 | paddr, | |||
uint8 | dat | |||
) | [inline] |
Write 8-bit value to memory.
cpu_ref | is opaque pointer which will be passed unchanged to the callback if called. | |
paddr | flat address in memory. | |
dat | data to write. |
Definition at line 243 of file mempage.h.
Referenced by CPU_M65C02::cycle(), CPU_RCA1802::DMA_IN(), and PPU::writereg().
OE_INLINE void oe_pagetable::write_mem16 | ( | void * | cpu_ref, | |
uint32 | paddr, | |||
uint16 | dat | |||
) | [inline] |
OE_INLINE void oe_pagetable::write_mem32 | ( | void * | cpu_ref, | |
uint32 | paddr, | |||
uint32 | dat | |||
) | [inline] |
OE_INLINE uint8 oe_pagetable::forced_read_mem8 | ( | void * | cpu_ref, | |
uint32 | paddr | |||
) | [inline] |
Read 8-bit value from memory without possibility for the user callback fallback.
cpu_ref | is opaque pointer which will be passed unchanged to the callback if called. | |
paddr | flat address in memory. |
OE_INLINE uint16 oe_pagetable::forced_read_mem16 | ( | void * | cpu_ref, | |
uint32 | paddr | |||
) | [inline] |
Read 16-bit value from memory without possibility for the user callback fallback.
cpu_ref | is opaque pointer which will be passed unchanged to the callback if called. | |
paddr | flat address in memory. |
OE_INLINE uint32 oe_pagetable::forced_read_mem32 | ( | void * | cpu_ref, | |
uint32 | paddr | |||
) | [inline] |
Read 32-bit value from memory without possibility for the user callback fallback.
cpu_ref | is opaque pointer which will be passed unchanged to the callback if called. | |
paddr | flat address in memory. |
OE_INLINE void oe_pagetable::forced_write_mem8 | ( | void * | cpu_ref, | |
uint32 | paddr, | |||
uint8 | dat | |||
) | [inline] |
Write 8-bit value to memory without possibility for the user callback fallback.
cpu_ref | is opaque pointer which will be passed unchanged to the callback if called. | |
paddr | flat address in memory. | |
dat | value to write to memory. |
OE_INLINE void oe_pagetable::forced_write_mem16 | ( | void * | cpu_ref, | |
uint32 | paddr, | |||
uint16 | dat | |||
) | [inline] |
Write 16-bit value to memory without possibility for the user callback fallback.
cpu_ref | is opaque pointer which will be passed unchanged to the callback if called. | |
paddr | flat address in memory. | |
dat | value to write to memory. |
OE_INLINE void oe_pagetable::forced_write_mem32 | ( | void * | cpu_ref, | |
uint32 | paddr, | |||
uint32 | dat | |||
) | [inline] |
Write 32-bit value to memory without possibility for the user callback fallback.
cpu_ref | is opaque pointer which will be passed unchanged to the callback if called. | |
paddr | flat address in memory. | |
dat | value to write to memory. |
Callback function pointers, should be set up by the user.
Definition at line 60 of file mempage.h.
Referenced by create_pagetable(), RCASTUDIO2::init(), NES::init(), init(), Commodore64::init(), read_mem16(), read_mem32(), read_mem8(), PPU::setmapper(), uninit(), write_mem16(), write_mem32(), and write_mem8().
uint8** oe_pagetable::mem |
Array of pointers to memory blocks, one block per page, if block is NULL - will cause "callback" to be called on access.
Definition at line 62 of file mempage.h.
Referenced by alloc_page(), create_pagetable(), deallocate_page(), forced_read_mem16(), forced_read_mem32(), forced_read_mem8(), forced_write_mem16(), forced_write_mem32(), forced_write_mem8(), RCASTUDIO2::init(), NES::init(), init(), Commodore64::init(), read_mem16(), read_mem32(), read_mem8(), set_page_flags(), PPU::setmapper(), uninit(), unset_page_flags(), write_mem16(), write_mem32(), and write_mem8().