+/*
+ * copyin_word
+ * Read an aligned value from userspace as a single memory transaction.
+ * This function supports userspace synchronization features
+ */
+int
+copyin_word(const user_addr_t user_addr, uint64_t *kernel_addr, vm_size_t nbytes)
+{
+ /* Verify sizes */
+ if ((nbytes != 4) && (nbytes != 8))
+ return EINVAL;
+
+ /* Test alignment */
+ if (user_addr & (nbytes - 1))
+ return EINVAL;
+ return copyio(COPYINWORD, user_addr, (char *)(uintptr_t)kernel_addr, nbytes, NULL, 0);
+}
+