+ // OPT: use alignof for movsw and movsl versions
+ ulong bytes = sizeof(*kdata) * count;
+ int cause;
+
+ if ((ulong)uptr + bytes >= PHYSMEM_START ||
+ (ulong)uptr + bytes < (ulong)uptr) {
+ cause = 1;
+ goto bad;
+ }
+
+ asm("1: rep; movsb\n"
+ "2:\n"
+ ".section .extable,\"a\"\n"
+ ".align 4\n"
+ ".long 1b\n"
+ ".long 2b\n"
+ ".previous\n" : "+c" (bytes), "+D" (kdata), "+S" (uptr), "=d" (cause));
+
+ if (bytes != 0) {
+ bad:
+ throw_idl(MemoryFault, reinterpret_cast<ulong>(uptr),
+ 0, NULL, NULL, cause);
+ }