1 /* MN10300 task switching definitions
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
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.
11 #ifndef _ASM_SWITCH_TO_H
12 #define _ASM_SWITCH_TO_H
14 #include <asm/barrier.h>
19 #if !defined(CONFIG_LAZY_SAVE_FPU)
20 struct fpu_state_struct
;
21 extern asmlinkage
void fpu_save(struct fpu_state_struct
*);
22 #define switch_fpu(prev, next) \
24 if ((prev)->thread.fpu_flags & THREAD_HAS_FPU) { \
25 (prev)->thread.fpu_flags &= ~THREAD_HAS_FPU; \
26 (prev)->thread.uregs->epsw &= ~EPSW_FE; \
27 fpu_save(&(prev)->thread.fpu_state); \
31 #define switch_fpu(prev, next) do {} while (0)
34 /* context switching is now performed out-of-line in switch_to.S */
36 struct task_struct
*__switch_to(struct thread_struct
*prev
,
37 struct thread_struct
*next
,
38 struct task_struct
*prev_task
);
40 #define switch_to(prev, next, last) \
42 switch_fpu(prev, next); \
43 current->thread.wchan = (u_long) __builtin_return_address(0); \
44 (last) = __switch_to(&(prev)->thread, &(next)->thread, (prev)); \
46 current->thread.wchan = 0; \
49 #endif /* _ASM_SWITCH_TO_H */