mirror of
https://github.com/pound-emu/pound.git
synced 2025-12-13 04:36:57 +00:00
A new function, mmu_gva_to_gpa(), will be the sole entry point for resolving guest virtual addresses. This initial implementation models the processor's state on reset. The function inspects the M bit from the emulated SCTLR_EL1 register. If the bit is clear, address mapping (GVA = GPA) is performed. This is an architecturally-mandated behavior required for the Arm guest to execute its initiall boot code before enabling virtual memory. Signed-off-by: Ronald Caesar <github43132@proton.me>
16 lines
344 B
C++
16 lines
344 B
C++
#include "mmu.h"
|
|
|
|
namespace pound::arm64::memory
|
|
{
|
|
int mmu_gva_to_gpa(pound::arm64::vcpu_state_t* vcpu, uint64_t gva, uint64_t* out_gpa)
|
|
{
|
|
const uint8_t SCTLR_EL1_M_BIT = (1 << 0);
|
|
if (0 == (vcpu->sctlr_el1 & SCTLR_EL1_M_BIT))
|
|
{
|
|
*out_gpa = gva;
|
|
return 0;
|
|
}
|
|
|
|
return -1;
|
|
}
|
|
} // namespace pound::arm64::memory
|