/* SPDX-License-Identifier: GPL-2.0-only */1/*2* Based on arm/arm64/include/asm/current.h3*4* Copyright (C) 2016 ARM5* Copyright (C) 2017 SiFive6*/789#ifndef _ASM_RISCV_CURRENT_H10#define _ASM_RISCV_CURRENT_H1112#include <linux/bug.h>13#include <linux/compiler.h>1415#ifndef __ASSEMBLY__1617struct task_struct;1819register struct task_struct *riscv_current_is_tp __asm__("tp");2021/*22* This only works because "struct thread_info" is at offset 0 from "struct23* task_struct". This constraint seems to be necessary on other architectures24* as well, but __switch_to enforces it. We can't check TASK_TI here because25* <asm/asm-offsets.h> includes this, and I can't get the definition of "struct26* task_struct" here due to some header ordering problems.27*/28static __always_inline struct task_struct *get_current(void)29{30return riscv_current_is_tp;31}3233#define current get_current()3435register unsigned long current_stack_pointer __asm__("sp");3637#endif /* __ASSEMBLY__ */3839#endif /* _ASM_RISCV_CURRENT_H */404142