qemu-discuss
[Top][All Lists]
Advanced

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

Re: using bit-field to define a qom register


From: Hiroko Shimizu
Subject: Re: using bit-field to define a qom register
Date: Sun, 11 Jul 2021 17:12:17 +0900

>If you mean the MemoryRegionOps read and write functions,
Yes, I mean that. I understand that "MemoryRegionOps read and write functions, those work only with byte offsets."
But, I must set a value into a qom register using C bit fields in the guest source code.
If I use the extract32/deposit32 function, how do you know which bit is selected?
I mean that, if I write "register.B1 = 1" in the guest source code, I want to set 1 into the second bit in the qom source code using the deposit32 function, but how do you know start, length, and fieldval which are the argument of the deposit function?


2021年7月11日(日) 0:20 Peter Maydell <peter.maydell@linaro.org>:
On Sat, 10 Jul 2021 at 03:02, Hiroko Shimizu <hiroko07168@gmail.com> wrote:
> Anyway, if you access the second bit, does the read/write function
> offset value become 1 bit automatically?

If you mean the MemoryRegionOps read and write functions, those
work only with byte offsets, because the guest CPU cannot make
accesses to individual bits, only to bytes (for some devices,
it may only be able to access word at a time). You have to write
your read and write functions to do whatever the hardware would
do for those byte or word accesses.

-- PMM

reply via email to

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