1/* { dg-do compile } */ 2/* { dg-require-effective-target ilp32 } */ 3/* { dg-options "-O" } */ 4 5typedef unsigned char u8; 6struct __large_struct { unsigned long buf[100]; }; 7static inline __attribute__((always_inline)) unsigned long 8__copy_from_user_inatomic(void *to, const void *from, unsigned long n) 9{ 10 unsigned long ret = 0; 11 asm volatile("1: mov""b"" %2,%""b""1\n" "2:\n" 12 ".section .fixup,\"ax\"\n" 13 "3: mov %3,%0\n" 14 " xor""b"" %""b""1,%""b""1\n" 15 " jmp 2b\n" 16 ".previous\n" 17 " .section __ex_table,\"a\"\n" 18 " " ".balign 4" " " "\n" 19 " " ".long" " " "1b" "," "3b" "\n" 20 " .previous\n" 21 : "=r" (ret), "=q"(*(u8 *)to) 22 : "m" ((*(struct __large_struct *)(from))), "i" (1), "0" (ret)); 23 return ret; 24} 25void romchecksum(const unsigned char *rom, unsigned char c) 26{ 27 unsigned char sum; 28 for (sum = 0; 29 !__copy_from_user_inatomic(&(c), ( typeof(c) *)(rom++), sizeof(c));) 30 sum += c; 31} 32