blob: 3e204e6140b51fb9567276c9886d21a56aafceed [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
H. Peter Anvin1965aae2008-10-22 22:26:29 -07002#ifndef _ASM_X86_CURRENT_H
3#define _ASM_X86_CURRENT_H
Christoph Lameterf0766442008-05-09 19:09:48 -07004
Christoph Lameterf0766442008-05-09 19:09:48 -07005#include <linux/compiler.h>
6#include <asm/percpu.h>
7
Brian Gerstc6f5e0a2009-01-19 00:38:58 +09008#ifndef __ASSEMBLY__
Christoph Lameterf0766442008-05-09 19:09:48 -07009struct task_struct;
10
11DECLARE_PER_CPU(struct task_struct *, current_task);
Brian Gerstc6f5e0a2009-01-19 00:38:58 +090012
Christoph Lameterf0766442008-05-09 19:09:48 -070013static __always_inline struct task_struct *get_current(void)
14{
Alex Shic6ae41e2012-05-11 15:35:27 +080015 return this_cpu_read_stable(current_task);
Christoph Lameterf0766442008-05-09 19:09:48 -070016}
17
Brian Gerstc6f5e0a2009-01-19 00:38:58 +090018#define current get_current()
Christoph Lameterf0766442008-05-09 19:09:48 -070019
20#endif /* __ASSEMBLY__ */
21
H. Peter Anvin1965aae2008-10-22 22:26:29 -070022#endif /* _ASM_X86_CURRENT_H */