仮想アドレスに対応する VMA を見つけるためのカーネル API はありますか?
例:アドレスが0x13000の場合、以下のような関数が必要です
struct vm_area_struct *vma = vma_corresponds_to (0x13000,task);
仮想アドレスに対応する VMA を見つけるためのカーネル API はありますか?
例:アドレスが0x13000の場合、以下のような関数が必要です
struct vm_area_struct *vma = vma_corresponds_to (0x13000,task);
find_vma
でを探していますlinux/mm.h
。
/* 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;