18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Based on arch/arm/include/asm/processor.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 1995-1999 Russell King
68c2ecf20Sopenharmony_ci * Copyright (C) 2012 ARM Ltd.
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci#ifndef __ASM_PROCESSOR_H
98c2ecf20Sopenharmony_ci#define __ASM_PROCESSOR_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define KERNEL_DS		UL(-1)
128c2ecf20Sopenharmony_ci#define USER_DS			((UL(1) << VA_BITS) - 1)
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/*
158c2ecf20Sopenharmony_ci * On arm64 systems, unaligned accesses by the CPU are cheap, and so there is
168c2ecf20Sopenharmony_ci * no point in shifting all network buffers by 2 bytes just to make some IP
178c2ecf20Sopenharmony_ci * header fields appear aligned in memory, potentially sacrificing some DMA
188c2ecf20Sopenharmony_ci * performance on some platforms.
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_ci#define NET_IP_ALIGN	0
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#include <linux/build_bug.h>
258c2ecf20Sopenharmony_ci#include <linux/cache.h>
268c2ecf20Sopenharmony_ci#include <linux/init.h>
278c2ecf20Sopenharmony_ci#include <linux/stddef.h>
288c2ecf20Sopenharmony_ci#include <linux/string.h>
298c2ecf20Sopenharmony_ci#include <linux/thread_info.h>
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#include <vdso/processor.h>
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#include <asm/alternative.h>
348c2ecf20Sopenharmony_ci#include <asm/cpufeature.h>
358c2ecf20Sopenharmony_ci#include <asm/hw_breakpoint.h>
368c2ecf20Sopenharmony_ci#include <asm/kasan.h>
378c2ecf20Sopenharmony_ci#include <asm/lse.h>
388c2ecf20Sopenharmony_ci#include <asm/pgtable-hwdef.h>
398c2ecf20Sopenharmony_ci#include <asm/pointer_auth.h>
408c2ecf20Sopenharmony_ci#include <asm/ptrace.h>
418c2ecf20Sopenharmony_ci#include <asm/spectre.h>
428c2ecf20Sopenharmony_ci#include <asm/types.h>
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/*
458c2ecf20Sopenharmony_ci * TASK_SIZE - the maximum size of a user space task.
468c2ecf20Sopenharmony_ci * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area.
478c2ecf20Sopenharmony_ci */
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#define DEFAULT_MAP_WINDOW_64	(UL(1) << VA_BITS_MIN)
508c2ecf20Sopenharmony_ci#define TASK_SIZE_64		(UL(1) << vabits_actual)
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#ifdef CONFIG_COMPAT
538c2ecf20Sopenharmony_ci#if defined(CONFIG_ARM64_64K_PAGES) && defined(CONFIG_KUSER_HELPERS)
548c2ecf20Sopenharmony_ci/*
558c2ecf20Sopenharmony_ci * With CONFIG_ARM64_64K_PAGES enabled, the last page is occupied
568c2ecf20Sopenharmony_ci * by the compat vectors page.
578c2ecf20Sopenharmony_ci */
588c2ecf20Sopenharmony_ci#define TASK_SIZE_32		UL(0x100000000)
598c2ecf20Sopenharmony_ci#else
608c2ecf20Sopenharmony_ci#define TASK_SIZE_32		(UL(0x100000000) - PAGE_SIZE)
618c2ecf20Sopenharmony_ci#endif /* CONFIG_ARM64_64K_PAGES */
628c2ecf20Sopenharmony_ci#define TASK_SIZE		(test_thread_flag(TIF_32BIT) ? \
638c2ecf20Sopenharmony_ci				TASK_SIZE_32 : TASK_SIZE_64)
648c2ecf20Sopenharmony_ci#define TASK_SIZE_OF(tsk)	(test_tsk_thread_flag(tsk, TIF_32BIT) ? \
658c2ecf20Sopenharmony_ci				TASK_SIZE_32 : TASK_SIZE_64)
668c2ecf20Sopenharmony_ci#define DEFAULT_MAP_WINDOW	(test_thread_flag(TIF_32BIT) ? \
678c2ecf20Sopenharmony_ci				TASK_SIZE_32 : DEFAULT_MAP_WINDOW_64)
688c2ecf20Sopenharmony_ci#else
698c2ecf20Sopenharmony_ci#define TASK_SIZE		TASK_SIZE_64
708c2ecf20Sopenharmony_ci#define DEFAULT_MAP_WINDOW	DEFAULT_MAP_WINDOW_64
718c2ecf20Sopenharmony_ci#endif /* CONFIG_COMPAT */
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#ifdef CONFIG_ARM64_FORCE_52BIT
748c2ecf20Sopenharmony_ci#define STACK_TOP_MAX		TASK_SIZE_64
758c2ecf20Sopenharmony_ci#define TASK_UNMAPPED_BASE	(PAGE_ALIGN(TASK_SIZE / 4))
768c2ecf20Sopenharmony_ci#else
778c2ecf20Sopenharmony_ci#define STACK_TOP_MAX		DEFAULT_MAP_WINDOW_64
788c2ecf20Sopenharmony_ci#define TASK_UNMAPPED_BASE	(PAGE_ALIGN(DEFAULT_MAP_WINDOW / 4))
798c2ecf20Sopenharmony_ci#endif /* CONFIG_ARM64_FORCE_52BIT */
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#ifdef CONFIG_COMPAT
828c2ecf20Sopenharmony_ci#define AARCH32_VECTORS_BASE	0xffff0000
838c2ecf20Sopenharmony_ci#define STACK_TOP		(test_thread_flag(TIF_32BIT) ? \
848c2ecf20Sopenharmony_ci				AARCH32_VECTORS_BASE : STACK_TOP_MAX)
858c2ecf20Sopenharmony_ci#else
868c2ecf20Sopenharmony_ci#define STACK_TOP		STACK_TOP_MAX
878c2ecf20Sopenharmony_ci#endif /* CONFIG_COMPAT */
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci#ifndef CONFIG_ARM64_FORCE_52BIT
908c2ecf20Sopenharmony_ci#define arch_get_mmap_end(addr) ((addr > DEFAULT_MAP_WINDOW) ? TASK_SIZE :\
918c2ecf20Sopenharmony_ci				DEFAULT_MAP_WINDOW)
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#define arch_get_mmap_base(addr, base) ((addr > DEFAULT_MAP_WINDOW) ? \
948c2ecf20Sopenharmony_ci					base + TASK_SIZE - DEFAULT_MAP_WINDOW :\
958c2ecf20Sopenharmony_ci					base)
968c2ecf20Sopenharmony_ci#endif /* CONFIG_ARM64_FORCE_52BIT */
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ciextern phys_addr_t arm64_dma_phys_limit;
998c2ecf20Sopenharmony_ci#define ARCH_LOW_ADDRESS_LIMIT	(arm64_dma_phys_limit - 1)
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_cistruct debug_info {
1028c2ecf20Sopenharmony_ci#ifdef CONFIG_HAVE_HW_BREAKPOINT
1038c2ecf20Sopenharmony_ci	/* Have we suspended stepping by a debugger? */
1048c2ecf20Sopenharmony_ci	int			suspended_step;
1058c2ecf20Sopenharmony_ci	/* Allow breakpoints and watchpoints to be disabled for this thread. */
1068c2ecf20Sopenharmony_ci	int			bps_disabled;
1078c2ecf20Sopenharmony_ci	int			wps_disabled;
1088c2ecf20Sopenharmony_ci	/* Hardware breakpoints pinned to this task. */
1098c2ecf20Sopenharmony_ci	struct perf_event	*hbp_break[ARM_MAX_BRP];
1108c2ecf20Sopenharmony_ci	struct perf_event	*hbp_watch[ARM_MAX_WRP];
1118c2ecf20Sopenharmony_ci#endif
1128c2ecf20Sopenharmony_ci};
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_cistruct cpu_context {
1158c2ecf20Sopenharmony_ci	unsigned long x19;
1168c2ecf20Sopenharmony_ci	unsigned long x20;
1178c2ecf20Sopenharmony_ci	unsigned long x21;
1188c2ecf20Sopenharmony_ci	unsigned long x22;
1198c2ecf20Sopenharmony_ci	unsigned long x23;
1208c2ecf20Sopenharmony_ci	unsigned long x24;
1218c2ecf20Sopenharmony_ci	unsigned long x25;
1228c2ecf20Sopenharmony_ci	unsigned long x26;
1238c2ecf20Sopenharmony_ci	unsigned long x27;
1248c2ecf20Sopenharmony_ci	unsigned long x28;
1258c2ecf20Sopenharmony_ci	unsigned long fp;
1268c2ecf20Sopenharmony_ci	unsigned long sp;
1278c2ecf20Sopenharmony_ci	unsigned long pc;
1288c2ecf20Sopenharmony_ci};
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_cistruct thread_struct {
1318c2ecf20Sopenharmony_ci	struct cpu_context	cpu_context;	/* cpu context */
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci	/*
1348c2ecf20Sopenharmony_ci	 * Whitelisted fields for hardened usercopy:
1358c2ecf20Sopenharmony_ci	 * Maintainers must ensure manually that this contains no
1368c2ecf20Sopenharmony_ci	 * implicit padding.
1378c2ecf20Sopenharmony_ci	 */
1388c2ecf20Sopenharmony_ci	struct {
1398c2ecf20Sopenharmony_ci		unsigned long	tp_value;	/* TLS register */
1408c2ecf20Sopenharmony_ci		unsigned long	tp2_value;
1418c2ecf20Sopenharmony_ci		struct user_fpsimd_state fpsimd_state;
1428c2ecf20Sopenharmony_ci	} uw;
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci	unsigned int		fpsimd_cpu;
1458c2ecf20Sopenharmony_ci	void			*sve_state;	/* SVE registers, if any */
1468c2ecf20Sopenharmony_ci	unsigned int		sve_vl;		/* SVE vector length */
1478c2ecf20Sopenharmony_ci	unsigned int		sve_vl_onexec;	/* SVE vl after next exec */
1488c2ecf20Sopenharmony_ci	unsigned long		fault_address;	/* fault info */
1498c2ecf20Sopenharmony_ci	unsigned long		fault_code;	/* ESR_EL1 value */
1508c2ecf20Sopenharmony_ci	struct debug_info	debug;		/* debugging */
1518c2ecf20Sopenharmony_ci#ifdef CONFIG_ARM64_PTR_AUTH
1528c2ecf20Sopenharmony_ci	struct ptrauth_keys_user	keys_user;
1538c2ecf20Sopenharmony_ci	struct ptrauth_keys_kernel	keys_kernel;
1548c2ecf20Sopenharmony_ci#endif
1558c2ecf20Sopenharmony_ci#ifdef CONFIG_ARM64_MTE
1568c2ecf20Sopenharmony_ci	u64			sctlr_tcf0;
1578c2ecf20Sopenharmony_ci	u64			gcr_user_incl;
1588c2ecf20Sopenharmony_ci#endif
1598c2ecf20Sopenharmony_ci};
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_cistatic inline void arch_thread_struct_whitelist(unsigned long *offset,
1628c2ecf20Sopenharmony_ci						unsigned long *size)
1638c2ecf20Sopenharmony_ci{
1648c2ecf20Sopenharmony_ci	/* Verify that there is no padding among the whitelisted fields: */
1658c2ecf20Sopenharmony_ci	BUILD_BUG_ON(sizeof_field(struct thread_struct, uw) !=
1668c2ecf20Sopenharmony_ci		     sizeof_field(struct thread_struct, uw.tp_value) +
1678c2ecf20Sopenharmony_ci		     sizeof_field(struct thread_struct, uw.tp2_value) +
1688c2ecf20Sopenharmony_ci		     sizeof_field(struct thread_struct, uw.fpsimd_state));
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci	*offset = offsetof(struct thread_struct, uw);
1718c2ecf20Sopenharmony_ci	*size = sizeof_field(struct thread_struct, uw);
1728c2ecf20Sopenharmony_ci}
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci#ifdef CONFIG_COMPAT
1758c2ecf20Sopenharmony_ci#define task_user_tls(t)						\
1768c2ecf20Sopenharmony_ci({									\
1778c2ecf20Sopenharmony_ci	unsigned long *__tls;						\
1788c2ecf20Sopenharmony_ci	if (is_compat_thread(task_thread_info(t)))			\
1798c2ecf20Sopenharmony_ci		__tls = &(t)->thread.uw.tp2_value;			\
1808c2ecf20Sopenharmony_ci	else								\
1818c2ecf20Sopenharmony_ci		__tls = &(t)->thread.uw.tp_value;			\
1828c2ecf20Sopenharmony_ci	__tls;								\
1838c2ecf20Sopenharmony_ci })
1848c2ecf20Sopenharmony_ci#else
1858c2ecf20Sopenharmony_ci#define task_user_tls(t)	(&(t)->thread.uw.tp_value)
1868c2ecf20Sopenharmony_ci#endif
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci/* Sync TPIDR_EL0 back to thread_struct for current */
1898c2ecf20Sopenharmony_civoid tls_preserve_current_state(void);
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci#define INIT_THREAD {				\
1928c2ecf20Sopenharmony_ci	.fpsimd_cpu = NR_CPUS,			\
1938c2ecf20Sopenharmony_ci}
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_cistatic inline void start_thread_common(struct pt_regs *regs, unsigned long pc)
1968c2ecf20Sopenharmony_ci{
1978c2ecf20Sopenharmony_ci	s32 previous_syscall = regs->syscallno;
1988c2ecf20Sopenharmony_ci	memset(regs, 0, sizeof(*regs));
1998c2ecf20Sopenharmony_ci	regs->syscallno = previous_syscall;
2008c2ecf20Sopenharmony_ci	regs->pc = pc;
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ci	if (system_uses_irq_prio_masking())
2038c2ecf20Sopenharmony_ci		regs->pmr_save = GIC_PRIO_IRQON;
2048c2ecf20Sopenharmony_ci}
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_cistatic inline void start_thread(struct pt_regs *regs, unsigned long pc,
2078c2ecf20Sopenharmony_ci				unsigned long sp)
2088c2ecf20Sopenharmony_ci{
2098c2ecf20Sopenharmony_ci	start_thread_common(regs, pc);
2108c2ecf20Sopenharmony_ci	regs->pstate = PSR_MODE_EL0t;
2118c2ecf20Sopenharmony_ci	spectre_v4_enable_task_mitigation(current);
2128c2ecf20Sopenharmony_ci	regs->sp = sp;
2138c2ecf20Sopenharmony_ci}
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci#ifdef CONFIG_COMPAT
2168c2ecf20Sopenharmony_cistatic inline void compat_start_thread(struct pt_regs *regs, unsigned long pc,
2178c2ecf20Sopenharmony_ci				       unsigned long sp)
2188c2ecf20Sopenharmony_ci{
2198c2ecf20Sopenharmony_ci	start_thread_common(regs, pc);
2208c2ecf20Sopenharmony_ci	regs->pstate = PSR_AA32_MODE_USR;
2218c2ecf20Sopenharmony_ci	if (pc & 1)
2228c2ecf20Sopenharmony_ci		regs->pstate |= PSR_AA32_T_BIT;
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci#ifdef __AARCH64EB__
2258c2ecf20Sopenharmony_ci	regs->pstate |= PSR_AA32_E_BIT;
2268c2ecf20Sopenharmony_ci#endif
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci	spectre_v4_enable_task_mitigation(current);
2298c2ecf20Sopenharmony_ci	regs->compat_sp = sp;
2308c2ecf20Sopenharmony_ci}
2318c2ecf20Sopenharmony_ci#endif
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_cistatic __always_inline bool is_ttbr0_addr(unsigned long addr)
2348c2ecf20Sopenharmony_ci{
2358c2ecf20Sopenharmony_ci	/* entry assembly clears tags for TTBR0 addrs */
2368c2ecf20Sopenharmony_ci	return addr < TASK_SIZE;
2378c2ecf20Sopenharmony_ci}
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_cistatic __always_inline bool is_ttbr1_addr(unsigned long addr)
2408c2ecf20Sopenharmony_ci{
2418c2ecf20Sopenharmony_ci	/* TTBR1 addresses may have a tag if KASAN_SW_TAGS is in use */
2428c2ecf20Sopenharmony_ci	return arch_kasan_reset_tag(addr) >= PAGE_OFFSET;
2438c2ecf20Sopenharmony_ci}
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci/* Forward declaration, a strange C thing */
2468c2ecf20Sopenharmony_cistruct task_struct;
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci/* Free all resources held by a thread. */
2498c2ecf20Sopenharmony_ciextern void release_thread(struct task_struct *);
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ciunsigned long get_wchan(struct task_struct *p);
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci/* Thread switching */
2548c2ecf20Sopenharmony_ciextern struct task_struct *cpu_switch_to(struct task_struct *prev,
2558c2ecf20Sopenharmony_ci					 struct task_struct *next);
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci#define task_pt_regs(p) \
2588c2ecf20Sopenharmony_ci	((struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1)
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci#define KSTK_EIP(tsk)	((unsigned long)task_pt_regs(tsk)->pc)
2618c2ecf20Sopenharmony_ci#define KSTK_ESP(tsk)	user_stack_pointer(task_pt_regs(tsk))
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci/*
2648c2ecf20Sopenharmony_ci * Prefetching support
2658c2ecf20Sopenharmony_ci */
2668c2ecf20Sopenharmony_ci#define ARCH_HAS_PREFETCH
2678c2ecf20Sopenharmony_cistatic inline void prefetch(const void *ptr)
2688c2ecf20Sopenharmony_ci{
2698c2ecf20Sopenharmony_ci	asm volatile("prfm pldl1keep, %a0\n" : : "p" (ptr));
2708c2ecf20Sopenharmony_ci}
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci#define ARCH_HAS_PREFETCHW
2738c2ecf20Sopenharmony_cistatic inline void prefetchw(const void *ptr)
2748c2ecf20Sopenharmony_ci{
2758c2ecf20Sopenharmony_ci	asm volatile("prfm pstl1keep, %a0\n" : : "p" (ptr));
2768c2ecf20Sopenharmony_ci}
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ci#define ARCH_HAS_SPINLOCK_PREFETCH
2798c2ecf20Sopenharmony_cistatic inline void spin_lock_prefetch(const void *ptr)
2808c2ecf20Sopenharmony_ci{
2818c2ecf20Sopenharmony_ci	asm volatile(ARM64_LSE_ATOMIC_INSN(
2828c2ecf20Sopenharmony_ci		     "prfm pstl1strm, %a0",
2838c2ecf20Sopenharmony_ci		     "nop") : : "p" (ptr));
2848c2ecf20Sopenharmony_ci}
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ciextern unsigned long __ro_after_init signal_minsigstksz; /* sigframe size */
2878c2ecf20Sopenharmony_ciextern void __init minsigstksz_setup(void);
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci/*
2908c2ecf20Sopenharmony_ci * Not at the top of the file due to a direct #include cycle between
2918c2ecf20Sopenharmony_ci * <asm/fpsimd.h> and <asm/processor.h>.  Deferring this #include
2928c2ecf20Sopenharmony_ci * ensures that contents of processor.h are visible to fpsimd.h even if
2938c2ecf20Sopenharmony_ci * processor.h is included first.
2948c2ecf20Sopenharmony_ci *
2958c2ecf20Sopenharmony_ci * These prctl helpers are the only things in this file that require
2968c2ecf20Sopenharmony_ci * fpsimd.h.  The core code expects them to be in this header.
2978c2ecf20Sopenharmony_ci */
2988c2ecf20Sopenharmony_ci#include <asm/fpsimd.h>
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci/* Userspace interface for PR_SVE_{SET,GET}_VL prctl()s: */
3018c2ecf20Sopenharmony_ci#define SVE_SET_VL(arg)	sve_set_current_vl(arg)
3028c2ecf20Sopenharmony_ci#define SVE_GET_VL()	sve_get_current_vl()
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci/* PR_PAC_RESET_KEYS prctl */
3058c2ecf20Sopenharmony_ci#define PAC_RESET_KEYS(tsk, arg)	ptrauth_prctl_reset_keys(tsk, arg)
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci#ifdef CONFIG_ARM64_TAGGED_ADDR_ABI
3088c2ecf20Sopenharmony_ci/* PR_{SET,GET}_TAGGED_ADDR_CTRL prctl */
3098c2ecf20Sopenharmony_cilong set_tagged_addr_ctrl(struct task_struct *task, unsigned long arg);
3108c2ecf20Sopenharmony_cilong get_tagged_addr_ctrl(struct task_struct *task);
3118c2ecf20Sopenharmony_ci#define SET_TAGGED_ADDR_CTRL(arg)	set_tagged_addr_ctrl(current, arg)
3128c2ecf20Sopenharmony_ci#define GET_TAGGED_ADDR_CTRL()		get_tagged_addr_ctrl(current)
3138c2ecf20Sopenharmony_ci#endif
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ci/*
3168c2ecf20Sopenharmony_ci * For CONFIG_GCC_PLUGIN_STACKLEAK
3178c2ecf20Sopenharmony_ci *
3188c2ecf20Sopenharmony_ci * These need to be macros because otherwise we get stuck in a nightmare
3198c2ecf20Sopenharmony_ci * of header definitions for the use of task_stack_page.
3208c2ecf20Sopenharmony_ci */
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_ci#define current_top_of_stack()							\
3238c2ecf20Sopenharmony_ci({										\
3248c2ecf20Sopenharmony_ci	struct stack_info _info;						\
3258c2ecf20Sopenharmony_ci	BUG_ON(!on_accessible_stack(current, current_stack_pointer, &_info));	\
3268c2ecf20Sopenharmony_ci	_info.high;								\
3278c2ecf20Sopenharmony_ci})
3288c2ecf20Sopenharmony_ci#define on_thread_stack()	(on_task_stack(current, current_stack_pointer, NULL))
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */
3318c2ecf20Sopenharmony_ci#endif /* __ASM_PROCESSOR_H */
332