David Howells | ae47394 | 2012-03-28 18:30:01 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2004-2006 Atmel Corporation |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. |
| 7 | */ |
| 8 | #ifndef __ASM_AVR32_SWITCH_TO_H |
| 9 | #define __ASM_AVR32_SWITCH_TO_H |
| 10 | |
| 11 | /* |
| 12 | * Help PathFinder and other Nexus-compliant debuggers keep track of |
| 13 | * the current PID by emitting an Ownership Trace Message each time we |
| 14 | * switch task. |
| 15 | */ |
| 16 | #ifdef CONFIG_OWNERSHIP_TRACE |
| 17 | #include <asm/ocd.h> |
| 18 | #define finish_arch_switch(prev) \ |
| 19 | do { \ |
| 20 | ocd_write(PID, prev->pid); \ |
| 21 | ocd_write(PID, current->pid); \ |
| 22 | } while(0) |
| 23 | #endif |
| 24 | |
| 25 | /* |
| 26 | * switch_to(prev, next, last) should switch from task `prev' to task |
| 27 | * `next'. `prev' will never be the same as `next'. |
| 28 | * |
| 29 | * We just delegate everything to the __switch_to assembly function, |
| 30 | * which is implemented in arch/avr32/kernel/switch_to.S |
| 31 | * |
| 32 | * mb() tells GCC not to cache `current' across this call. |
| 33 | */ |
| 34 | struct cpu_context; |
| 35 | struct task_struct; |
| 36 | extern struct task_struct *__switch_to(struct task_struct *, |
| 37 | struct cpu_context *, |
| 38 | struct cpu_context *); |
| 39 | #define switch_to(prev, next, last) \ |
| 40 | do { \ |
| 41 | last = __switch_to(prev, &prev->thread.cpu_context + 1, \ |
| 42 | &next->thread.cpu_context); \ |
| 43 | } while (0) |
| 44 | |
| 45 | |
| 46 | #endif /* __ASM_AVR32_SWITCH_TO_H */ |