At 03:07 01.02.2011 -0800, isuru herath wrote: >Hi David, > >Thanks a lot for the reply. The address 0x10001000 is a physical address >and not a virtual address. I thought we can only do this type casting with >virtual addresses. Anyway I tried the method you suggested and I got a >segmentation fault. > >I use mmap to map those physical addresses to virtual addresses, because >OS(linux) in unaware of this other piece of memory which uses physical >address range 0x10001000 to 0x10101000. > >In my example, when I use my method to access i via pointer p (p->i), it >first accesses p and then accesses i. But this introduces unnecessary >access p. Therefore I was wondering how to allocate i in the above >physical region.(Please note that I cant use any optimization -O2, -O3) Once you have p->i, you can also do int* pi=&(p->i); So *pi=1 will only be one access. bye Fabi