@@ -471,65 +471,15 @@ do { \
471471#define arch_get_kernel_nofault __mvc_kernel_nofault
472472#define arch_put_kernel_nofault __mvc_kernel_nofault
473473
474- void __cmpxchg_user_key_called_with_bad_pointer (void );
475-
476- int __cmpxchg_user_key1 (unsigned long address , unsigned char * uval ,
477- unsigned char old , unsigned char new , unsigned long key );
478- int __cmpxchg_user_key2 (unsigned long address , unsigned short * uval ,
479- unsigned short old , unsigned short new , unsigned long key );
480- int __cmpxchg_user_key4 (unsigned long address , unsigned int * uval ,
481- unsigned int old , unsigned int new , unsigned long key );
482- int __cmpxchg_user_key8 (unsigned long address , unsigned long * uval ,
483- unsigned long old , unsigned long new , unsigned long key );
484- int __cmpxchg_user_key16 (unsigned long address , __uint128_t * uval ,
485- __uint128_t old , __uint128_t new , unsigned long key );
486-
487- static __always_inline int _cmpxchg_user_key (unsigned long address , void * uval ,
488- __uint128_t old , __uint128_t new ,
489- unsigned long key , int size )
490- {
491- switch (size ) {
492- case 1 : return __cmpxchg_user_key1 (address , uval , old , new , key );
493- case 2 : return __cmpxchg_user_key2 (address , uval , old , new , key );
494- case 4 : return __cmpxchg_user_key4 (address , uval , old , new , key );
495- case 8 : return __cmpxchg_user_key8 (address , uval , old , new , key );
496- case 16 : return __cmpxchg_user_key16 (address , uval , old , new , key );
497- default : __cmpxchg_user_key_called_with_bad_pointer ();
498- }
499- return 0 ;
500- }
501-
502- /**
503- * cmpxchg_user_key() - cmpxchg with user space target, honoring storage keys
504- * @ptr: User space address of value to compare to @old and exchange with
505- * @new. Must be aligned to sizeof(*@ptr).
506- * @uval: Address where the old value of *@ptr is written to.
507- * @old: Old value. Compared to the content pointed to by @ptr in order to
508- * determine if the exchange occurs. The old value read from *@ptr is
509- * written to *@uval.
510- * @new: New value to place at *@ptr.
511- * @key: Access key to use for checking storage key protection.
512- *
513- * Perform a cmpxchg on a user space target, honoring storage key protection.
514- * @key alone determines how key checking is performed, neither
515- * storage-protection-override nor fetch-protection-override apply.
516- * The caller must compare *@uval and @old to determine if values have been
517- * exchanged. In case of an exception *@uval is set to zero.
518- *
519- * Return: 0: cmpxchg executed
520- * -EFAULT: an exception happened when trying to access *@ptr
521- * -EAGAIN: maxed out number of retries (byte and short only)
522- */
523- #define cmpxchg_user_key (ptr , uval , old , new , key ) \
524- ({ \
525- __typeof__(ptr) __ptr = (ptr); \
526- __typeof__(uval) __uval = (uval); \
527- \
528- BUILD_BUG_ON(sizeof(*(__ptr)) != sizeof(*(__uval))); \
529- might_fault(); \
530- __chk_user_ptr(__ptr); \
531- _cmpxchg_user_key((unsigned long)(__ptr), (void *)(__uval), \
532- (old), (new), (key), sizeof(*(__ptr))); \
533- })
474+ int __cmpxchg_key1 (void * address , unsigned char * uval , unsigned char old ,
475+ unsigned char new , unsigned long key );
476+ int __cmpxchg_key2 (void * address , unsigned short * uval , unsigned short old ,
477+ unsigned short new , unsigned long key );
478+ int __cmpxchg_key4 (void * address , unsigned int * uval , unsigned int old ,
479+ unsigned int new , unsigned long key );
480+ int __cmpxchg_key8 (void * address , unsigned long * uval , unsigned long old ,
481+ unsigned long new , unsigned long key );
482+ int __cmpxchg_key16 (void * address , __uint128_t * uval , __uint128_t old ,
483+ __uint128_t new , unsigned long key );
534484
535485#endif /* __S390_UACCESS_H */
0 commit comments