5

仮想アドレスに対応する VMA を見つけるためのカーネル API はありますか?

例:アドレスが0x13000の場合、以下のような関数が必要です

 struct vm_area_struct *vma =  vma_corresponds_to (0x13000,task);
4

2 に答える 2

6

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;
于 2012-09-12T15:30:25.697 に答える