From e2a34db691318143e77c04bb6225d6cc43368849 Mon Sep 17 00:00:00 2001 From: PatrickvL Date: Wed, 2 Aug 2017 11:18:13 +0200 Subject: [PATCH] Updated Cxbx Reloaded overview (markdown) --- Cxbx-Reloaded-overview.md | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/Cxbx-Reloaded-overview.md b/Cxbx-Reloaded-overview.md index d5d656a..ebef682 100644 --- a/Cxbx-Reloaded-overview.md +++ b/Cxbx-Reloaded-overview.md @@ -12,19 +12,6 @@ Cxbx-Reloaded is a single executable which operates in two different modes: ## Operating System Cxbx-Reloaded currently runs on 64-bit Windows 7 and up. (More on this later, under 'Xbox Kernel') -## Emulating Xbox memory layout -Cxbx-Reloaded emulates the Xbox memory layout using a trick that allows so-called 'fast path' memory access, by mimicking the memory layout of the Xbox on the host OS. This involves the following steps: - -First, we apply the these linker options to the Cxbx-Reloaded executable: -* ImageBase is set to memory addres 0x00010000 (the lowest possible virtual memory address on both Xbox and Windows). -* Relocation information is stripped, so Windows is forbidden to relocate Cxbx-Reloaded to another address. - -Furthermore, to be able to run Xbox code on the same virtual addresses as on real hardware, we apply these tricks: -* All emulation code is moved 64 MiB upwards, by reserving an empty-initialized virtual memory placeholder **as the very first thing** (before any code appears in the Cxbx-Reloaded `.text` section). -* This placeholder is used for all Xbox virtual memory operations. - -The downside to this is that the Cxbx-Reloaded is quite big (more than 67 MiB currently), but once compressed it's less than 3 MiB. Since Cxbx-Reloaded launches itself a second time for actual emulation, memory-requirements on the host are doubled to at least 256 MiB of memory (but expect much swapping when the host has less than 1 GiB of physical memory installed). - ## CPU 'emulation' Cxbx-Reloaded emulates the Xbox using direct code execution. This means most of the CPU instructions the Xbox would execute, are executed directly on the host machine, without any modification or interpretation. _This restricts running Cxbx-Reloaded to CPU's that are compatible with the Xbox Pentium 3 Coppermine CPU!_ @@ -49,6 +36,19 @@ In contrast to this, another approach to emulate a machine like the Xbox is not Cxbx-Reloaded in it's current form, is slowly migrating towards LLE, and offers a few experimental flags to enable LLE of the APU and/or the GPU. (And additional flag, called 'JIT'. More on this later, under 'JIT'). For now, Cxbx-Reloaded only reliably supports HLE. Don't expect LLE to do anything (really, it won't). +## Emulating Xbox memory layout +Cxbx-Reloaded emulates the Xbox memory layout using a trick that allows so-called 'fast path' memory access, by mimicking the memory layout of the Xbox on the host OS. This involves the following steps: + +First, we apply the these linker options to the Cxbx-Reloaded executable: +* ImageBase is set to memory addres 0x00010000 (the lowest possible virtual memory address on both Xbox and Windows). +* Relocation information is stripped, so Windows is forbidden to relocate Cxbx-Reloaded to another address. + +Furthermore, to be able to run Xbox code on the same virtual addresses as on real hardware, we apply these tricks: +* All emulation code is moved 64 MiB upwards, by reserving an empty-initialized virtual memory placeholder **as the very first thing** (before any code appears in the Cxbx-Reloaded `.text` section). +* This placeholder is used for all Xbox virtual memory operations. + +The downside to this is that the Cxbx-Reloaded is quite big (more than 67 MiB currently), but once compressed it's less than 3 MiB. Since Cxbx-Reloaded launches itself a second time for actual emulation, memory-requirements on the host are doubled to at least 256 MiB of memory (but expect much swapping when the host has less than 1 GiB of physical memory installed). + ## Hardware accesses Most Xbox hardware is mapped from 0xF0000000 to 0xFFFFFFFF. Cxbx-Reloaded reserves this memory-region using so-called 'guard-pages' which guarantees this memory range isn't used for anything else, and causes so-called access violations (or more accuratly, guard-page exceptions). When Cxbx-Reloaded emulates an Xbox instruction that accesses a hardware component (reading or writing to one of the MMIO memory-addresses), this access is trapped using a so-called 'exception handler'. This allows us to capture and emulate hardware accesses that aren't present on the host. @@ -58,10 +58,11 @@ However, when it happens, exception handling is slow, as it incurs a context-swi ## Contiguous memory -In addition to the hardware memory range, the Xbox has a memory range that's shared between the CPU and the GPU, called 'Contiguous memory'. For the CPU, this memory is memory-mapped to addresses 0x80000000 to 0x84000000. For the GPU, this memory is addressable from 0x00000000 to 0x04000000. +In addition to the hardware memory range, the Xbox has a memory range that's shared between the CPU and the GPU, called 'Contiguous memory'. For the CPU, this memory is mapped to addresses 0x80000000 to 0x84000000. For the GPU, this memory is addressable from 0x00000000 to 0x04000000. +Since we emulate the GPU, we can access this memory solely in the CPU memory-mapped space, which we reserve at startup. ## Tiled memory -**TODO** +Tiled memory is not yet fully researched for Cxbx-Reloaded. Currently, Cxbx-Reloaded just maps the same memory in use for 'Contiguous memory' towards the tiled memory region (0xF0000000 to 0xF4000000). _This is probably not sufficient and will need more research and emulation._ ## JIT **TODO** \ No newline at end of file