David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 1 | /* MN10300 Current task structure accessor |
| 2 | * |
| 3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public Licence |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the Licence, or (at your option) any later version. |
| 10 | */ |
| 11 | #ifndef _ASM_CURRENT_H |
| 12 | #define _ASM_CURRENT_H |
| 13 | |
| 14 | #include <linux/thread_info.h> |
| 15 | |
| 16 | /* |
| 17 | * dedicate E2 to keeping the current task pointer |
| 18 | */ |
| 19 | #ifdef CONFIG_MN10300_CURRENT_IN_E2 |
| 20 | |
| 21 | register struct task_struct *const current asm("e2") __attribute__((used)); |
| 22 | |
| 23 | #define get_current() current |
| 24 | |
| 25 | extern struct task_struct *__current; |
| 26 | |
| 27 | #else |
| 28 | static inline __attribute__((const)) |
| 29 | struct task_struct *get_current(void) |
| 30 | { |
| 31 | return current_thread_info()->task; |
| 32 | } |
| 33 | |
| 34 | #define current get_current() |
| 35 | #endif |
| 36 | |
| 37 | #endif /* _ASM_CURRENT_H */ |