在Linux设备驱动程序中使用do_mmap()
我们现在工作的设备需要有一个用户空间虚拟内存地址,我们尝试使用 do_mmap() 如下:
*uvaddr = (void *)do_mmap(0, 0, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS, 0);
但我们得到以下错误
Unable to handle kernel paging request for data at ad8
Is it OK to use "do_mmap()" in a device driver?如果没有,有什么正确的方法吗?
The device we work at now need to have a user space virtual memory address, we try to use do_mmap() as below:
*uvaddr = (void *)do_mmap(0, 0, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS, 0);
But we got following error
Unable to handle kernel paging request for data at ad8
Is it okay to use "do_mmap()" in a device driver? If not, any correct way to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
do_mmap
可能成功,但uvaddr
未指向存储结果的有效位置。要确定这一点,请执行以下操作:这应该确定哪个失败:对
do_mmap
的调用或对*uvaddr
的赋值。It's possible that
do_mmap
is succeeding, butuvaddr
does not point to a valid location to store the result. To check this for sure, do something like:This should tell you for certain which is failing: the call to
do_mmap
or the assignment to*uvaddr
.