Received: from eggs.gnu.org ([140.186.70.92]:38320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLfVk-0001ZS-GZ for qemu-devel@nongnu.org; Wed, 02 Nov 2011 14:26:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RLfVg-0001pu-Bt for qemu-devel@nongnu.org; Wed, 02 Nov 2011 14:26:04 -0400 Received: from mail-ww0-f53.google.com ([74.125.82.53]:44043) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLfVg-0001pZ-6K for qemu-devel@nongnu.org; Wed, 02 Nov 2011 14:26:00 -0400 Received: by wwg7 with SMTP id 7so631283wwg.10 for ; Wed, 02 Nov 2011 11:25:58 -0700 (PDT) From: Ricardo Alves Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Wed, 2 Nov 2011 18:25:52 +0000 Message-Id: Mime-Version: 1.0 (Apple Message framework v1084) Subject: [Qemu-devel] Catching system calls and PIDs in Qemu List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Need Help! I am editing the Qemu source code to be able to catch every system call = made by the guest OS and which processes do those system calls. I catch the system calls in the "void do_interrupt(CPUState *env1)" = (op_helper.c) function by accessing the exception index on the cpu = environment (env->exception_index =3D=3D 0x80) and inspecting the system = call ID in the eax register. The difficulty resides in finding the process that made the system call. = Linux uses the thread_info struct to store process information. The = method to find this struct location is to apply a mask to the esp = register and I would get the struct pointer. In qemu I would just do = this -- target_ulong pos =3D env->regs[R_ESP] & 0xFFFFE000. The problem is that I don't know how to access the guest main memory. = The qemu function I found to access memory was this one -- void = cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,int len, = int is_write) (exec.c). But as far as I know (I could be wrong) this = function receives a guest physical adress and the one I have is a guest = virtual adress. Can anybody help me convert this guest virtual adress to = a guest physical adress? Thank you.