From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MCNR3-0000pK-1l for qemu-devel@nongnu.org; Thu, 04 Jun 2009 20:37:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MCNQy-0000mJ-Cl for qemu-devel@nongnu.org; Thu, 04 Jun 2009 20:37:28 -0400 Received: from [199.232.76.173] (port=48133 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MCMRj-00086n-G2 for qemu-devel@nongnu.org; Thu, 04 Jun 2009 19:34:07 -0400 Received: from mx20.gnu.org ([199.232.41.8]:36837) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MCI2m-0000Bn-RF for qemu-devel@nongnu.org; Thu, 04 Jun 2009 14:52:04 -0400 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MCI2l-0004Nh-PT for qemu-devel@nongnu.org; Thu, 04 Jun 2009 14:52:04 -0400 From: Nathan Froyd Date: Thu, 4 Jun 2009 11:51:55 -0700 Message-Id: <1244141522-21802-1-git-send-email-froydnj@codesourcery.com> Subject: [Qemu-devel] [PATCH 0/7] target-ppc/linux-user: NPTL support List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This patch series adds NPTL support in Linux user-mode emulation to 32-bit PowerPC targets. The main complication comes from implementing atomic instructions properly. We chose to implement a simplistic model: - reserved loads record the value loaded; - conditional stores check that the memory at the effective address contains the value loaded by the previous reserved load, in addition to all other checks. if so, the store succeeds; otherwise, it fails. It is possible to implement something more sophisticated using mprotect: - reserved loads write-protect the page from which the value is loaded; - regular stores to the page (through SIGSEGV handling) remove the write protection (which is roughly how the architecture really works); - conditional stores fail if the page was not write-protected, in addition to all other checks. If the store succeeds, then the page is unprotected. but the simple scheme works well enough and should be somewhat faster. The simple scheme is what's already done for system mode, too; it's even slightly dumber in system mode because we don't check for equality of values. The patch series has been tested against the glibc testsuite, where it passes a good chunk (90%+) of the testsuite. The other 10% are basically things that are not going to work in QEMU anytime soon (e.g. sharing futexes between multiple processes, using clone(2) directly, etc.). I should note that proper testing requires a patch to use a correct exit status for uncaught signals; such a patch has been posted to this list before by Riku Voipio. (I have a different local version that I used instead.) Testing with recent glibc also requires adding support for private futexes and a few other futex operations; again, a patch for this has been posted by Riku and I used a slightly different local version. -Nathan Nathan Froyd (7): linux-user: initialize mmap_mutex properly target-ppc: fix cpu_clone_regs target-ppc: add cpu_set_tls target-ppc: retain l{w,d}arx loaded value target-ppc: add exceptions for conditional stores linux-user: handle POWERPC_EXCP_STCX enable NPTL for ppc-linux-user targets in configure configure | 2 + linux-user/main.c | 68 ++++++++++++++++++++++++++++++++++++++ linux-user/mmap.c | 2 +- target-ppc/cpu.h | 24 +++++++++++-- target-ppc/helper.c | 2 +- target-ppc/machine.c | 4 +- target-ppc/op_helper.c | 4 +- target-ppc/translate.c | 84 ++++++++++++++++++++++++++++++++++-------------- 8 files changed, 156 insertions(+), 34 deletions(-)