system_64.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef __ASM_SH_SYSTEM_64_H
  2. #define __ASM_SH_SYSTEM_64_H
  3. /*
  4. * include/asm-sh/system_64.h
  5. *
  6. * Copyright (C) 2000, 2001 Paolo Alberelli
  7. * Copyright (C) 2003 Paul Mundt
  8. * Copyright (C) 2004 Richard Curnow
  9. *
  10. * This file is subject to the terms and conditions of the GNU General Public
  11. * License. See the file "COPYING" in the main directory of this archive
  12. * for more details.
  13. */
  14. #include <cpu/registers.h>
  15. #include <asm/processor.h>
  16. /*
  17. * switch_to() should switch tasks to task nr n, first
  18. */
  19. struct thread_struct;
  20. struct task_struct *sh64_switch_to(struct task_struct *prev,
  21. struct thread_struct *prev_thread,
  22. struct task_struct *next,
  23. struct thread_struct *next_thread);
  24. #define switch_to(prev,next,last) \
  25. do { \
  26. if (last_task_used_math != next) { \
  27. struct pt_regs *regs = next->thread.uregs; \
  28. if (regs) regs->sr |= SR_FD; \
  29. } \
  30. last = sh64_switch_to(prev, &prev->thread, next, \
  31. &next->thread); \
  32. } while (0)
  33. #define __icbi(addr) __asm__ __volatile__ ( "icbi %0, 0\n\t" : : "r" (addr))
  34. #define __ocbp(addr) __asm__ __volatile__ ( "ocbp %0, 0\n\t" : : "r" (addr))
  35. #define __ocbi(addr) __asm__ __volatile__ ( "ocbi %0, 0\n\t" : : "r" (addr))
  36. #define __ocbwb(addr) __asm__ __volatile__ ( "ocbwb %0, 0\n\t" : : "r" (addr))
  37. static inline reg_size_t register_align(void *val)
  38. {
  39. return (unsigned long long)(signed long long)(signed long)val;
  40. }
  41. extern void phys_stext(void);
  42. static inline void trigger_address_error(void)
  43. {
  44. phys_stext();
  45. }
  46. #define SR_BL_LL 0x0000000010000000LL
  47. static inline void set_bl_bit(void)
  48. {
  49. unsigned long long __dummy0, __dummy1 = SR_BL_LL;
  50. __asm__ __volatile__("getcon " __SR ", %0\n\t"
  51. "or %0, %1, %0\n\t"
  52. "putcon %0, " __SR "\n\t"
  53. : "=&r" (__dummy0)
  54. : "r" (__dummy1));
  55. }
  56. static inline void clear_bl_bit(void)
  57. {
  58. unsigned long long __dummy0, __dummy1 = ~SR_BL_LL;
  59. __asm__ __volatile__("getcon " __SR ", %0\n\t"
  60. "and %0, %1, %0\n\t"
  61. "putcon %0, " __SR "\n\t"
  62. : "=&r" (__dummy0)
  63. : "r" (__dummy1));
  64. }
  65. #endif /* __ASM_SH_SYSTEM_64_H */