[okl4-developer] problems with physical memory access from an iguana example

Geoffrey Lee glee at ok-labs.com
Wed May 28 09:47:24 EST 2008


On Tue, May 27, 2008 at 03:28:43PM -0700, Gabi Voiculescu wrote:
> Hello.
> 

Hi Gabi

> 
> By checking the page table before access_test() I can say the mapping is there.
> 
> I think there is a problem in the task's interaction with it's pager (roottask), because the mapping is correct. 


If you know the mapping is already in the kernel pagetable, then this
cannot be the problem, as you would only need to consult the pager if
something were missing from the pagetable.

> 
> Did I miss calling out a function? 
> 
> Is memsection_create_user wrongly used in this context?
> 
> Is there something else where I need to configure the interaction with the pager?


In this case L4 and Iguana has already done the correct mapping for you.

I can only guess you are touching your device registers in a way 
that you are not supposed to, and  it is dying due to that.

You can try breaking into the kdb when it hangs and see what the thread
is doing in access_test().

> 
> Thanks,
> Gabi Voiculescu

	-gl

> 
> -------------------------------------------------------------------------------------------------------
> The code:
> 
> struct reg_struct
> {
>     memsection_ref_t ms;
>     uintptr_t ms_base;
> };
> 
> 
> void access_test(memsection_ref_t ms, uintptr_t ref_ms_base)
> {
>      int                 result;
> 
>      uint32_t            * ptr;
>      uintptr_t           ms_base, ms_size;
>      size_t              size;
> 
>      
>      ms_base = (uintptr_t)memsection_base(ms);
>      ms_size = memsection_size(ms);
>      assert (ms_base == ref_ms_base);
>      
>      result = memsection_virt_to_phys(ms_base, &size);
> 
>      printf("base:    0x%08lx, size:    0x%lx\n", (unsigned long)result, (unsigned long)size);
>      printf("ms_base: 0x%08lx, ms_size: 0x%lx\n", ms_base, ms_size);
> 
>      ptr = (uint32_t *)ms_base;
>      *ptr = 0xdeadbeef;
> 
>      printf("ptr: 0x%lx, *ptr: 0x%lx\n", (unsigned long)ptr, *ptr);
> }
> 
> ....
> int main (int argc, char **argv)
> {
> struct reg_struct etm, tpiu, meter, meter_ram;    
>     int res;
>         
>     /* map etm to register set location*/
>     etm.ms = memsection_create_user(0x1000, &etm.ms_base);
>     assert(etm.ms != 0);
>     res = hardware_back_memsection(etm.ms, 0x10132000, L4_IOMemory);
>     assert(res==0);
> 
>     L4_KDB_Enter("*");
>     
>     access_test(etm.ms, etm.ms_base);
> .....
> 
>        
> _______________________________________________
> Developer mailing list
> Developer at okl4.org
> https://lists.okl4.org/mailman/listinfo/developer


-- 




More information about the Developer mailing list