2 * Helper functions for CRIS system tests
4 * There is no libc and only a limited set of headers.
11 register unsigned int callno
asm ("r9") = 1; /* NR_exit */
13 asm volatile ("break 13\n"
22 size_t write(int fd
, const void *buf
, size_t count
)
24 register unsigned int callno
asm ("r9") = 4; /* NR_write */
25 register unsigned int r10
asm ("r10") = fd
;
26 register const void *r11
asm ("r11") = buf
;
27 register size_t r12
asm ("r12") = count
;
28 register unsigned int r
asm ("r10");
30 asm volatile ("break 13\n"
32 : "r" (callno
), "0" (r10
), "r" (r11
), "r" (r12
)
38 static inline int mystrlen(char *s
)
50 char s
[] = "passed.\n";
51 write(1, s
, sizeof(s
) - 1);
55 void _fail(char *reason
)
57 char s
[] = "\nfailed: ";
58 int len
= mystrlen(reason
);
59 write(1, s
, sizeof(s
) - 1);
60 write(1, reason
, len
);