代码拉取完成,页面将自动刷新
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2024 Spaciemit Ltd.
*/
#ifndef __ASM_RWONCE_H
#define __ASM_RWONCE_H
#if defined(CONFIG_SPACEMIT_ERRATA_LOAD_ATOMIC) && !defined(__ASSEMBLY__)
#define __READ_ONCE(x) \
({ \
typeof(&(x)) __x = &(x); \
int atomic = 1; \
union { __unqual_scalar_typeof(*__x) __val; char __c[1]; } __u; \
switch (sizeof(x)) { \
case 4: \
asm volatile ( \
"lr.w %0, 0(%1)" \
: "=r" (*(__u32 *)__u.__c) \
: "r" (__x) \
: "memory" \
); \
break; \
case 8: \
asm volatile ( \
"lr.d %0, 0(%1)" \
: "=r" (*(__u64 *)__u.__c) \
: "r" (__x) \
: "memory" \
); \
break; \
default: \
asm volatile ("fence rw, rw" ::: "memory"); \
atomic = 0; \
} \
atomic ? (typeof(*__x))__u.__val : (*(volatile typeof(__x))__x);\
})
#endif /* CONFIG_SPACEMIT_ERRATA_LOAD_ATOMIC && !__ASSEMBLY__ */
#include <asm-generic/rwonce.h>
#endif /* __ASM_RWONCE_H */
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。