armv8_deprecated.c (cdd38c5f1ce4398ec58fec95904b75824daab7b5) | armv8_deprecated.c (2e77a62cb3a6d2eb9dd875516411bcd131dd04e7) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) 2014 ARM Limited 4 */ 5 6#include <linux/cpu.h> 7#include <linux/init.h> 8#include <linux/list.h> --- 265 unchanged lines hidden (view full) --- 274 275/* Arbitrary constant to ensure forward-progress of the LL/SC loop */ 276#define __SWP_LL_SC_LOOPS 4 277 278#define __user_swpX_asm(data, addr, res, temp, temp2, B) \ 279do { \ 280 uaccess_enable_privileged(); \ 281 __asm__ __volatile__( \ | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) 2014 ARM Limited 4 */ 5 6#include <linux/cpu.h> 7#include <linux/init.h> 8#include <linux/list.h> --- 265 unchanged lines hidden (view full) --- 274 275/* Arbitrary constant to ensure forward-progress of the LL/SC loop */ 276#define __SWP_LL_SC_LOOPS 4 277 278#define __user_swpX_asm(data, addr, res, temp, temp2, B) \ 279do { \ 280 uaccess_enable_privileged(); \ 281 __asm__ __volatile__( \ |
282 " mov %w3, %w7\n" \ | 282 " mov %w3, %w6\n" \ |
283 "0: ldxr"B" %w2, [%4]\n" \ 284 "1: stxr"B" %w0, %w1, [%4]\n" \ 285 " cbz %w0, 2f\n" \ 286 " sub %w3, %w3, #1\n" \ 287 " cbnz %w3, 0b\n" \ 288 " mov %w0, %w5\n" \ 289 " b 3f\n" \ 290 "2:\n" \ 291 " mov %w1, %w2\n" \ 292 "3:\n" \ | 283 "0: ldxr"B" %w2, [%4]\n" \ 284 "1: stxr"B" %w0, %w1, [%4]\n" \ 285 " cbz %w0, 2f\n" \ 286 " sub %w3, %w3, #1\n" \ 287 " cbnz %w3, 0b\n" \ 288 " mov %w0, %w5\n" \ 289 " b 3f\n" \ 290 "2:\n" \ 291 " mov %w1, %w2\n" \ 292 "3:\n" \ |
293 " .pushsection .fixup,\"ax\"\n" \ 294 " .align 2\n" \ 295 "4: mov %w0, %w6\n" \ 296 " b 3b\n" \ 297 " .popsection" \ 298 _ASM_EXTABLE(0b, 4b) \ 299 _ASM_EXTABLE(1b, 4b) \ | 293 _ASM_EXTABLE_UACCESS_ERR(0b, 3b, %w0) \ 294 _ASM_EXTABLE_UACCESS_ERR(1b, 3b, %w0) \ |
300 : "=&r" (res), "+r" (data), "=&r" (temp), "=&r" (temp2) \ 301 : "r" ((unsigned long)addr), "i" (-EAGAIN), \ | 295 : "=&r" (res), "+r" (data), "=&r" (temp), "=&r" (temp2) \ 296 : "r" ((unsigned long)addr), "i" (-EAGAIN), \ |
302 "i" (-EFAULT), \ | |
303 "i" (__SWP_LL_SC_LOOPS) \ 304 : "memory"); \ 305 uaccess_disable_privileged(); \ 306} while (0) 307 308#define __user_swp_asm(data, addr, res, temp, temp2) \ 309 __user_swpX_asm(data, addr, res, temp, temp2, "") 310#define __user_swpb_asm(data, addr, res, temp, temp2) \ --- 337 unchanged lines hidden --- | 297 "i" (__SWP_LL_SC_LOOPS) \ 298 : "memory"); \ 299 uaccess_disable_privileged(); \ 300} while (0) 301 302#define __user_swp_asm(data, addr, res, temp, temp2) \ 303 __user_swpX_asm(data, addr, res, temp, temp2, "") 304#define __user_swpb_asm(data, addr, res, temp, temp2) \ --- 337 unchanged lines hidden --- |