lkml.org 
[lkml]   [2005]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Accessing file mapped data inside the kernel
Date
From

On Wed, 9 Nov 2005, Paulo da Silva wrote:

> Hi.
>
> I posted about this a few days ago but got no responses
> so far! I think this should be a trivial question for those
> involved in the kernel internals. May be I didn't develop
> the problem enough to be understood.
>
> So, here is the question reformulated.
>
> A given file system must supply a procedure for mmap.
>
> int <fsname>_file_mmap(struct file * file, struct vm_area_struct * vma)
> {
> int addr;
> addr=generic_file_mmap(file,vma);
> <Code to access addr pointed bytes or vma->vm_start>
> return addr;
> }
>

The mmap() code in the kernel in your module contains the physical
location of the memory-mapped data as the third parameter to
remap_pfn_range(a, b, c, d, e);
|____________ here.

Your code should have put the bus address of your memory
into that location as PAGES, which means you shifted it right
by PAGE_SHIFT. If you got your memory from get_dma_pages()
or similar, you needed to convert the virtual address using
virt_to_bus() so you already have the virtual address. If
not, you need to get the virtual address by taking this
page address and shifting it left by PAGE_SHIFT. Then you
convert that address to virtual using bus_to_virt().

[SNIPPED...]


Cheers,
Dick Johnson
Penguin : Linux version 2.6.13.4 on an i686 machine (5589.55 BogoMips).
Warning : 98.36% of all statistics are fiction.
.

****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-11-09 21:48    [W:0.064 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site