Skip to contentSkip to conversation

EIP and VMA

DISCUSSION Luca Falavigna 1 participant 1 message Mar 18, 2005

lore
Share & tools
lore
#0 lore raw

Hi,
I am working on this piece of code (simplified):

void ip_vma(struct task_struct *task, struct pt_regs *regs)

{
	struct mm_struct *mm;
	struct vm_area_struct *vma;

	if(task) {
		mm = get_task_mm(task);
		if(mm) {
			vma = find_vma(mm, regs->eip);
 			if(vma) {
				/* Some code */
			}
			else
				printk("WARNING: No VMA\n");
			mmput(mm);
		}
	}
}

I would like to get instruction pointer's VMA of a task. In order to do so, I use find_vma function, using regs->eip as instruction pointer value. Unfortunately I always get "WARNING: No VMA" message because find_vma isn't able to find the right VMA regs->eip address belongs to.
Is regs->eip the right place where istruction pointer is located or I should find that value elsewhere?

Thank you,

Luca