On 6 November 2015 at 01:27, Toni Nedialkov <farm...@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