* [Qemu-devel] Question about the source code.
@ 2015-11-06 1:27 Toni Nedialkov
2015-11-06 10:08 ` Peter Maydell
0 siblings, 1 reply; 2+ messages in thread
From: Toni Nedialkov @ 2015-11-06 1:27 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 418 bytes --]
Hello, I have a question pertaining the source code, wondering if I've
discovered a bug or am just simply confused.
It's about this function in translate-all.c
static void page_flush_tb(void)
{
int i;
for (i = 0; i < V_L1_SIZE; i++) {
page_flush_tb_1(V_L1_SHIFT / V_L2_BITS - 1, l1_map + i);
}
}
Was wondering if l1_map + i is correct, or whether it should be l1_map +
i*sizeof(i).
Thank you.
[-- Attachment #2: Type: text/html, Size: 3263 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] Question about the source code.
2015-11-06 1:27 [Qemu-devel] Question about the source code Toni Nedialkov
@ 2015-11-06 10:08 ` Peter Maydell
0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2015-11-06 10:08 UTC (permalink / raw)
To: Toni Nedialkov; +Cc: QEMU Developers
On 6 November 2015 at 01:27, Toni Nedialkov <farmdve@gmail.com> wrote:
> Hello, I have a question pertaining the source code, wondering if I've
> discovered a bug or am just simply confused.
>
> It's about this function in translate-all.c
>
> static void page_flush_tb(void)
> {
> int i;
>
> for (i = 0; i < V_L1_SIZE; i++) {
> page_flush_tb_1(V_L1_SHIFT / V_L2_BITS - 1, l1_map + i);
> }
> }
>
> Was wondering if l1_map + i is correct, or whether it should be l1_map +
> i*sizeof(i).
If you look at the declaration of l1_map:
static void *l1_map[V_L1_SIZE];
it is an array of pointers with V_L1_SIZE entries. This
loop is just indexing through that array, and "l1_map + i"
is the same as "&l1_map[i]".
i is just an index here, and the size of the int type
doesn't have any relation to the size of any of the
data structures involved in l1_map.
thanks
-- PMM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-06 10:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-06 1:27 [Qemu-devel] Question about the source code Toni Nedialkov
2015-11-06 10:08 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).