blob: 30aae5673770b2b0ec2ddb9fa662ade9bd21cf1e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * include/asm-v850/current.h -- Current task
3 *
4 * Copyright (C) 2001,02 NEC Corporation
5 * Copyright (C) 2001,02 Miles Bader <miles@gnu.org>
6 *
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this
9 * archive for more details.
10 *
11 * Written by Miles Bader <miles@gnu.org>
12 */
13
14#ifndef __V850_CURRENT_H__
15#define __V850_CURRENT_H__
16
17#ifndef __ASSEMBLY__ /* <linux/thread_info.h> is not asm-safe. */
18#include <linux/thread_info.h>
19#endif
20
21#include <asm/macrology.h>
22
23
24/* Register used to hold the current task pointer while in the kernel.
25 Any `call clobbered' register without a special meaning should be OK,
26 but check asm/v850/kernel/entry.S to be sure. */
27#define CURRENT_TASK_REGNUM 16
28#define CURRENT_TASK macrology_paste (r, CURRENT_TASK_REGNUM)
29
30
31#ifdef __ASSEMBLY__
32
33/* Put a pointer to the current task structure into REG. */
34#define GET_CURRENT_TASK(reg) \
35 GET_CURRENT_THREAD(reg); \
36 ld.w TI_TASK[reg], reg
37
38#else /* !__ASSEMBLY__ */
39
40/* A pointer to the current task. */
41register struct task_struct *current \
42 __asm__ (macrology_stringify (CURRENT_TASK));
43
44#endif /* __ASSEMBLY__ */
45
46
47#endif /* _V850_CURRENT_H */