L4Linux and mmap

Adam Lackorzynski adam at os.inf.tu-dresden.de
Wed Aug 3 23:04:25 CEST 2011


On Wed Aug 03, 2011 at 16:17:04 +0400, Vasily Sartakov wrote:
> I try to use a mmap for communicate userspace application and other
> servers via kernel character driver. and its doesn't work. but, of
> course its work in native linux.
> my mmap call return no error, but when i try acces to memmory via
> returned pointer, i got seg fault
> 
> Here is driver source and example program, based on mmap example:
> any of vmalloc or kalloc got seg fault:
> 
> mmap ok, vaddr = 40034000
> Segmentation fault

Which memory access is it? I do not see corresponding printf.

>         /* map the whole physically contiguous area in one piece */
>         if ((ret = remap_pfn_range(vma,
>                                    vma->vm_start,
>                                    virt_to_phys((void *)kmalloc_area)
> >> PAGE_SHIFT,
>                                    length,
>                                    vma->vm_page_prot)) < 0) {
>                 return ret;
>         }

virt_to_phys is probably not a good choice. On native, __pa and
virt_to_phys indeed do the same but on L4Linux virt_to_phys does what
the name says and __pa does what you probably want here.
And shouldn't kmalloc memory be always contiguous?



Adam
-- 
Adam                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/




More information about the l4-hackers mailing list