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 From: Rabin Vincent Date: Thu, 8 Sep 2016 13:38:56 +0200 Message-Id: <1473334736-2775-1-git-send-email-rabin.vincent@axis.com> In-Reply-To: <935a11f2-8f24-a7fb-a912-0dfc0fc36ee4@twiddle.net> References: <935a11f2-8f24-a7fb-a912-0dfc0fc36ee4@twiddle.net> Subject: [Qemu-devel] [PATCHv2 2/8] tests: cris: fix syscall inline asm List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: edgar.iglesias@gmail.com Cc: rth@twiddle.net, qemu-devel@nongnu.org, Rabin Vincent 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 --- 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; } -- 2.1.4