[Top][All Lists]

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

Re: [Qemu-devel] arm return

From: Davide Ferraretto
Subject: Re: [Qemu-devel] arm return
Date: Fri, 01 Jun 2012 14:30:10 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

I'm in "arm user space" with "sigle step mode". I want write "exit\n" in linux shell (no QEMU monitor) when emulate code arrives to "return 0"

On 06/01/12 14:23, Max Filippov wrote:
On Fri, Jun 1, 2012 at 3:57 PM, Davide Ferraretto
<address@hidden>  wrote:
I tried to insert " printf("exit\n"); ", but qemu dosen't write to monitor.
printf should not write to monitor (if you mean QEMU monitor), it
should go to stdout.
I don't have ARM compiler set up ATM, but x86_64 with the following
patch does what I describe:

$ git diff
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 20d2a74..ccb71dc 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5052,6 +5052,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,

      switch(num) {
      case TARGET_NR_exit:
+        fprintf(stderr, "TARGET_NR_exit\n");
        /* In old applications this may be used to implement _exit(2).
           However in threaded applictions it is used for thread termination,
@@ -6833,6 +6834,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
  #ifdef __NR_exit_group
          /* new thread calls */
      case TARGET_NR_exit_group:
+        fprintf(stderr, "TARGET_NR_exit_group\n");

$ cat a.c
int main()
     printf("Hello, world\n");
     return 0;

$ gcc -static a.c -o a
$ qemu-all/root/bin/qemu-x86_64 ./a
Hello, world

On 06/01/12 13:43, Max Filippov wrote:
On Fri, Jun 1, 2012 at 3:16 PM, Davide Ferraretto
<address@hidden>    wrote:
In arm user mode, where does qemu exit? Where is last qemu's instruction?

int main (){return 0;}
in what file does qemu run "return 0"??
Simulated code reaches the point where libc calls 'exit' or 'exit_group'
and then QEMU goes to the do_syscall in the linux-user/syscall.c to
the process.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]