From patchwork Fri Aug 15 11:01:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 35452 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4F7B1203C5 for ; Fri, 15 Aug 2014 11:16:24 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id w10sf16502528pde.11 for ; Fri, 15 Aug 2014 04:16:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=Mb0NKT8juJ6nvSFQGYc63j3ofxwiEfl9nNu9IMPF2P4=; b=TGgFCJZdO9zx2xqvlrb9VHoEIzY8KUEpojH2q1bhk9+5faSpCvBGcjqVtb9S3EQKRA 5eAV5Oul2yXnKKhrp8NF3aWDawjmS1rCcNFiOnvbYlwQTQJ8y0Jx/aXYYOFp8Gh+Vuc1 I7lvdIGCm+xg7CF+jFgiRgSON7hCD9NoADSNBeTGwbcvTlWK7ud+r4FmyhQWdj6noHju YngfD+u4Sd+sxLHycmpFt3aHGHR/QwtOZ+fYnttvUqIsOc6llBUWHhP0cunsmdEfXyFY YI4aWQrDkomX2rEut+ar767hEpzRlu5j42vS8w/DhKLsJsfOUdLPQzOFdQjtWCvi1eMg qscQ== X-Gm-Message-State: ALoCoQmoU74x7T5UKPlelT9Q1762pjVzsmb7+1LZ7gGsp3m33DttUZmxY5RZWH84zLvpm2M08khq X-Received: by 10.66.66.170 with SMTP id g10mr7120814pat.12.1408101379684; Fri, 15 Aug 2014 04:16:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.21.84 with SMTP id 78ls1323234qgk.79.gmail; Fri, 15 Aug 2014 04:16:19 -0700 (PDT) X-Received: by 10.140.84.138 with SMTP id l10mr24858880qgd.51.1408101379375; Fri, 15 Aug 2014 04:16:19 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id 3si11367345qap.77.2014.08.15.04.16.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Aug 2014 04:16:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id hy4so2721965vcb.8 for ; Fri, 15 Aug 2014 04:16:19 -0700 (PDT) X-Received: by 10.52.28.40 with SMTP id y8mr329620vdg.60.1408101379172; Fri, 15 Aug 2014 04:16:19 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp104766vcb; Fri, 15 Aug 2014 04:16:18 -0700 (PDT) X-Received: by 10.224.151.69 with SMTP id b5mr26846632qaw.37.1408101378271; Fri, 15 Aug 2014 04:16:18 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 66si11358412qgg.107.2014.08.15.04.16.18 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 15 Aug 2014 04:16:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:58715 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIFUX-0003I4-QV for patch@linaro.org; Fri, 15 Aug 2014 07:16:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIFGh-0004xW-K5 for qemu-devel@nongnu.org; Fri, 15 Aug 2014 07:02:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XIFGV-00073J-53 for qemu-devel@nongnu.org; Fri, 15 Aug 2014 07:01:59 -0400 Received: from [2001:4b98:dc0:45:216:3eff:fe3d:166f] (port=44490 helo=afflict.kos.to) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIFGU-00071G-VB for qemu-devel@nongnu.org; Fri, 15 Aug 2014 07:01:47 -0400 Received: from afflict.kos.to (afflict [92.243.29.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 641702668F; Fri, 15 Aug 2014 13:01:45 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 15 Aug 2014 14:01:39 +0300 Message-Id: X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2001:4b98:dc0:45:216:3eff:fe3d:166f Cc: Peter Maydell , Tom Musta Subject: [Qemu-devel] [PULL 21/24] linux-user: clock_nanosleep errno Handling on PPC X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Tom Musta The clock_nanosleep syscall is unusual in that it returns positive numbers in error handling situations, versus returning -1 and setting errno, or returning a negative errno value. On POWER, the kernel will set the SO bit of CR0 to indicate failure in a syscall. QEMU has generic handling to do this for syscalls with standard return values. Add special case code for clock_nanosleep to handle CR0 properly. Signed-off-by: Tom Musta Reviewed-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/syscall.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index a24356d..e4be32c 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9103,6 +9103,14 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, ret = get_errno(clock_nanosleep(arg1, arg2, &ts, arg4 ? &ts : NULL)); if (arg4) host_to_target_timespec(arg4, &ts); + +#if defined(TARGET_PPC) + /* clock_nanosleep is odd in that it returns positive errno values. + * On PPC, CR0 bit 3 should be set in such a situation. */ + if (ret) { + ((CPUPPCState *)cpu_env)->crf[0] |= 1; + } +#endif break; } #endif