Find the answer to your Linux question:
Results 1 to 9 of 9
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Writing into user memory

    I'm writing a custom serial port char driver, and I'm still not quite sure how to implement one of the extra features I need.

    The driver has to be able to read a certain amount of bytes from the serial port and store them in a file in user-space memory. This must be done on an interrupt routine, and not requested by a user process. The device then functions as a normal char driver, and lets user processes access it through a device. I can think of several hacky ways that this could probably be done, but I think I'm probably missing out on a standard procedure that would be the most efficient way.

    Does anyone have any suggestions on the best way to implement the write to user-space memory? I can figure out the rest easily enough myself (ie. the hardware control, driver states, interrupts, etc.)

  2. #2
    alternatively - Is there a way that my driver could just alert a perpetually-running user process to handle the read, and only allow access to that process for the first little while?
    Would this be better or worse...?

  3. #3
    how about copy_from_user and copy_to_user function use ?!!

  4. $spacer_open
  5. #4
    ...never use copy_from_user and copy_to_user in interrupt context

  6. #5
    yeah, because can it sleep ! we do not use it in the inteupt handler but we can use it in driver, isnt it ?

  7. #6
    ... approved

  8. #7
    Hi ndlevel,
    can you please reply to the thread created by me named "kernel address space" ?
    if possible.

  9. #8
    Use softirq/tasklet, and in the bottom half, do the copy_to_user.

  10. #9
    and how about get_user_pages !! ?

Posting Permissions

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