qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] How to access guest memory from qemu device internal


From: Greg Kurz
Subject: Re: [Qemu-devel] How to access guest memory from qemu device internal
Date: Thu, 20 Nov 2014 17:08:59 +0100

On Thu, 20 Nov 2014 21:25:18 +0800 (GMT+08:00)
Kaiyuan <address@hidden> wrote:
> Hello, all
>  
> I added a custom device to qemu. This device is attached to sysbus by mmio 
> and has an address register in which device should access the guest memory 
> the register point to.
> I write a bare-metal program that pass an address like 0x1234ABCD to this 
> address register. Inside qemu device code I added, if device reads value from 
> register and directly accesses this value of 0x1234ABCD, it will access host 
> memory 0x1234ABCD rather than guest  memory 0x1234ABCD.
> Does qemu provide some functions that allow device to access guest memory 
> address?
> 

Have a look at *_phys* functions in the <exec/cpu-common.h> QEMU header file 
(cpu_physical_memory_read() for
exemple).

> Thanks,
> Kaiyuan Liang
> 

--
G




reply via email to

[Prev in Thread] Current Thread [Next in Thread]