1 /* 2 * include/asm-mips/system.h 3 * 4 * This file is subject to the terms and conditions of the GNU General Public 5 * License. See the file "COPYING" in the main directory of this archive 6 * for more details. 7 * 8 * Copyright (C) 1994 by Ralf Baechle 9 */ 10
11 #ifndef_ASM_MIPS_SYSTEM_H_ 12 #define_ASM_MIPS_SYSTEM_H_ 13
14 #include <linux/segment.h>
15 #include <mips/mipsregs.h>
16
17 /* 18 * move_to_user_mode() doesn't switch to user mode on the mips, since 19 * that would run us into problems: The kernel is located at virtual 20 * address 0x80000000. If we now would switch over to user mode, we 21 * we would immediately get an address error exception. 22 * Anyway - we don't have problems with a task running in kernel mode, 23 * as long it's code is foolproof. 24 */ 25 #definemove_to_user_mode()
26
27 #definesti() \
28 __asm____volatile__( \
29 "mfc0\t$1,"STR(CP0_STATUS)"\n\t" \
30 "ori\t$1,$1,1\n\t" \
31 "mtc0\t$1,"STR(CP0_STATUS)"\n\t" \
32 : /* no outputs */ \
33 : /* no inputs */ \
34 : "$1","memory")
35
36 #definecli() \
37 __asm____volatile__( \
38 "mfc0\t$1,"STR(CP0_STATUS)"\n\t" \
39 "srl\t$1,$1,1\n\t" \
40 "sll\t$1,$1,1\n\t" \
41 "mtc0\t$1,"STR(CP0_STATUS)"\n\t" \
42 : /* no outputs */ \
43 : /* no inputs */ \
44 : "$1","memory")
45
46 #definenop() __asm____volatile__ ("nop")
47
48 #definesave_flags(x) \
49 __asm____volatile__( \
50 ".set\tnoreorder\n\t" \
51 ".set\tnoat\n\t" \
52 "mfc0\t%0,$12\n\t" \
53 ".set\tat\n\t" \
54 ".set\treorder" \
55 : "=r" (x) \
56 : /* no inputs */ \
57 : "memory")
58
59 #definerestore_flags(x) \
60 __asm____volatile__( \
61 ".set\tnoreorder\n\t" \
62 ".set\tnoat\n\t" \
63 "mtc0\t%0,$12\n\t" \
64 ".set\tat\n\t" \
65 ".set\treorder" \
66 : /* no output */ \
67 : "r" (x) \
68 : "memory")
69
70 #endif/* _ASM_MIPS_SYSTEM_H_ */