Pure dynamic MMIO access. Prep for more complex GPU memory management.

This commit is contained in:
Ben Vanik
2014-06-01 23:36:18 -07:00
parent 3a8065b7b1
commit 0e3854555d
19 changed files with 335 additions and 586 deletions

View File

@@ -45,12 +45,13 @@ X_STATUS GraphicsSystem::Setup() {
worker_ = new RingBufferWorker(this, memory_);
// Let the processor know we want register access callbacks.
RegisterAccessCallbacks callbacks;
callbacks.context = this;
callbacks.handles = (RegisterHandlesCallback)HandlesRegisterThunk;
callbacks.read = (RegisterReadCallback)ReadRegisterThunk;
callbacks.write = (RegisterWriteCallback)WriteRegisterThunk;
emulator_->processor()->AddRegisterAccessCallbacks(callbacks);
emulator_->memory()->AddMappedRange(
0x7FC80000,
0xFFFF0000,
0x0000FFFF,
this,
reinterpret_cast<MMIOReadCallback>(MMIOReadRegisterThunk),
reinterpret_cast<MMIOWriteCallback>(MMIOWriteRegisterThunk));
// Create worker thread.
// This will initialize the graphics system.
@@ -132,10 +133,6 @@ void GraphicsSystem::EnableReadPointerWriteBack(uint32_t ptr,
worker_->EnableReadPointerWriteBack(ptr, block_size);
}
bool GraphicsSystem::HandlesRegister(uint64_t addr) {
return (addr & 0xFFFF0000) == 0x7FC80000;
}
uint64_t GraphicsSystem::ReadRegister(uint64_t addr) {
uint32_t r = addr & 0xFFFF;
XELOGGPU("ReadRegister(%.4X)", r);