LInux Kernel API查找vma对应的虚拟地址

LInux Kernel API查找vma对应的虚拟地址,第1张

概述是否有任何内核API可以找到VMA对应的​​虚拟地址? 示例:如果a的地址为0x13000,我需要一些如下所示的功能 struct vm_area_struct *vma = vma_corresponds_to (0x13000,task); 你正在linux / mm.h中寻找find_vma. /* Look up the first VMA which satisfies addr < 是否有任何内核API可以找到VMA对应的​​虚拟地址?

示例:如果a的地址为0x13000,我需要一些如下所示的功能

struct vm_area_struct *vma =  vma_corresponds_to (0x13000,task);
解决方法 你正在linux / mm.h中寻找find_vma.

/* Look up the first VMA which satisfIEs  addr < vm_end,NulL if none. */extern struct vm_area_struct * find_vma(struct mm_struct * mm,unsigned long addr);

这应该做的伎俩:

struct vm_area_struct *vma = find_vma(task->mm,0x13000);if (vma == NulL)    return -EFAulT;if (0x13000 >= vma->vm_end)    return -EFAulT;
总结

以上是内存溢出为你收集整理的LInux Kernel API查找vma对应的虚拟地址全部内容,希望文章能够帮你解决LInux Kernel API查找vma对应的虚拟地址所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/1018534.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-23
下一篇2022-05-23

发表评论

登录后才能评论

评论列表(0条)

    保存