From patchwork Thu Sep 8 11:38:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rabin Vincent X-Patchwork-Id: 9321801 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4A5A060752 for ; Thu, 8 Sep 2016 16:50:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FE53298A6 for ; Thu, 8 Sep 2016 16:50:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34E98298DE; Thu, 8 Sep 2016 16:50:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6AC3A298A6 for ; Thu, 8 Sep 2016 16:50:18 +0000 (UTC) Received: from localhost ([::1]:49285 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi2Wm-0005VP-T9 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 08 Sep 2016 12:50:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhxfl-0000MW-Gs for qemu-devel@nongnu.org; Thu, 08 Sep 2016 07:39:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhxff-0008PT-K3 for qemu-devel@nongnu.org; Thu, 08 Sep 2016 07:39:13 -0400 Received: from bes.se.axis.com ([195.60.68.10]:34250) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhxff-0008Oq-Dg for qemu-devel@nongnu.org; Thu, 08 Sep 2016 07:39:07 -0400 Received: from localhost (localhost [127.0.0.1]) by bes.se.axis.com (Postfix) with ESMTP id D9BA62E2FF; Thu, 8 Sep 2016 13:39:03 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bes.se.axis.com Received: from bes.se.axis.com ([IPv6:::ffff:127.0.0.1]) by localhost (bes.se.axis.com [::ffff:127.0.0.1]) (amavisd-new, port 10024) with LMTP id R3vPwzQsER6X; Thu, 8 Sep 2016 13:39:03 +0200 (CEST) Received: from boulder.se.axis.com (boulder.se.axis.com [10.0.2.104]) by bes.se.axis.com (Postfix) with ESMTP id CA7BE2E2C5; Thu, 8 Sep 2016 13:39:02 +0200 (CEST) Received: from boulder.se.axis.com (localhost [127.0.0.1]) by postfix.imss71 (Postfix) with ESMTP id B40321AD9; Thu, 8 Sep 2016 13:39:02 +0200 (CEST) Received: from thoth.se.axis.com (thoth.se.axis.com [10.0.2.173]) by boulder.se.axis.com (Postfix) with ESMTP id A8EC81A36; Thu, 8 Sep 2016 13:39:02 +0200 (CEST) Received: from lnxartpec.se.axis.com (lnxartpec.se.axis.com [10.88.4.9]) by thoth.se.axis.com (Postfix) with ESMTP id A745B308; Thu, 8 Sep 2016 13:39:02 +0200 (CEST) Received: by lnxartpec.se.axis.com (Postfix, from userid 10564) id 9D6C68167D; Thu, 8 Sep 2016 13:39:02 +0200 (CEST) From: Rabin Vincent To: edgar.iglesias@gmail.com Date: Thu, 8 Sep 2016 13:38:56 +0200 Message-Id: <1473334736-2775-1-git-send-email-rabin.vincent@axis.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <935a11f2-8f24-a7fb-a912-0dfc0fc36ee4@twiddle.net> References: <935a11f2-8f24-a7fb-a912-0dfc0fc36ee4@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 195.60.68.10 Subject: [Qemu-devel] [PATCHv2 2/8] tests: cris: fix syscall inline asm X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Rabin Vincent , rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Rabin Vincent Add the appropriate register constraints for the inline asm for the write and exit system calls. Without the correct constraints for the write() function, correct failure messages are not printed succesfully on newer version of GCC. Signed-off-by: Rabin Vincent Reviewed-by: Richard Henderson --- v2: reworked to set up arguments correctly tests/tcg/cris/sys.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/tests/tcg/cris/sys.c b/tests/tcg/cris/sys.c index 551c5dd..21f08c0 100644 --- a/tests/tcg/cris/sys.c +++ b/tests/tcg/cris/sys.c @@ -33,19 +33,27 @@ void *memset (void *s, int c, size_t n) { } void exit (int status) { - asm volatile ("moveq 1, $r9\n" /* NR_exit. */ - "break 13\n"); + register unsigned int callno asm ("r9") = 1; /* NR_exit */ + + asm volatile ("break 13\n" + : + : "r" (callno) + : "memory" ); while(1) ; } ssize_t write (int fd, const void *buf, size_t count) { - int r; - asm ("move.d %0, $r10\n" - "move.d %1, $r11\n" - "move.d %2, $r12\n" - "moveq 4, $r9\n" /* NR_write. */ - "break 13\n" : : "r" (fd), "r" (buf), "r" (count) : "memory"); - asm ("move.d $r10, %0\n" : "=r" (r)); + register unsigned int callno asm ("r9") = 4; /* NR_write */ + register unsigned int r10 asm ("r10") = fd; + register const void *r11 asm ("r11") = buf; + register size_t r12 asm ("r12") = count; + register unsigned int r asm ("r10"); + + asm volatile ("break 13\n" + : "=r" (r) + : "r" (callno), "0" (r10), "r" (r11), "r" (r12) + : "memory"); + return r; }