diff options
author | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-10-08 13:32:20 +0000 |
---|---|---|
committer | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-10-08 13:32:20 +0000 |
commit | dd43edf4e136bff05cbbb6b42b96c024c591dbb9 (patch) | |
tree | d1f03b9c92753846ba462c5a1583af5106333d58 /tests/cris/sys.c | |
parent | 83fa1010ae342c5ad0392182fcdcce438c71b163 (diff) |
CRIS testsuite, based on the SIM testsuite, by Edgar E. Iglesias.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3365 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'tests/cris/sys.c')
-rw-r--r-- | tests/cris/sys.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/cris/sys.c b/tests/cris/sys.c new file mode 100644 index 0000000000..264ec06f3e --- /dev/null +++ b/tests/cris/sys.c @@ -0,0 +1,48 @@ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +static inline int mystrlen(char *s) { + int i = 0; + while (s[i]) + i++; + return i; +} + +void pass(void) { + char s[] = "passed.\n"; + write (1, s, sizeof (s) - 1); + exit (0); +} + +void _fail(char *reason) { + char s[] = "failed: "; + int len = mystrlen(reason); + write (1, s, sizeof (s) - 1); + write (1, reason, len); + write (1, "\n", 1); +// exit (1); +} + +void *memset (void *s, int c, size_t n) { + char *p = s; + int i; + for (i = 0; i < n; i++) + p[i] = c; + return p; +} + +void exit (int status) { + asm volatile ("moveq 1, $r9\n" /* NR_exit. */ + "break 13\n"); + while(1) + ; +} + +ssize_t write (int fd, const void *buf, size_t count) { + int r; + asm volatile ("moveq 4, $r9\n" /* NR_write. */ + "break 13\n" : : : "memory"); + asm volatile ("move.d $r10, %0\n" : "=r" (r)); + return r; +} |