18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * include/asm-arm/unified.h - Unified Assembler Syntax helper macros
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2008 ARM Limited
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __ASM_UNIFIED_H
98c2ecf20Sopenharmony_ci#define __ASM_UNIFIED_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#if defined(__ASSEMBLY__)
128c2ecf20Sopenharmony_ci	.syntax unified
138c2ecf20Sopenharmony_ci#else
148c2ecf20Sopenharmony_ci__asm__(".syntax unified");
158c2ecf20Sopenharmony_ci#endif
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#ifdef CONFIG_CPU_V7M
188c2ecf20Sopenharmony_ci#define AR_CLASS(x...)
198c2ecf20Sopenharmony_ci#define M_CLASS(x...)	x
208c2ecf20Sopenharmony_ci#else
218c2ecf20Sopenharmony_ci#define AR_CLASS(x...)	x
228c2ecf20Sopenharmony_ci#define M_CLASS(x...)
238c2ecf20Sopenharmony_ci#endif
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#ifdef CONFIG_THUMB2_KERNEL
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#if __GNUC__ < 4
288c2ecf20Sopenharmony_ci#error Thumb-2 kernel requires gcc >= 4
298c2ecf20Sopenharmony_ci#endif
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* The CPSR bit describing the instruction set (Thumb) */
328c2ecf20Sopenharmony_ci#define PSR_ISETSTATE	PSR_T_BIT
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define ARM(x...)
358c2ecf20Sopenharmony_ci#define THUMB(x...)	x
368c2ecf20Sopenharmony_ci#ifdef __ASSEMBLY__
378c2ecf20Sopenharmony_ci#define W(instr)	instr.w
388c2ecf20Sopenharmony_ci#else
398c2ecf20Sopenharmony_ci#define WASM(instr)	#instr ".w"
408c2ecf20Sopenharmony_ci#endif
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#else	/* !CONFIG_THUMB2_KERNEL */
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* The CPSR bit describing the instruction set (ARM) */
458c2ecf20Sopenharmony_ci#define PSR_ISETSTATE	0
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#define ARM(x...)	x
488c2ecf20Sopenharmony_ci#define THUMB(x...)
498c2ecf20Sopenharmony_ci#ifdef __ASSEMBLY__
508c2ecf20Sopenharmony_ci#define W(instr)	instr
518c2ecf20Sopenharmony_ci#else
528c2ecf20Sopenharmony_ci#define WASM(instr)	#instr
538c2ecf20Sopenharmony_ci#endif
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci#endif	/* CONFIG_THUMB2_KERNEL */
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#endif	/* !__ASM_UNIFIED_H */
58