* [Qemu-devel] System call from a Guest Linux
@ 2010-02-03 18:03 Jong Chun Park
2010-02-03 18:08 ` [Qemu-devel] [Please discard the previous mail] " Jong Chun Park
0 siblings, 1 reply; 3+ messages in thread
From: Jong Chun Park @ 2010-02-03 18:03 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 655 bytes --]
Hi, all?
First of all, I apologize you for 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() {
if (access("hello.txt", R_OK)!=0) {
[-- Attachment #2: Type: text/html, Size: 759 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [Please discard the previous mail] System call from a Guest Linux
2010-02-03 18:03 [Qemu-devel] System call from a Guest Linux Jong Chun Park
@ 2010-02-03 18:08 ` Jong Chun Park
2010-02-03 19:25 ` Mulyadi Santosa
0 siblings, 1 reply; 3+ messages in thread
From: Jong Chun Park @ 2010-02-03 18:08 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1109 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 1387 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [Please discard the previous mail] System call from a Guest Linux
2010-02-03 18:08 ` [Qemu-devel] [Please discard the previous mail] " Jong Chun Park
@ 2010-02-03 19:25 ` Mulyadi Santosa
0 siblings, 0 replies; 3+ messages in thread
From: Mulyadi Santosa @ 2010-02-03 19:25 UTC (permalink / raw)
To: Jong Chun Park; +Cc: qemu-devel
Hi Jong
(Sorry, I am not sure how to politely call a Korean name...so
apologize if it turns out to be rude...)
On Thu, Feb 4, 2010 at 1:08 AM, Jong Chun Park <joumon@gmail.com> wrote:
> 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
Try to run that compile and run that code under strace (without using
Qemu, I mean), then you'll understand how many system calls are
executed.
clues: opening certain libraries, doing mmap() s and so on
--
regards,
Mulyadi Santosa
Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-02-03 19:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-03 18:03 [Qemu-devel] System call from a Guest Linux Jong Chun Park
2010-02-03 18:08 ` [Qemu-devel] [Please discard the previous mail] " Jong Chun Park
2010-02-03 19:25 ` Mulyadi Santosa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).