blob: 2d368ede2fc1ed715554879d90395ace7cf02445 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _X86_64_CURRENT_H
2#define _X86_64_CURRENT_H
3
Joe Perches2cade892008-03-23 01:01:56 -07004#if !defined(__ASSEMBLY__)
Linus Torvalds1da177e2005-04-16 15:20:36 -07005struct task_struct;
6
7#include <asm/pda.h>
8
Joe Perches2cade892008-03-23 01:01:56 -07009static inline struct task_struct *get_current(void)
10{
11 struct task_struct *t = read_pda(pcurrent);
Linus Torvalds1da177e2005-04-16 15:20:36 -070012 return t;
Joe Perches2cade892008-03-23 01:01:56 -070013}
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
15#define current get_current()
16
17#else
18
19#ifndef ASM_OFFSET_H
Joe Perches2cade892008-03-23 01:01:56 -070020#include <asm/asm-offsets.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#endif
22
23#define GET_CURRENT(reg) movq %gs:(pda_pcurrent),reg
24
25#endif
26
27#endif /* !(_X86_64_CURRENT_H) */