集成电路与嵌入式系统2026,Vol.26Issue(1):37-46,10.DOI:10.20193/j.ices2097-4191.2025.0056
基于页表机制实现QEMU调用片外外设动态库的方法
A method for implementing QEMU callback to off-chip peripheral dynamic libraries based on TLB mechanism
摘要
Abstract
This paper investigates the page table mechanism for address translation between the QEMU virtual machine and the host,providing an in-depth analysis of page table filling principles and how memory read/write instructions trigger distinct processing flows for different memory types.By introducing a new flag bit into page attributes and setting/checking this bit during page table population and in memory access helper functions,the method achieves recognition of addresses with specific attributes and invokes corresponding call-back functions.With reference to the peripheral addition process in the QEMU leon3 example,interface functions for dynamic libraries are designed,including device creation,initialization,and read/write callbacks.The read/write process and parameter transmission characteristics of QEMU for MMIO peripherals are analyzed to clarify the peripheral locating principle and the basic parameters required by callback functions.Based on this,precise call locations for read/write callback functions in off-chip MMIO peripheral dynamic libraries are designed and presented.Experiments verify the correctness and performance sensitivity of the proposed approach.Results demonstrate that this method effectively separates peripheral code from QEMU source code,ensures correct execution,and achieves over 97%of the performance compared to compiling peripheral source code directly with QEMU.This study offers valuable insights for virtual machine developers and QEMU open-source users.关键词
内存分派/仿真外设/虚拟机/QEMU/动态库Key words
memory dispatch/simulated peripherals/virtual machine/QEMU/dynamic library分类
信息技术与安全科学引用本文复制引用
LI Gen,WU Jin,ZHANG Yuyuan,CUI Hongwei,JI Hongxia..基于页表机制实现QEMU调用片外外设动态库的方法[J].集成电路与嵌入式系统,2026,26(1):37-46,10.基金项目
国家自然科学基金(No.2022YFB4501900) (No.2022YFB4501900)