blob: 3391bb6b21d8755a41b8f11e3e25ee3d9fe38e7a [file] [log] [blame]
Paul Mundta62a3862007-11-10 19:46:31 +09001#ifndef __ASM_SH_SYSTEM_64_H
2#define __ASM_SH_SYSTEM_64_H
3
4/*
5 * include/asm-sh/system_64.h
6 *
7 * Copyright (C) 2000, 2001 Paolo Alberelli
8 * Copyright (C) 2003 Paul Mundt
9 * Copyright (C) 2004 Richard Curnow
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 */
Paul Mundt03fdb702009-10-17 21:06:39 +090015#include <cpu/registers.h>
Paul Mundta62a3862007-11-10 19:46:31 +090016#include <asm/processor.h>
17
18/*
19 * switch_to() should switch tasks to task nr n, first
20 */
21struct task_struct *sh64_switch_to(struct task_struct *prev,
22 struct thread_struct *prev_thread,
23 struct task_struct *next,
24 struct thread_struct *next_thread);
25
26#define switch_to(prev,next,last) \
27do { \
28 if (last_task_used_math != next) { \
29 struct pt_regs *regs = next->thread.uregs; \
30 if (regs) regs->sr |= SR_FD; \
31 } \
32 last = sh64_switch_to(prev, &prev->thread, next, \
33 &next->thread); \
34} while (0)
35
Stuart Menefycbaa1182007-11-30 17:06:36 +090036#define jump_to_uncached() do { } while (0)
37#define back_to_cached() do { } while (0)
Paul Mundta62a3862007-11-10 19:46:31 +090038
Paul Mundt94ecd222009-08-16 01:50:17 +090039#define __icbi(addr) __asm__ __volatile__ ( "icbi %0, 0\n\t" : : "r" (addr))
40#define __ocbp(addr) __asm__ __volatile__ ( "ocbp %0, 0\n\t" : : "r" (addr))
41#define __ocbi(addr) __asm__ __volatile__ ( "ocbi %0, 0\n\t" : : "r" (addr))
42#define __ocbwb(addr) __asm__ __volatile__ ( "ocbwb %0, 0\n\t" : : "r" (addr))
43
Paul Mundt43bc61d2009-08-15 01:57:36 +090044static inline reg_size_t register_align(void *val)
45{
46 return (unsigned long long)(signed long long)(signed long)val;
47}
48
Paul Mundtfbb82b02010-01-20 16:42:52 +090049extern void phys_stext(void);
50
51static inline void trigger_address_error(void)
52{
53 phys_stext();
54}
55
Paul Mundt03fdb702009-10-17 21:06:39 +090056#define SR_BL_LL 0x0000000010000000LL
57
58static inline void set_bl_bit(void)
59{
60 unsigned long long __dummy0, __dummy1 = SR_BL_LL;
61
62 __asm__ __volatile__("getcon " __SR ", %0\n\t"
63 "or %0, %1, %0\n\t"
64 "putcon %0, " __SR "\n\t"
65 : "=&r" (__dummy0)
66 : "r" (__dummy1));
67
68}
69
70static inline void clear_bl_bit(void)
71{
72 unsigned long long __dummy0, __dummy1 = ~SR_BL_LL;
73
74 __asm__ __volatile__("getcon " __SR ", %0\n\t"
75 "and %0, %1, %0\n\t"
76 "putcon %0, " __SR "\n\t"
77 : "=&r" (__dummy0)
78 : "r" (__dummy1));
79}
80
Paul Mundta62a3862007-11-10 19:46:31 +090081#endif /* __ASM_SH_SYSTEM_64_H */