Find the answer to your Linux question:
Results 1 to 3 of 3
Hello, I have been trying to write a driver to bee able to read and write to any memory address given by the user. I suspected that I was going ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2010
    Posts
    1

    writting driver


    Hello, I have been trying to write a driver to bee able to read and write to any memory address given by the user. I suspected that I was going to have some problems because of memory violation issues and it turns out I was right....

    When I try to access address B8002050 for example I get "Unable to handle kernel paging request at virtual address b8002050".....

    Isn't there any way to do this whitout getting errors? I though I could access any memory address using a driver as it is executing as root and has the maximum priority level in the CPU....

    The reason I am trying to do this is to check some configuration registers directly, as I am working on an embedded system which is having some issues....

    Any ideas on how to do this?

    Thanks a lot

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,380
    Although the kernel runs in physical memory, there are still rules to follow in order to utilize some specific physical address. In userland, Linux does not allow direct access to physical ram, unless it is mapped first to a virtual address. In fact, you can do that in a user application with the mmap() function. You really do not need a kernel driver. Anyway, you might want to read this first: http://tldp.org/LDP/tlk/mm/memory.html, which is part of this document: The Linux Kernel
    Last edited by Rubberman; 11-11-2011 at 05:32 PM.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Banned
    Join Date
    Nov 2011
    Posts
    13
    All address below PAGE_OFFSET (0xC0000000 in 32bit x86) are user space (not true for ARM). To access this region within kernel, you must use copy_to_user/copy_from_user functions.

    Quote Originally Posted by albert-mcfly View Post
    Hello, I have been trying to write a driver to bee able to read and write to any memory address given by the user. I suspected that I was going to have some problems because of memory violation issues and it turns out I was right....

    When I try to access address B8002050 for example I get "Unable to handle kernel paging request at virtual address b8002050".....

    Isn't there any way to do this whitout getting errors? I though I could access any memory address using a driver as it is executing as root and has the maximum priority level in the CPU....

    The reason I am trying to do this is to check some configuration registers directly, as I am working on an embedded system which is having some issues....

    Any ideas on how to do this?

    Thanks a lot
    Last edited by oz; 11-26-2011 at 12:35 PM. Reason: spam removal

Posting Permissions

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