From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ncjev-0003HU-HY for qemu-devel@nongnu.org; Wed, 03 Feb 2010 13:09:01 -0500 Received: from [199.232.76.173] (port=46300 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ncjeu-0003Ga-M3 for qemu-devel@nongnu.org; Wed, 03 Feb 2010 13:09:00 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Ncjeu-0006RJ-29 for qemu-devel@nongnu.org; Wed, 03 Feb 2010 13:09:00 -0500 Received: from mail-px0-f189.google.com ([209.85.216.189]:43054) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ncjet-0006R3-F6 for qemu-devel@nongnu.org; Wed, 03 Feb 2010 13:08:59 -0500 Received: by pxi27 with SMTP id 27so1583446pxi.4 for ; Wed, 03 Feb 2010 10:08:58 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <2e320c2d1002031003i36bc3848hbb4b030a6dfd4156@mail.gmail.com> References: <2e320c2d1002031003i36bc3848hbb4b030a6dfd4156@mail.gmail.com> Date: Wed, 3 Feb 2010 11:08:58 -0700 Message-ID: <2e320c2d1002031008y7a01880ay7d17d419b38fb089@mail.gmail.com> From: Jong Chun Park Content-Type: multipart/alternative; boundary=0050450294ebbed5ce047eb61c24 Subject: [Qemu-devel] [Please discard the previous mail] System call from a Guest Linux List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --0050450294ebbed5ce047eb61c24 Content-Type: text/plain; charset=ISO-8859-1 Hi, all? First of all, I apologize you for the previous incomplete mail and this spam. I'm working with QEMU v0.12.1 with i386 Linux guest on x86-64 Linux host. I'm trying to find a point in the source code where a system call from the guest OS is handled. If I'm not mistaken, QEMU disassembles an instruction of INT # in a switch statement of target-i386/translate.c and then calls helper_sysenter of target-i386/op_helper.c. The problem is how to tell difference between a system call of the guest OS and a system call of QEMU (I'm not sure of this, though). Assume the following code is executed after compilation in the guest OS: int main() { int fd; if (access("hello.txt", R_OK) != 0) { exit(0); } fd=open("hello.txt", O_RDONLY); close(fd); return 0; } For this simple sequence of system calls, acess() -> open() -> close(), QEMU goes through disas_insn() and helper_sysenter() more than 3 times. This makes me really confused because I believed those should be called 3 times, though. It'd be greatly appreciated in advance if someone helps me out this. Thanks a lot, Jong --0050450294ebbed5ce047eb61c24 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi, all?

First of = all, I apologize you for the previous incomplete mail and this spam.=A0=A0I= 'm working with QEMU v0.12.1 with i386 Linux guest on x86-64 Linux host= . I'm trying to find a point in the source code where a system call fro= m the guest OS is handled. If I'm not mistaken, QEMU disassembles an in= struction of INT # in a switch statement of target-i386/translate.c and the= n calls helper_sysenter of target-i386/op_helper.c. The problem is how to t= ell difference between a system call of the guest OS and a system call of Q= EMU (I'm not sure of this, though). Assume the following code is execut= ed after compilation in the guest OS:

int main() {
=A0=A0 int fd;
=A0=A0 = if (access("hello.txt", R_OK) !=3D 0) {
=A0=A0 =A0 exit= (0);
=A0=A0 }
=A0=A0 fd=3Dopen("hello.txt", O= _RDONLY);
=A0=A0 close(fd);
=A0=A0 return 0;
}
=A0
For this simple s= equence of system calls, acess() -> open() -> close(), QEMU goes thro= ugh disas_insn() and helper_sysenter() more than 3 times. This makes me rea= lly confused because I believed those should be called 3 times, though. It&= #39;d be greatly appreciated in advance if someone helps me out this.

Thanks a lot,
Jong
--0050450294ebbed5ce047eb61c24--