blob: ac85f12c4fe3b59a03b69e3a6f81453566d9a867 [file] [log] [blame]
sewardjb5b87402011-03-07 16:05:35 +00001#include "test.h"
2
3char buffer[23] ="0123456789abcdef\0XXXXX";
4char bigbuf[512]=
5 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
6 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
7 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
8 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
9 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
10 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
11 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
12 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde\0";
13
14char target[512];
15
16int mvst(void *targetp, void *source)
17{
18 asm volatile(
19 " lhi 0, 0\n"
20 " mvst %0, %1\n"
21 ::"a" (targetp),"a" (source): "0", "memory", "cc");
22 return get_cc();
23}
24
25int mvst_full(void *targetp, void *source)
26{
27 asm volatile(
28 " lhi 0, 0\n"
29 "0: mvst %0, %1\n"
30 " jo 0b\n"
31 ::"a" (targetp),"a" (source): "0", "memory", "cc");
32 return get_cc();
33}
34
35
36int main()
37{
38 short t;
39 char s;
40 printf("CC:%d\n", mvst(target, buffer));
41 printf("%s\n", target);
42 printf("CC:%d\n",mvst_full(target, bigbuf));
43 printf("%s\n", target);
44 t = 0x6161;
45 s = 0;
46 printf("%s\n", (char *) &t);
47 printf("CC:%d\n",mvst(&t,&s));
48 printf("%s\n", (char *) &t);
49 return 0;
50}
51