David Howells | 40ab331 | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 1 | /* FR-V CPU basic task switching |
| 2 | * |
| 3 | * Copyright (C) 2003 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 License |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the License, or (at your option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #ifndef _ASM_SWITCH_TO_H |
| 13 | #define _ASM_SWITCH_TO_H |
| 14 | |
| 15 | #include <linux/thread_info.h> |
| 16 | |
| 17 | /* |
| 18 | * switch_to(prev, next) should switch from task `prev' to `next' |
| 19 | * `prev' will never be the same as `next'. |
| 20 | * The `mb' is to tell GCC not to cache `current' across this call. |
| 21 | */ |
| 22 | extern asmlinkage |
| 23 | struct task_struct *__switch_to(struct thread_struct *prev_thread, |
| 24 | struct thread_struct *next_thread, |
| 25 | struct task_struct *prev); |
| 26 | |
| 27 | #define switch_to(prev, next, last) \ |
| 28 | do { \ |
| 29 | (prev)->thread.sched_lr = \ |
| 30 | (unsigned long) __builtin_return_address(0); \ |
| 31 | (last) = __switch_to(&(prev)->thread, &(next)->thread, (prev)); \ |
| 32 | mb(); \ |
| 33 | } while(0) |
| 34 | |
| 35 | #endif /* _ASM_SWITCH_TO_H */ |