From: Jeff Dike <jdike@addtoit.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org,
user-mode-linux-devel@lists.sourceforge.net,
bstroesser@fujitsu-siemens.com
Subject: [uml-devel] [PATCH 8/16] UML - Code cleanup
Date: Mon, 07 Mar 2005 15:38:06 -0500 [thread overview]
Message-ID: <200503072038.j27Kc6bc003978@ccure.user-mode-linux.org> (raw)
From: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
Shifting register restore and userspace resume to the
beginning of the userspace loop, we can remove the
identical code done before the loop.
Signed-off-by: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Index: uml-i386/arch/um/kernel/skas/process.c
===================================================================
--- uml-i386.orig/arch/um/kernel/skas/process.c 2005-03-02 23:39:26.408483443 -0800
+++ uml-i386/arch/um/kernel/skas/process.c 2005-03-02 23:45:55.666136061 -0800
@@ -139,17 +139,20 @@
int err, status, op, pid = userspace_pid[0];
int local_using_sysemu; /*To prevent races if using_sysemu changes under us.*/
- restore_registers(pid, regs);
-
- local_using_sysemu = get_using_sysemu();
+ while(1){
+ restore_registers(pid, regs);
- op = local_using_sysemu ? PTRACE_SYSEMU : PTRACE_SYSCALL;
- err = ptrace(op, pid, 0, 0);
+ /* Now we set local_using_sysemu to be used for one loop */
+ local_using_sysemu = get_using_sysemu();
+
+ op = SELECT_PTRACE_OPERATION(local_using_sysemu, singlestepping(NULL));
+
+ err = ptrace(op, pid, 0, 0);
+ if(err)
+ panic("userspace - could not resume userspace process, "
+ "pid=%d, ptrace operation = %d, errno = %d\n",
+ op, errno);
- if(err)
- panic("userspace - PTRACE_%s failed, errno = %d\n",
- local_using_sysemu ? "SYSEMU" : "SYSCALL", errno);
- while(1){
CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));
if(err < 0)
panic("userspace - waitpid failed, errno = %d\n",
@@ -187,19 +190,6 @@
/* Avoid -ERESTARTSYS handling in host */
PT_SYSCALL_NR(regs->skas.regs) = -1;
}
-
- restore_registers(pid, regs);
-
- /*Now we ended the syscall, so re-read local_using_sysemu.*/
- local_using_sysemu = get_using_sysemu();
-
- op = SELECT_PTRACE_OPERATION(local_using_sysemu, singlestepping(NULL));
-
- err = ptrace(op, pid, 0, 0);
- if(err)
- panic("userspace - PTRACE_%s failed, "
- "errno = %d\n",
- local_using_sysemu ? "SYSEMU" : "SYSCALL", errno);
}
}
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
reply other threads:[~2005-03-07 19:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200503072038.j27Kc6bc003978@ccure.user-mode-linux.org \
--to=jdike@addtoit.com \
--cc=bstroesser@fujitsu-siemens.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox