qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] What "opaque" stand for?


From: Peter Maydell
Subject: Re: [Qemu-devel] What "opaque" stand for?
Date: Mon, 10 Nov 2014 09:41:13 +0000

On 10 November 2014 07:33, Kaiyuan <address@hidden> wrote:
> Thanks for your explanation, Peter. In this case of
> timer_read(void *opaque, hwaddr addr, unsigned int size), could
> I think that opaque is a pointer to a register located in mmio
> address? If I cast opaque pointer to corresponding structure,
> the beginning address of structure == hwaddr addr and the size of
> structure == parameter size?

No, I think you're confused. The "opaque" parameter is simply
whatever was passed as the fourth argument to memory_region_init_io()
[see the documentation for that function in include/exec/memory.h].
Typically in device models we pass the pointer to the device object
itself, so that the callback can access any relevant internal state.

This has no relation at all to the 'hwaddr' and 'size' arguments
to the callback, which tell you what relative address within your
MMIO region the guest was accessing and at what size.

-- PMM



reply via email to

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