qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Rabin Vincent <rabin.vincent@axis.com>
To: edgar.iglesias@gmail.com
Cc: rth@twiddle.net, qemu-devel@nongnu.org, Rabin Vincent <rabinv@axis.com>
Subject: [Qemu-devel] [PATCHv2 2/8] tests: cris: fix syscall inline asm
Date: Thu,  8 Sep 2016 13:38:56 +0200	[thread overview]
Message-ID: <1473334736-2775-1-git-send-email-rabin.vincent@axis.com> (raw)
In-Reply-To: <935a11f2-8f24-a7fb-a912-0dfc0fc36ee4@twiddle.net>

From: Rabin Vincent <rabinv@axis.com>

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 <rabinv@axis.com>
---
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

  reply	other threads:[~2016-09-08 11:39 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-05 11:54 [Qemu-devel] [PATCH 1/9] tests: cris: force inlining Rabin Vincent
2016-09-05 11:54 ` [Qemu-devel] [PATCH 2/9] tests: cris: fix syscall inline asm Rabin Vincent
2016-09-05 18:20   ` Richard Henderson
2016-09-08 11:38     ` Rabin Vincent [this message]
2016-09-08 16:10       ` [Qemu-devel] [PATCHv2 2/8] " Richard Henderson
2016-09-05 11:54 ` [Qemu-devel] [PATCH 3/9] tests: cris: remove openpf4 test Rabin Vincent
2016-09-12 22:51   ` Edgar E. Iglesias
2016-09-05 11:54 ` [Qemu-devel] [PATCH 4/9] tests: cris: remove check_time1 Rabin Vincent
2016-09-12 23:00   ` Edgar E. Iglesias
2016-09-05 11:54 ` [Qemu-devel] [PATCH 5/9] target-cris: sync CC state at load/stores Rabin Vincent
2016-09-05 19:02   ` Richard Henderson
2016-09-06 21:52     ` Edgar E. Iglesias
2016-09-05 11:54 ` [Qemu-devel] [PATCH 6/9] target-cris: reduce v32isms from v10 log dumps Rabin Vincent
2016-09-12 22:59   ` Edgar E. Iglesias
2016-09-14 12:48     ` Hans-Peter Nilsson
2016-09-26  7:06     ` Rabin Vincent
2016-09-05 11:54 ` [Qemu-devel] [PATCH 7/9] target-cris: ignore prefix insns in singlestep Rabin Vincent
2016-09-12 22:49   ` Edgar E. Iglesias
2016-09-14 13:32     ` Hans-Peter Nilsson
2016-09-05 11:54 ` [Qemu-devel] [PATCH 8/9] target-cris: add v17 CPU Rabin Vincent
2016-09-12 22:18   ` Edgar E. Iglesias
2016-09-26  7:17     ` Rabin Vincent
2016-09-28 10:42       ` Edgar E. Iglesias
2016-09-30 16:50         ` Rabin Vincent
2016-09-05 11:54 ` [Qemu-devel] [PATCH 9/9] tests: cris: add v17 ADDC test Rabin Vincent
2016-09-12 23:16   ` Edgar E. Iglesias
2016-09-06 21:53 ` [Qemu-devel] [PATCH 1/9] tests: cris: force inlining Edgar E. Iglesias
2016-09-08 11:41   ` Rabin Vincent
2016-09-08 18:06 ` Peter Maydell
2016-09-08 18:21   ` Eric Blake
2016-09-12  9:43   ` [Qemu-devel] [PATCHv2 1/8] " Rabin Vincent

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=1473334736-2775-1-git-send-email-rabin.vincent@axis.com \
    --to=rabin.vincent@axis.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rabinv@axis.com \
    --cc=rth@twiddle.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;
as well as URLs for NNTP newsgroup(s).