1 #include "test.h" 2 3 char buffer[23] ="0123456789abcdef\0XXXXX"; 4 char bigbuf[512]= 5 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" 6 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" 7 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" 8 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" 9 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" 10 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" 11 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" 12 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde\0"; 13 14 char target[512]; 15 16 int 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 25 int 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 36 int 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 52