如何在线程(用户空间到内核thread1到内核线程2)之间传递缓冲区地址? [英] How to pass buffer address in between threads (user space to kernel thread1 to kernel thread 2)?

查看:57
本文介绍了如何在线程(用户空间到内核thread1到内核线程2)之间传递缓冲区地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的设置:


我将数据从用户空间应用程序通过IOCTL传递到内核驱动程序(DLL)。 


这个驱动程序有多个线程。


当内核驱动程序收到IOCTL时,我将它传递给第一个线程。


我使用CEOpenCallerBuffer在第一个线程中正确地转换地址。


现在这是我的问题,我想将数组地址传递给驱动程序中的另一个线程。


但是当它到达那里时,它无法读取正确的数据。


如果我先在第一个线程中复制数组并将其复制到那里并且只是将内核分配的内存传递给另一个线程。但是,由于可能的碎片,我不喜欢这个。有什么想法吗?

解决方案

还有另一种方法可以在用户应用程序和内核驱动程序之间共享地址。看到这个博客。


http://vinoth-vinothblog.blogspot.in/2008/11/sharing-blocks-of-memory-between-kernel.html


Here's my set-up:

I pass an array from a User Space Application via IOCTL to a kernel driver (DLL). 

This driver have multiple threads.

The moment the kernel driver receives the IOCTL, I pass it to the first thread.

I use CEOpenCallerBuffer to translate the address correctly inside the first thread.

Now here's my problem, I wanted to pass the array address to another thread in the driver.

But when it gets there, it was unable to read correct data.

This is somehow gets fixed if I copy the array first in the first thread and copy it there and just pass the kernel allocated memory to the other thread. However, I don't prefer this due to possible fragmentation. Any thoughts?

解决方案

There is an another method that you can share the address between user application and kernel driver. see this blog.

http://vinoth-vinothblog.blogspot.in/2008/11/sharing-blocks-of-memory-between-kernel.html


这篇关于如何在线程(用户空间到内核thread1到内核线程2)之间传递缓冲区地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆