-
-/* Tries to write BYTE to user address UDST.
- Returns true if successful, false if UDST is invalid. */
-static inline bool put_user (uint8_t *udst, uint8_t byte) {
- int eax;
- asm ("movl $1f, %%eax; movb %b2, %0; 1:"
- : "=m" (*udst), "=&a" (eax) : "r" (byte));
- return eax != 0;
+
+/* Writes BYTE to user address UDST.
+ UDST must be below PHYS_BASE.
+ Returns true if successful, false if a segfault occurred. */
+static bool
+put_user (uint8_t *udst, uint8_t byte)
+{
+ int error_code;
+ asm ("movl $1f, %0; movb %b2, %1; 1:"
+ : "=&a" (error_code), "=m" (*udst) : "r" (byte));
+ return error_code != -1;