add debug information for emc
[qemu/qemu-JZ.git] / tests / cris / sys.c
blob551c5dd7cb9fa0623b7e02a091a12a6a78e02d1d
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <unistd.h>
5 static inline int mystrlen(char *s) {
6 int i = 0;
7 while (s[i])
8 i++;
9 return i;
12 void pass(void) {
13 char s[] = "passed.\n";
14 write (1, s, sizeof (s) - 1);
15 exit (0);
18 void _fail(char *reason) {
19 char s[] = "\nfailed: ";
20 int len = mystrlen(reason);
21 write (1, s, sizeof (s) - 1);
22 write (1, reason, len);
23 write (1, "\n", 1);
24 // exit (1);
27 void *memset (void *s, int c, size_t n) {
28 char *p = s;
29 int i;
30 for (i = 0; i < n; i++)
31 p[i] = c;
32 return p;
35 void exit (int status) {
36 asm volatile ("moveq 1, $r9\n" /* NR_exit. */
37 "break 13\n");
38 while(1)
42 ssize_t write (int fd, const void *buf, size_t count) {
43 int r;
44 asm ("move.d %0, $r10\n"
45 "move.d %1, $r11\n"
46 "move.d %2, $r12\n"
47 "moveq 4, $r9\n" /* NR_write. */
48 "break 13\n" : : "r" (fd), "r" (buf), "r" (count) : "memory");
49 asm ("move.d $r10, %0\n" : "=r" (r));
50 return r;