tests: cris: fix syscall inline asm

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.

Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Rabin Vincent <rabinv@axis.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
This commit is contained in:
Rabin Vincent 2016-08-24 09:08:21 +02:00 committed by Edgar E. Iglesias
parent 21ce148c7e
commit f278d5cbe5

View File

@ -33,19 +33,27 @@ void *memset (void *s, int c, size_t n) {
} }
void exit (int status) { void exit (int status) {
asm volatile ("moveq 1, $r9\n" /* NR_exit. */ register unsigned int callno asm ("r9") = 1; /* NR_exit */
"break 13\n");
asm volatile ("break 13\n"
:
: "r" (callno)
: "memory" );
while(1) while(1)
; ;
} }
ssize_t write (int fd, const void *buf, size_t count) { ssize_t write (int fd, const void *buf, size_t count) {
int r; register unsigned int callno asm ("r9") = 4; /* NR_write */
asm ("move.d %0, $r10\n" register unsigned int r10 asm ("r10") = fd;
"move.d %1, $r11\n" register const void *r11 asm ("r11") = buf;
"move.d %2, $r12\n" register size_t r12 asm ("r12") = count;
"moveq 4, $r9\n" /* NR_write. */ register unsigned int r asm ("r10");
"break 13\n" : : "r" (fd), "r" (buf), "r" (count) : "memory");
asm ("move.d $r10, %0\n" : "=r" (r)); asm volatile ("break 13\n"
: "=r" (r)
: "r" (callno), "0" (r10), "r" (r11), "r" (r12)
: "memory");
return r; return r;
} }