switch_to.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. * Help PathFinder and other Nexus-compliant debuggers keep track of
  12. * the current PID by emitting an Ownership Trace Message each time we
  13. * switch task.
  14. */
  15. #ifdef CONFIG_OWNERSHIP_TRACE
  16. #include <asm/ocd.h>
  17. #define finish_arch_switch(prev) \
  18. do { \
  19. ocd_write(PID, prev->pid); \
  20. ocd_write(PID, current->pid); \
  21. } while(0)
  22. #endif
  23. /*
  24. * switch_to(prev, next, last) should switch from task `prev' to task
  25. * `next'. `prev' will never be the same as `next'.
  26. *
  27. * We just delegate everything to the __switch_to assembly function,
  28. * which is implemented in arch/avr32/kernel/switch_to.S
  29. *
  30. * mb() tells GCC not to cache `current' across this call.
  31. */
  32. struct cpu_context;
  33. struct task_struct;
  34. extern struct task_struct *__switch_to(struct task_struct *,
  35. struct cpu_context *,
  36. struct cpu_context *);
  37. #define switch_to(prev, next, last) \
  38. do { \
  39. last = __switch_to(prev, &prev->thread.cpu_context + 1, \
  40. &next->thread.cpu_context); \
  41. } while (0)
  42. #endif /* __ASM_AVR32_SWITCH_TO_H */