pound-emu_pound/core
Ronald Caesar 55af4bebda aarch64/mem: Add fast GPA-to-HVA translation helper
In emulating guests with a simple, flat memory model, we frequently need
to translate a guest physical address (GPA) into a host virtual address
(HVA). This is a hot path operation that must be efficient as possible.

This commit introduces gpa_to_hva(), a static inline helper function
designed for this purpose. The implementation relies on the fundamental
pre-condition that the guest's physical RAM is backed by a single,
contiguous region of host virtual memory (typically acquired via mmap).
It treats the GPA not as a pointer but as a direct byte offset from the
base of this host mapping.

This approach is optimal for performance for two key reasons:

1. The translation is a single pointer-offset calculation, which
   typically compiles to a single LEA intruction on x86-64.

2. It preserves memory access  locality. When a guest performs
   sequential accesses, the host's accesses are also sequential,
   allowing the host CPU's hardware prefetcher to function effectively.

This helper provides the fast path for simple RAM accesses. More
complex address spaces involving discontiguous memory or MMIO regions
will require a slower, lookup-based translation mechanism. This
function is not intended for those cases.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-08-13 15:19:17 -04:00
..
aarch64 aarch64/mem: Add fast GPA-to-HVA translation helper 2025-08-13 15:19:17 -04:00
audio Import Strong Logger & Config System 2025-06-18 18:30:21 +02:00
Base Configurable Window Size 2025-06-20 22:55:58 +02:00
gpu Import Strong Logger & Config System 2025-06-18 18:30:21 +02:00
Images Adding Pound Icon to Executable 2025-06-18 19:09:53 +02:00
JIT aarch64: fix include file in jit 2025-08-10 02:42:27 -04:00
memory Feat: added support for std::allocator (#65) 2025-08-10 06:54:02 +00:00
miscgui rename settings to avoid build faliures 2025-06-21 15:06:37 -04:00
main.cpp gui: initialize structs to default value 2025-08-10 02:10:06 -04:00
Pound.rc Adding Pound Icon to Executable 2025-06-18 19:09:53 +02:00