Find the answer to your Linux question:
Results 1 to 6 of 6
Hi all, I have a very basic question, please help Can anyone direct me the code example of mapping allocated memory at the Kernel to user space (using dma_malloc_* or ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2008
    Posts
    7

    Map allocated kernel memory to user space


    Hi all,
    I have a very basic question, please help

    Can anyone direct me the code example of mapping allocated memory at the Kernel to user space (using dma_malloc_* or even kmalloc)

    Best regards
    Dudi

  2. #2
    Just Joined!
    Join Date
    Jan 2009
    Location
    Bangalore
    Posts
    15

    Map allocated kernel memory to user space

    Hi,


    you can use copy_to_user from kernel to user
    or copy_from_user from user to kernel

  3. #3
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    Try this link:

    Linux-Kernel: dmaable memory in user space

    Is this what your after?

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Oct 2008
    Posts
    7
    Thank you, gerard4143.
    actually it answer partly to my question (the code at the link is a question by itself and has a bug) I need a code which is working the way that allocating coherent of dma'ble memory is done at the kernel and mmap to user space with no bugs. (the user space is only ask for the amout of the memory by bytes and the kernel allocate it inside the kernel)

  6. #5
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    So your trying to allocate kernel memory and have it available to user processes by mapping it into the user process...i.e. your trying to share memory freely between the kernel and user processes...is this close to what you want...Gerard4143

  7. #6
    Just Joined!
    Join Date
    Oct 2008
    Posts
    7
    Hi gerard4143,

    That's right I'm trying to get COHERENT physical memory allocated at the Kernel since the hardware I use need it. Yet it is not important to me to share is not important, I only run on user space process to access this memory

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •