diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2011-10-30 10:16:50 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2011-10-30 10:16:43 -0400 |
commit | b50511e41aa51a89b4176784a670582424bc7db6 (patch) | |
tree | 0ad1553c7f2431878310e590187ee59ccb4d8cab /arch/s390/include | |
parent | b6ef5bb3d93efb95ba855a628740375c2280a59e (diff) |
[S390] cleanup psw related bits and pieces
Split out addressing mode bits from PSW_BASE_BITS, rename PSW_BASE_BITS
to PSW_MASK_BASE, get rid of psw_user32_bits, remove unused function
enabled_wait(), introduce PSW_MASK_USER, and drop PSW_MASK_MERGE macros.
Change psw_kernel_bits / psw_user_bits to contain only the bits that
are always set in the respective mode.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/include')
-rw-r--r-- | arch/s390/include/asm/compat.h | 13 | ||||
-rw-r--r-- | arch/s390/include/asm/processor.h | 30 | ||||
-rw-r--r-- | arch/s390/include/asm/ptrace.h | 20 | ||||
-rw-r--r-- | arch/s390/include/asm/system.h | 6 |
4 files changed, 26 insertions, 43 deletions
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h index cdb9b78f6c08..2e49748b27da 100644 --- a/arch/s390/include/asm/compat.h +++ b/arch/s390/include/asm/compat.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #define PSW32_MASK_IO 0x02000000UL | 12 | #define PSW32_MASK_IO 0x02000000UL |
13 | #define PSW32_MASK_EXT 0x01000000UL | 13 | #define PSW32_MASK_EXT 0x01000000UL |
14 | #define PSW32_MASK_KEY 0x00F00000UL | 14 | #define PSW32_MASK_KEY 0x00F00000UL |
15 | #define PSW32_MASK_BASE 0x00080000UL /* Always one */ | ||
15 | #define PSW32_MASK_MCHECK 0x00040000UL | 16 | #define PSW32_MASK_MCHECK 0x00040000UL |
16 | #define PSW32_MASK_WAIT 0x00020000UL | 17 | #define PSW32_MASK_WAIT 0x00020000UL |
17 | #define PSW32_MASK_PSTATE 0x00010000UL | 18 | #define PSW32_MASK_PSTATE 0x00010000UL |
@@ -19,21 +20,19 @@ | |||
19 | #define PSW32_MASK_CC 0x00003000UL | 20 | #define PSW32_MASK_CC 0x00003000UL |
20 | #define PSW32_MASK_PM 0x00000f00UL | 21 | #define PSW32_MASK_PM 0x00000f00UL |
21 | 22 | ||
22 | #define PSW32_ADDR_AMODE31 0x80000000UL | 23 | #define PSW32_MASK_USER 0x00003F00UL |
24 | |||
25 | #define PSW32_ADDR_AMODE 0x80000000UL | ||
23 | #define PSW32_ADDR_INSN 0x7FFFFFFFUL | 26 | #define PSW32_ADDR_INSN 0x7FFFFFFFUL |
24 | 27 | ||
25 | #define PSW32_BASE_BITS 0x00080000UL | 28 | #define PSW32_DEFAULT_KEY (((u32) PAGE_DEFAULT_ACC) << 20) |
26 | 29 | ||
27 | #define PSW32_ASC_PRIMARY 0x00000000UL | 30 | #define PSW32_ASC_PRIMARY 0x00000000UL |
28 | #define PSW32_ASC_ACCREG 0x00004000UL | 31 | #define PSW32_ASC_ACCREG 0x00004000UL |
29 | #define PSW32_ASC_SECONDARY 0x00008000UL | 32 | #define PSW32_ASC_SECONDARY 0x00008000UL |
30 | #define PSW32_ASC_HOME 0x0000C000UL | 33 | #define PSW32_ASC_HOME 0x0000C000UL |
31 | 34 | ||
32 | #define PSW32_MASK_MERGE(CURRENT,NEW) \ | 35 | extern u32 psw32_user_bits; |
33 | (((CURRENT) & ~(PSW32_MASK_CC|PSW32_MASK_PM)) | \ | ||
34 | ((NEW) & (PSW32_MASK_CC|PSW32_MASK_PM))) | ||
35 | |||
36 | extern long psw32_user_bits; | ||
37 | 36 | ||
38 | #define COMPAT_USER_HZ 100 | 37 | #define COMPAT_USER_HZ 100 |
39 | #define COMPAT_UTS_MACHINE "s390\0\0\0\0" | 38 | #define COMPAT_UTS_MACHINE "s390\0\0\0\0" |
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h index 306c93c1b184..20ffb12d4ae9 100644 --- a/arch/s390/include/asm/processor.h +++ b/arch/s390/include/asm/processor.h | |||
@@ -118,17 +118,17 @@ struct stack_frame { | |||
118 | /* | 118 | /* |
119 | * Do necessary setup to start up a new thread. | 119 | * Do necessary setup to start up a new thread. |
120 | */ | 120 | */ |
121 | #define start_thread(regs, new_psw, new_stackp) do { \ | 121 | #define start_thread(regs, new_psw, new_stackp) do { \ |
122 | regs->psw.mask = psw_user_bits; \ | 122 | regs->psw.mask = psw_user_bits | PSW_MASK_EA | PSW_MASK_BA; \ |
123 | regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ | 123 | regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ |
124 | regs->gprs[15] = new_stackp; \ | 124 | regs->gprs[15] = new_stackp; \ |
125 | } while (0) | 125 | } while (0) |
126 | 126 | ||
127 | #define start_thread31(regs, new_psw, new_stackp) do { \ | 127 | #define start_thread31(regs, new_psw, new_stackp) do { \ |
128 | regs->psw.mask = psw_user32_bits; \ | 128 | regs->psw.mask = psw_user_bits | PSW_MASK_BA; \ |
129 | regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ | 129 | regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ |
130 | regs->gprs[15] = new_stackp; \ | 130 | regs->gprs[15] = new_stackp; \ |
131 | crst_table_downgrade(current->mm, 1UL << 31); \ | 131 | crst_table_downgrade(current->mm, 1UL << 31); \ |
132 | } while (0) | 132 | } while (0) |
133 | 133 | ||
134 | /* Forward declaration, a strange C thing */ | 134 | /* Forward declaration, a strange C thing */ |
@@ -234,24 +234,14 @@ static inline unsigned long __rewind_psw(psw_t psw, unsigned long ilc) | |||
234 | } | 234 | } |
235 | 235 | ||
236 | /* | 236 | /* |
237 | * Function to stop a processor until an interruption occurred | ||
238 | */ | ||
239 | static inline void enabled_wait(void) | ||
240 | { | ||
241 | __load_psw_mask(PSW_BASE_BITS | PSW_MASK_IO | PSW_MASK_EXT | | ||
242 | PSW_MASK_MCHECK | PSW_MASK_WAIT | PSW_DEFAULT_KEY); | ||
243 | } | ||
244 | |||
245 | /* | ||
246 | * Function to drop a processor into disabled wait state | 237 | * Function to drop a processor into disabled wait state |
247 | */ | 238 | */ |
248 | |||
249 | static inline void ATTRIB_NORET disabled_wait(unsigned long code) | 239 | static inline void ATTRIB_NORET disabled_wait(unsigned long code) |
250 | { | 240 | { |
251 | unsigned long ctl_buf; | 241 | unsigned long ctl_buf; |
252 | psw_t dw_psw; | 242 | psw_t dw_psw; |
253 | 243 | ||
254 | dw_psw.mask = PSW_BASE_BITS | PSW_MASK_WAIT; | 244 | dw_psw.mask = PSW_MASK_BASE | PSW_MASK_WAIT | PSW_MASK_BA | PSW_MASK_EA; |
255 | dw_psw.addr = code; | 245 | dw_psw.addr = code; |
256 | /* | 246 | /* |
257 | * Store status and then load disabled wait psw, | 247 | * Store status and then load disabled wait psw, |
diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h index 2904cc66967a..6fc00d268143 100644 --- a/arch/s390/include/asm/ptrace.h +++ b/arch/s390/include/asm/ptrace.h | |||
@@ -230,6 +230,7 @@ typedef struct | |||
230 | #define PSW_MASK_IO 0x02000000UL | 230 | #define PSW_MASK_IO 0x02000000UL |
231 | #define PSW_MASK_EXT 0x01000000UL | 231 | #define PSW_MASK_EXT 0x01000000UL |
232 | #define PSW_MASK_KEY 0x00F00000UL | 232 | #define PSW_MASK_KEY 0x00F00000UL |
233 | #define PSW_MASK_BASE 0x00080000UL /* always one */ | ||
233 | #define PSW_MASK_MCHECK 0x00040000UL | 234 | #define PSW_MASK_MCHECK 0x00040000UL |
234 | #define PSW_MASK_WAIT 0x00020000UL | 235 | #define PSW_MASK_WAIT 0x00020000UL |
235 | #define PSW_MASK_PSTATE 0x00010000UL | 236 | #define PSW_MASK_PSTATE 0x00010000UL |
@@ -239,10 +240,11 @@ typedef struct | |||
239 | #define PSW_MASK_EA 0x00000000UL | 240 | #define PSW_MASK_EA 0x00000000UL |
240 | #define PSW_MASK_BA 0x00000000UL | 241 | #define PSW_MASK_BA 0x00000000UL |
241 | 242 | ||
243 | #define PSW_MASK_USER 0x00003F00UL | ||
244 | |||
242 | #define PSW_ADDR_AMODE 0x80000000UL | 245 | #define PSW_ADDR_AMODE 0x80000000UL |
243 | #define PSW_ADDR_INSN 0x7FFFFFFFUL | 246 | #define PSW_ADDR_INSN 0x7FFFFFFFUL |
244 | 247 | ||
245 | #define PSW_BASE_BITS 0x00080000UL | ||
246 | #define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 20) | 248 | #define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 20) |
247 | 249 | ||
248 | #define PSW_ASC_PRIMARY 0x00000000UL | 250 | #define PSW_ASC_PRIMARY 0x00000000UL |
@@ -256,6 +258,7 @@ typedef struct | |||
256 | #define PSW_MASK_DAT 0x0400000000000000UL | 258 | #define PSW_MASK_DAT 0x0400000000000000UL |
257 | #define PSW_MASK_IO 0x0200000000000000UL | 259 | #define PSW_MASK_IO 0x0200000000000000UL |
258 | #define PSW_MASK_EXT 0x0100000000000000UL | 260 | #define PSW_MASK_EXT 0x0100000000000000UL |
261 | #define PSW_MASK_BASE 0x0000000000000000UL | ||
259 | #define PSW_MASK_KEY 0x00F0000000000000UL | 262 | #define PSW_MASK_KEY 0x00F0000000000000UL |
260 | #define PSW_MASK_MCHECK 0x0004000000000000UL | 263 | #define PSW_MASK_MCHECK 0x0004000000000000UL |
261 | #define PSW_MASK_WAIT 0x0002000000000000UL | 264 | #define PSW_MASK_WAIT 0x0002000000000000UL |
@@ -266,11 +269,11 @@ typedef struct | |||
266 | #define PSW_MASK_EA 0x0000000100000000UL | 269 | #define PSW_MASK_EA 0x0000000100000000UL |
267 | #define PSW_MASK_BA 0x0000000080000000UL | 270 | #define PSW_MASK_BA 0x0000000080000000UL |
268 | 271 | ||
272 | #define PSW_MASK_USER 0x00003F0000000000UL | ||
273 | |||
269 | #define PSW_ADDR_AMODE 0x0000000000000000UL | 274 | #define PSW_ADDR_AMODE 0x0000000000000000UL |
270 | #define PSW_ADDR_INSN 0xFFFFFFFFFFFFFFFFUL | 275 | #define PSW_ADDR_INSN 0xFFFFFFFFFFFFFFFFUL |
271 | 276 | ||
272 | #define PSW_BASE_BITS 0x0000000180000000UL | ||
273 | #define PSW_BASE32_BITS 0x0000000080000000UL | ||
274 | #define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 52) | 277 | #define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 52) |
275 | 278 | ||
276 | #define PSW_ASC_PRIMARY 0x0000000000000000UL | 279 | #define PSW_ASC_PRIMARY 0x0000000000000000UL |
@@ -283,18 +286,7 @@ typedef struct | |||
283 | #ifdef __KERNEL__ | 286 | #ifdef __KERNEL__ |
284 | extern long psw_kernel_bits; | 287 | extern long psw_kernel_bits; |
285 | extern long psw_user_bits; | 288 | extern long psw_user_bits; |
286 | #ifdef CONFIG_64BIT | ||
287 | extern long psw_user32_bits; | ||
288 | #endif | 289 | #endif |
289 | #endif | ||
290 | |||
291 | /* This macro merges a NEW PSW mask specified by the user into | ||
292 | the currently active PSW mask CURRENT, modifying only those | ||
293 | bits in CURRENT that the user may be allowed to change: this | ||
294 | is the condition code and the program mask bits. */ | ||
295 | #define PSW_MASK_MERGE(CURRENT,NEW) \ | ||
296 | (((CURRENT) & ~(PSW_MASK_CC|PSW_MASK_PM)) | \ | ||
297 | ((NEW) & (PSW_MASK_CC|PSW_MASK_PM))) | ||
298 | 290 | ||
299 | /* | 291 | /* |
300 | * The s390_regs structure is used to define the elf_gregset_t. | 292 | * The s390_regs structure is used to define the elf_gregset_t. |
diff --git a/arch/s390/include/asm/system.h b/arch/s390/include/asm/system.h index afb849e4bf4b..d73cc6b60000 100644 --- a/arch/s390/include/asm/system.h +++ b/arch/s390/include/asm/system.h | |||
@@ -212,8 +212,10 @@ __set_psw_mask(unsigned long mask) | |||
212 | __load_psw_mask(mask | (arch_local_save_flags() & ~(-1UL >> 8))); | 212 | __load_psw_mask(mask | (arch_local_save_flags() & ~(-1UL >> 8))); |
213 | } | 213 | } |
214 | 214 | ||
215 | #define local_mcck_enable() __set_psw_mask(psw_kernel_bits) | 215 | #define local_mcck_enable() \ |
216 | #define local_mcck_disable() __set_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK) | 216 | __set_psw_mask(psw_kernel_bits | PSW_MASK_DAT | PSW_MASK_MCHECK) |
217 | #define local_mcck_disable() \ | ||
218 | __set_psw_mask(psw_kernel_bits | PSW_MASK_DAT) | ||
217 | 219 | ||
218 | #ifdef CONFIG_SMP | 220 | #ifdef CONFIG_SMP |
219 | 221 | ||