summaryrefslogtreecommitdiffstats
path: root/include/asm-arm/current.h
blob: 3a06c2a8afc79b4c50d82e6e401e3e325ece50e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef _ASMARM_CURRENT_H
#define _ASMARM_CURRENT_H

/* Old compilers seem to generate bad code if we allow `current' to be
   non volatile.  */
#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ > 90)
static inline struct task_struct *get_current(void) __attribute__ (( __const__ ));
#endif

static inline struct task_struct *get_current(void)
{
	register unsigned long sp asm ("sp");
	return (struct task_struct *)(sp & ~0x1fff);
}

#define current (get_current())

#endif /* _ASMARM_CURRENT_H */