From: Frederic Beck Subject: Building Xen with structures thread_info/task_struct Date: Thu, 29 Jan 2009 14:45:20 +0100 Message-ID: <20090129144520.2c351361@hobbes.loria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.comxen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Hello I disabled fast system calls, and i'm willing to log the systems calls performed on a VM. In order to understand better what did cause each syscall, i'm trying to link them with the PID of the process that is responsible of the call. To do so i get the ESP register, apply the mask 0xFFFFF000 and so i get the base address for the thread_info structure that defines the calling process. The first member of this structure is a task_struct structure which contains the PID of this process. These two structure are not redefined in x86 implementation of Xen, but they are in ia64 (and of course i'm in x86). I tried to redefine them, but as they are quite big, it's not straightforward and i always end up with structure for which gcc cannot determine their size (many complex types embedded). I tried to use the kernel headers of Dom0 in which they are defined but i get some troubles. When i include asm/thread_info.h, i get the following error In file included from traps.c:70: /usr/src/linux/include/asm/thread_info.h:10: warning: =E2=80=98struct thread_info=E2=80=99 declared inside parameter list /usr/src/linux/include/asm/thread_info.h:10: warning: its scope is only this definition or declaration, which is probably not what you want /usr/src/linux/include/asm/thread_info.h:11: warning: =E2=80=98struct task_struct=E2=80=99 declared inside parameter list traps.c: In function =E2=80=98do_guest_trap=E2=80=99: traps.c:429: error: storage size of =E2=80= =98thread_info=E2=80=99 isn=E2=80=99t known traps.c:430: error: storage size of =E2=80=98task=E2=80= =99 isn=E2=80=99t known traps.c:475: error: invalid application of =E2=80=98sizeof=E2=80=99 to inco= mplete type =E2=80=98struct thread_info=E2=80=99 traps.c:476: error: invalid applicatio= n of =E2=80=98sizeof=E2=80=99 to incomplete type =E2=80=98struct task_struct=E2= =80=99=20 When i directly include the 32 bits version, asm/thread_info_32.h i don't have this scope problem anymore but gcc still is not able to determine the size of the structures traps.c: In function =E2=80=98do_guest_trap=E2=80=99: traps.c:431: error: storage size of =E2=80=98thread_info=E2=80=99 isn=E2=80= =99t known traps.c:432: error: storage size of =E2=80=98task=E2=80=99 isn=E2=80=99t kn= own traps.c:477: error: invalid application of =E2=80=98sizeof=E2=80=99 to inco= mplete type =E2=80=98struct thread_info=E2=80=99 traps.c:478: error: invalid applicatio= n of =E2=80=98sizeof=E2=80=99 to incomplete type =E2=80=98struct task_struct=E2= =80=99=20 I've never had such problems before, and getting out of ideas. Anyone has an idea/solution ? Thanks Regards Fred