Bare-Metal Cross-Architecture Virtualization on Mobile Platforms: A Type-1 Hypervisor Design

    This article presents a bare-metal, Type-1 hypervisor design for running a complete heterogeneous operating system on non-native mobile hardware. It explains why conventional user-space virtualization hits structural limits in execution path length, hardware visibility, and semantic gaps, then details a minimal hypervisor core built on ARMv9 virtualization extensions that reuses native firmware services. Key mechanisms cover second-stage address translation, virtual interrupt and timer handling, graphics and media degradation, and a reduced model for secure enclaves. The article also outlines a three-layer validation approach and clearly defines the design's research-only boundaries.

    1. Problem Definition: Why General-Purpose Virtualization Cannot Host a Full Heterogeneous System

    As mobile ecosystems continue to coexist, running one complete operating system on non-native hardware remains an important topic for kernel security research, system call behavior analysis, compatibility validation, and exploration of virtualization boundaries. A common industry approach is to run a general-purpose virtual machine in user space on top of the host kernel. The execution path can be abstracted as:

    1. Host kernel → user-space VM process → dynamic binary translation/instruction emulation → trimmed guest image

    This path has three structural bottlenecks.

    First, the execution path is too long. A user-space VM must cross between user mode and kernel mode multiple times, on top of dynamic translation overhead. The closer the workload is to system-call-heavy and context-switch-heavy scenarios, the more pronounced the loss becomes, and it can easily trigger platform thermal policies that cause sustained frequency throttling.

    Second, hardware visibility is insufficient. The host kernel’s device model, mandatory access control policies, and security isolation domains together form an access barrier. Peripherals such as the GPU, image signal processor, communication baseband, and near-field communication are invisible to the guest, resulting in incomplete system integrity.

    Third, the semantic gap is underestimated. Heterogeneous platforms differ greatly in processor microarchitecture, memory consistency models, interrupt controllers, graphics instruction sets, and secure enclave designs. Instruction translation alone cannot fill the gaps in device semantics and firmware interface semantics.

    Therefore, the approach discussed in this article does not aim to “fully emulate proprietary hardware,” which is physically and practically unfeasible. Instead, it builds a “capability mapping and degraded adaptation” framework: general instruction sets and standard on-chip interconnect peripherals go through register remapping and interrupt forwarding to achieve near-native execution efficiency; proprietary extensions and security architectures are implemented through privileged software emulation or capability degradation to achieve functional equivalence.

    2. Overall Architecture: A Minimal Bare-Metal Core with Firmware Service Reuse

    The design adopts a Type-1 form, where the hypervisor runs directly on the hardware and reuses the low-level services provided by the platform’s native firmware, avoiding stacked layers of abstraction.

    1. Privilege partitioning. Using the ARMv9 virtualization extensions, the hypervisor is placed at EL2, the guest kernel runs at EL1, and applications and system services reside at EL0. Firmware and platform services remain on the EL3 and trusted execution environment side, accessed by the hypervisor through a controlled call channel rather than being rewritten.

    2. Minimal core principle. The core retains only five capabilities: scheduling, second-stage memory address translation, virtual interrupt injection, timers, and controlled firmware calls. Other device semantics are pushed down to a configurable forwarding layer, reducing the attack surface and validation cost.

    3. Hybrid forwarding and emulation layers. Standard on-chip interconnect peripherals use a pass-through path of “register remapping + interrupt forwarding”; proprietary coprocessors, proprietary graphics instructions, and secure enclaves use EL1-level emulation or degradation strategies. The two are selected by a capability descriptor table.

    Illustrative capability descriptor and selection logic:

    1. typedef enum { MAP_DIRECT, MAP_REMAP, MAP_EMULATE, MAP_DEGRADE } cap_mode_t;
    2. typedef struct {
    3. uint32_t cap_id;
    4. cap_mode_t mode;
    5. uint64_t guest_reg_base;
    6. uint64_t host_reg_base;
    7. uint32_t irq_map[8];
    8. } cap_entry_t;
    9. static inline cap_mode_t select_mode(const cap_entry_t *e, uint32_t load_class) {
    10. if (e->mode == MAP_DIRECT) return MAP_DIRECT;
    11. if (load_class == LOAD_GRAPHICS && e->mode == MAP_EMULATE) return MAP_DEGRADE;
    12. return e->mode;
    13. }

    3. Key Mechanism Design

    3.1 Memory and Address Space

    An independent second-stage address translation table is established for each guest, combined with large-page mappings to reduce page-table traversal overhead. Device memory uses static mapping with restricted access permissions, preventing the guest from directly reaching trusted regions. For memory consistency, explicit synchronization points must be defined between the guest and the host to avoid data races under a weak memory model being misdiagnosed as device faults.

    3.2 Interrupts and Timers

    The virtual interrupt controller must support priority, masking, and affinity mapping, forwarding guest interrupt numbers to host interrupt numbers according to the capability table. Timers use a virtual counter offset to keep the guest time source monotonic and decoupled from host scheduling, preventing busy spinning and drift.

    3.3 Graphics and Media

    Graphics workloads are handled through command stream interception and degraded execution: general drawing commands are passed through as much as possible, while proprietary instruction sequences fall back to a compatibility path. Media codecs prioritize reusing the platform’s hardware codec capabilities, with the forwarding layer responsible for aligning formats and buffer descriptors. For scheduling, workload classification is introduced so that graphics and media tasks receive independent quotas, avoiding contention with compute tasks.

    3.4 Security and Enclaves

    Secure enclaves are not replicated at the hardware level. Instead, functional equivalence is provided through a degraded model of “controlled key material + restricted service interfaces,” with the explicit caveat that its security boundary is weaker than a native implementation and is intended only for compatibility validation and research purposes.

    4. Validation Method and Engineering Considerations

    Prototype validation is recommended in three layers: the microbenchmark layer measures instruction translation hit rate and trap frequency; the system layer measures context switch, system call, and memory traversal overhead; the application layer observes frame rate and audio/video continuity. On the engineering side, key focus areas include thermal policies, power consumption limits, configurability of the forwarding layer, and observability of logging and monitoring alerts. If large-scale image and artifact distribution is involved, object storage and container platforms can be used to host the build pipeline.

    5. Conclusion and Boundaries

    The value of this architecture lies in reusing native firmware services through a minimal bare-metal core and using capability mapping to turn the unfeasible goal of “full emulation” into measurable “functional equivalence.” Its boundaries are equally clear: proprietary graphics and security architectures can only be degraded, and performance and security are not equivalent to native devices. It is suitable for research and compatibility validation, not as a production replacement.