kvm: Add framework for machine types and MMIO dispatch

The core of the machine-type support is the new operations table,
kvm_ops_t. This acts as a standard C-style virtual table decoupling the
generic KVM core logic from target specific hardware emualtion. The
kvm_t VM instance now points to an ops table, which defines the
"personality" of the guest. A kvm_probe() factory function has been
added to initialize a kvm_t instance with the correct ops table for a
given machine type (eg, Switch 1).

The ops table's .mmio_read and .mmio_write function pointers are the
link between the armv8 CPU core and this new MMIO dispatcher. When a
physical memory access is determined to be MMIO, the VM will call the
appropriate function pointer, which in turn will use the MMIO dispatcher
to find and execute the correct device handler.

The initial implementation for the Switch 1 target
(targets/switch1/hardware/probe.cpp) is a stub. The bootstrapping
logic will be added in subsequent patches.

Signed-off-by: Ronald Caesar <github43132@proton.me>
This commit is contained in:
Ronald Caesar 2025-08-24 20:03:42 -04:00
parent dea94dc259
commit c6706dd8a0
57 changed files with 533 additions and 70 deletions

View file

@ -24,19 +24,19 @@ project(Pound)
find_package(fmt 10.2.1 CONFIG)
find_package(SDL3 3.2.10 CONFIG)
find_package(toml11 4.4.0 CONFIG)
add_subdirectory(3rd_Party)
add_executable(Pound
core/main.cpp
src/main.cpp
)
add_subdirectory(core/arm64)
add_subdirectory(core/common)
add_subdirectory(core/frontend)
add_subdirectory(core/host)
add_subdirectory(src/kvm)
add_subdirectory(src/common)
add_subdirectory(src/frontend)
add_subdirectory(src/host)
add_subdirectory(src/targets/switch1/hardware)
target_compile_options(Pound PRIVATE -Wall -Wpedantic
-Wshadow
@ -47,7 +47,7 @@ target_compile_options(Pound PRIVATE -Wall -Wpedantic
)
# Link libraries
target_link_libraries(Pound PRIVATE fmt::fmt SDL3::SDL3 toml11::toml11)
target_link_libraries(Pound PRIVATE fmt::fmt SDL3::SDL3)
if (WIN32)
add_compile_definitions(NOMINMAX WIN32_LEAN_AND_MEAN)