1 /* system.h: FR-V CPU control definitions
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
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.
15 #include <linux/config.h> /* get configuration macros */
16 #include <linux/linkage.h>
17 #include <asm/atomic.h>
21 #define prepare_to_switch() do { } while(0)
24 * switch_to(prev, next) should switch from task `prev' to `next'
25 * `prev' will never be the same as `next'.
26 * The `mb' is to tell GCC not to cache `current' across this call.
29 struct task_struct *__switch_to(struct thread_struct *prev_thread,
30 struct thread_struct *next_thread,
31 struct task_struct *prev);
33 #define switch_to(prev, next, last) \
35 (prev)->thread.sched_lr = \
36 (unsigned long) __builtin_return_address(0); \
37 (last) = __switch_to(&(prev)->thread, &(next)->thread, (prev)); \
42 * interrupt flag manipulation
44 #define local_irq_disable() \
47 asm volatile(" movsg psr,%0 \n" \
52 : "i" (PSR_PIL_14), "i" (~PSR_PIL) \
56 #define local_irq_enable() \
59 asm volatile(" movsg psr,%0 \n" \
67 #define local_save_flags(flags) \
69 typecheck(unsigned long, flags); \
76 #define local_irq_save(flags) \
79 typecheck(unsigned long, flags); \
80 asm volatile(" movsg psr,%0 \n" \
84 : "=r"(flags), "=r"(npsr) \
85 : "i" (PSR_PIL_14), "i" (~PSR_PIL) \
89 #define local_irq_restore(flags) \
91 typecheck(unsigned long, flags); \
92 asm volatile(" movgs %0,psr \n" \
98 #define irqs_disabled() \
99 ((__get_PSR() & PSR_PIL) >= PSR_PIL_14)
102 * Force strict CPU ordering.
104 #define nop() asm volatile ("nop"::)
105 #define mb() asm volatile ("membar" : : :"memory")
106 #define rmb() asm volatile ("membar" : : :"memory")
107 #define wmb() asm volatile ("membar" : : :"memory")
108 #define set_mb(var, value) do { var = value; mb(); } while (0)
109 #define set_wmb(var, value) do { var = value; wmb(); } while (0)
111 #define smp_mb() mb()
112 #define smp_rmb() rmb()
113 #define smp_wmb() wmb()
115 #define read_barrier_depends() do {} while(0)
116 #define smp_read_barrier_depends() read_barrier_depends()
118 #define HARD_RESET_NOW() \
123 extern void die_if_kernel(const char *, ...) __attribute__((format(printf, 1, 2)));
124 extern void free_initmem(void);
126 #define arch_align_stack(x) (x)
128 #endif /* _ASM_SYSTEM_H */