blob: 297827b761697a9f6a284fa2d7720382212aa17a [file] [log] [blame]
Thomas Gleixner2874c5f2019-05-27 08:55:01 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
David Gibson584224e2005-11-09 13:04:06 +11002#ifndef _ASM_POWERPC_CURRENT_H
3#define _ASM_POWERPC_CURRENT_H
Arnd Bergmann88ced032005-12-16 22:43:46 +01004#ifdef __KERNEL__
David Gibson584224e2005-11-09 13:04:06 +11005
6/*
David Gibson584224e2005-11-09 13:04:06 +11007 */
8
9struct task_struct;
10
11#ifdef __powerpc64__
Olaf Heringdbc11f52007-02-25 20:04:18 +010012#include <linux/stddef.h>
David Gibson584224e2005-11-09 13:04:06 +110013#include <asm/paca.h>
14
Hugh Dickins5fe8e8b2006-10-31 18:39:31 +000015static inline struct task_struct *get_current(void)
16{
17 struct task_struct *task;
18
19 __asm__ __volatile__("ld %0,%1(13)"
20 : "=r" (task)
21 : "i" (offsetof(struct paca_struct, __current)));
22
23 return task;
24}
25#define current get_current()
David Gibson584224e2005-11-09 13:04:06 +110026
27#else
28
29/*
30 * We keep `current' in r2 for speed.
31 */
32register struct task_struct *current asm ("r2");
33
34#endif
35
Arnd Bergmann88ced032005-12-16 22:43:46 +010036#endif /* __KERNEL__ */
David Gibson584224e2005-11-09 13:04:06 +110037#endif /* _ASM_POWERPC_CURRENT_H */