switch_to.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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. #ifndef _ASM_SWITCH_TO_H
  12. #define _ASM_SWITCH_TO_H
  13. #include <linux/thread_info.h>
  14. /*
  15. * switch_to(prev, next) should switch from task `prev' to `next'
  16. * `prev' will never be the same as `next'.
  17. * The `mb' is to tell GCC not to cache `current' across this call.
  18. */
  19. extern asmlinkage
  20. struct task_struct *__switch_to(struct thread_struct *prev_thread,
  21. struct thread_struct *next_thread,
  22. struct task_struct *prev);
  23. #define switch_to(prev, next, last) \
  24. do { \
  25. (prev)->thread.sched_lr = \
  26. (unsigned long) __builtin_return_address(0); \
  27. (last) = __switch_to(&(prev)->thread, &(next)->thread, (prev)); \
  28. mb(); \
  29. } while(0)
  30. #endif /* _ASM_SWITCH_TO_H */