[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Get the pid of a process from hypervisor


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Carlo Maiero <zesster@xxxxxxxxx>
  • Date: Thu, 11 Nov 2010 18:51:02 +0100
  • Delivery-date: Thu, 11 Nov 2010 09:52:01 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=iYnOFuHAoKObPQD6jtmpqF9cVft2l9wUNM0LnT+DolJeB2Whlwr186H/I0mzyIDU5H 0Rp9X6QqzZQkfMDNs2FH6X6eURHYgRc5jpKD9FHD1EHUrGsNEsJkSaTS043GejBWaNJA mm/qfIXoROcfn//GKfRWbsUCjIyxHa9R4Ak7s=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

Hi,
how can i get the pid of a systemcall from do_guest_trap in traps.c?
I tried with this code put in do_guest_trap:

   uint32_t pid;
   uint32_t thread_info_address;
   uint32_t task_struct_addr;
   int pid_offset=268; // i got this number using the module in xenaccess
  unsigned_long *tmp;
 
//I start getting the address of the thread:

   thread_info_address= v->arch.guest_context.kernel_sp & 0xFFFFE000;

//then i get the struct of the task

   tmp=(unsigned long*)(thread_info_addr);
   get_user(task_struct_addr,tmp);

//finally i get pid:

  tmp =(unsigned long*)(task_struct_addr + pid_offset);
  get_user(pid,tmp);

  printk("pid %d",pid);



What is wrong in the code?

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.