summaryrefslogtreecommitdiffstats
path: root/include/asm-m68k/system.h
blob: e987f1f463d179ed4eb6e0112308860e83020c67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 *  linux/include/asm-m68k/system.h
 *
 *  Copyright (C) 1991, 1992  Linus Torvalds
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file README.legal in the main directory of this archive
 * for more details.
 */

/*
 * 680x0 support added by Hamish Macdonald
 */

#ifndef _M68K_SYSTEM_H
#define _M68K_SYSTEM_H

#include <linux/config.h> /* get configuration macros */

#if defined(CONFIG_ATARI) && !defined(CONFIG_AMIGA) && !defined(CONFIG_MAC)
/* block out HSYNC on the atari */
#define sti() __asm__ __volatile__ ("andiw #0xfbff,sr": : : "memory")
#else /* portable version */
#define sti() __asm__ __volatile__ ("andiw #0xf8ff,sr": : : "memory")
#endif /* machine compilation types */ 
#define cli() __asm__ __volatile__ ("oriw  #0x0700,sr": : : "memory")
#define nop() __asm__ __volatile__ ("nop"::)

#define save_flags(x) \
__asm__ __volatile__("movew sr,%0":"=d" (x) : /* no input */ :"memory")

#define restore_flags(x) \
__asm__ __volatile__("movew %0,sr": /* no outputs */ :"d" (x) : "memory")

#define iret() __asm__ __volatile__ ("rte": : :"memory", "sp", "cc")

#define move_to_user_mode() \
    __asm__ __volatile__ ("movel sp,usp\n\t"     /* setup user sp       */ \
			  "movec %0,msp\n\t"     /* setup kernel sp     */ \
			  "andiw #0xdfff,sr"     /* return to user mode */ \
			  : /* no output */                                \
			  : "r" (current->kernel_stack_page + PAGE_SIZE)   \
			  : "memory", "sp")

static inline void clear_fpu(void) {
	unsigned long nilstate = 0;
	__asm__ __volatile__ ("frestore %0@" : : "a" (&nilstate));
}

#define halt() \
        __asm__ __volatile__ ("halt")

#endif /* _M68K_SYSTEM_H */