diff options
Diffstat (limited to 'include/asm-s390/processor.h')
| -rw-r--r-- | include/asm-s390/processor.h | 163 |
1 files changed, 90 insertions, 73 deletions
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h index c5cbc4bd8414..cbbedc63ba25 100644 --- a/include/asm-s390/processor.h +++ b/include/asm-s390/processor.h | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | #ifndef __ASM_S390_PROCESSOR_H | 13 | #ifndef __ASM_S390_PROCESSOR_H |
| 14 | #define __ASM_S390_PROCESSOR_H | 14 | #define __ASM_S390_PROCESSOR_H |
| 15 | 15 | ||
| 16 | #include <asm/page.h> | ||
| 17 | #include <asm/ptrace.h> | 16 | #include <asm/ptrace.h> |
| 18 | 17 | ||
| 19 | #ifdef __KERNEL__ | 18 | #ifdef __KERNEL__ |
| @@ -21,7 +20,7 @@ | |||
| 21 | * Default implementation of macro that returns current | 20 | * Default implementation of macro that returns current |
| 22 | * instruction pointer ("program counter"). | 21 | * instruction pointer ("program counter"). |
| 23 | */ | 22 | */ |
| 24 | #define current_text_addr() ({ void *pc; __asm__("basr %0,0":"=a"(pc)); pc; }) | 23 | #define current_text_addr() ({ void *pc; asm("basr %0,0" : "=a" (pc)); pc; }) |
| 25 | 24 | ||
| 26 | /* | 25 | /* |
| 27 | * CPU type and hardware bug flags. Kept separately for each CPU. | 26 | * CPU type and hardware bug flags. Kept separately for each CPU. |
| @@ -199,15 +198,13 @@ unsigned long get_wchan(struct task_struct *p); | |||
| 199 | /* | 198 | /* |
| 200 | * Give up the time slice of the virtual PU. | 199 | * Give up the time slice of the virtual PU. |
| 201 | */ | 200 | */ |
| 202 | #ifndef __s390x__ | 201 | static inline void cpu_relax(void) |
| 203 | # define cpu_relax() asm volatile ("diag 0,0,68" : : : "memory") | 202 | { |
| 204 | #else /* __s390x__ */ | 203 | if (MACHINE_HAS_DIAG44) |
| 205 | # define cpu_relax() \ | 204 | asm volatile("diag 0,0,68" : : : "memory"); |
| 206 | do { \ | 205 | else |
| 207 | if (MACHINE_HAS_DIAG44) \ | 206 | barrier(); |
| 208 | asm volatile ("diag 0,0,68" : : : "memory"); \ | 207 | } |
| 209 | } while (0) | ||
| 210 | #endif /* __s390x__ */ | ||
| 211 | 208 | ||
| 212 | /* | 209 | /* |
| 213 | * Set PSW to specified value. | 210 | * Set PSW to specified value. |
| @@ -215,9 +212,9 @@ unsigned long get_wchan(struct task_struct *p); | |||
| 215 | static inline void __load_psw(psw_t psw) | 212 | static inline void __load_psw(psw_t psw) |
| 216 | { | 213 | { |
| 217 | #ifndef __s390x__ | 214 | #ifndef __s390x__ |
| 218 | asm volatile ("lpsw 0(%0)" : : "a" (&psw), "m" (psw) : "cc" ); | 215 | asm volatile("lpsw 0(%0)" : : "a" (&psw), "m" (psw) : "cc"); |
| 219 | #else | 216 | #else |
| 220 | asm volatile ("lpswe 0(%0)" : : "a" (&psw), "m" (psw) : "cc" ); | 217 | asm volatile("lpswe 0(%0)" : : "a" (&psw), "m" (psw) : "cc"); |
| 221 | #endif | 218 | #endif |
| 222 | } | 219 | } |
| 223 | 220 | ||
| @@ -234,20 +231,20 @@ static inline void __load_psw_mask (unsigned long mask) | |||
| 234 | psw.mask = mask; | 231 | psw.mask = mask; |
| 235 | 232 | ||
| 236 | #ifndef __s390x__ | 233 | #ifndef __s390x__ |
| 237 | asm volatile ( | 234 | asm volatile( |
| 238 | " basr %0,0\n" | 235 | " basr %0,0\n" |
| 239 | "0: ahi %0,1f-0b\n" | 236 | "0: ahi %0,1f-0b\n" |
| 240 | " st %0,4(%1)\n" | 237 | " st %0,4(%1)\n" |
| 241 | " lpsw 0(%1)\n" | 238 | " lpsw 0(%1)\n" |
| 242 | "1:" | 239 | "1:" |
| 243 | : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc" ); | 240 | : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc"); |
| 244 | #else /* __s390x__ */ | 241 | #else /* __s390x__ */ |
| 245 | asm volatile ( | 242 | asm volatile( |
| 246 | " larl %0,1f\n" | 243 | " larl %0,1f\n" |
| 247 | " stg %0,8(%1)\n" | 244 | " stg %0,8(%1)\n" |
| 248 | " lpswe 0(%1)\n" | 245 | " lpswe 0(%1)\n" |
| 249 | "1:" | 246 | "1:" |
| 250 | : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc" ); | 247 | : "=&d" (addr) : "a" (&psw), "m" (psw) : "memory", "cc"); |
| 251 | #endif /* __s390x__ */ | 248 | #endif /* __s390x__ */ |
| 252 | } | 249 | } |
| 253 | 250 | ||
| @@ -276,56 +273,57 @@ static inline void disabled_wait(unsigned long code) | |||
| 276 | * the processor is dead afterwards | 273 | * the processor is dead afterwards |
| 277 | */ | 274 | */ |
| 278 | #ifndef __s390x__ | 275 | #ifndef __s390x__ |
| 279 | asm volatile (" stctl 0,0,0(%2)\n" | 276 | asm volatile( |
| 280 | " ni 0(%2),0xef\n" /* switch off protection */ | 277 | " stctl 0,0,0(%2)\n" |
| 281 | " lctl 0,0,0(%2)\n" | 278 | " ni 0(%2),0xef\n" /* switch off protection */ |
| 282 | " stpt 0xd8\n" /* store timer */ | 279 | " lctl 0,0,0(%2)\n" |
| 283 | " stckc 0xe0\n" /* store clock comparator */ | 280 | " stpt 0xd8\n" /* store timer */ |
| 284 | " stpx 0x108\n" /* store prefix register */ | 281 | " stckc 0xe0\n" /* store clock comparator */ |
| 285 | " stam 0,15,0x120\n" /* store access registers */ | 282 | " stpx 0x108\n" /* store prefix register */ |
| 286 | " std 0,0x160\n" /* store f0 */ | 283 | " stam 0,15,0x120\n" /* store access registers */ |
| 287 | " std 2,0x168\n" /* store f2 */ | 284 | " std 0,0x160\n" /* store f0 */ |
| 288 | " std 4,0x170\n" /* store f4 */ | 285 | " std 2,0x168\n" /* store f2 */ |
| 289 | " std 6,0x178\n" /* store f6 */ | 286 | " std 4,0x170\n" /* store f4 */ |
| 290 | " stm 0,15,0x180\n" /* store general registers */ | 287 | " std 6,0x178\n" /* store f6 */ |
| 291 | " stctl 0,15,0x1c0\n" /* store control registers */ | 288 | " stm 0,15,0x180\n" /* store general registers */ |
| 292 | " oi 0x1c0,0x10\n" /* fake protection bit */ | 289 | " stctl 0,15,0x1c0\n" /* store control registers */ |
| 293 | " lpsw 0(%1)" | 290 | " oi 0x1c0,0x10\n" /* fake protection bit */ |
| 294 | : "=m" (ctl_buf) | 291 | " lpsw 0(%1)" |
| 295 | : "a" (&dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc" ); | 292 | : "=m" (ctl_buf) |
| 293 | : "a" (&dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc"); | ||
| 296 | #else /* __s390x__ */ | 294 | #else /* __s390x__ */ |
| 297 | asm volatile (" stctg 0,0,0(%2)\n" | 295 | asm volatile( |
| 298 | " ni 4(%2),0xef\n" /* switch off protection */ | 296 | " stctg 0,0,0(%2)\n" |
| 299 | " lctlg 0,0,0(%2)\n" | 297 | " ni 4(%2),0xef\n" /* switch off protection */ |
| 300 | " lghi 1,0x1000\n" | 298 | " lctlg 0,0,0(%2)\n" |
| 301 | " stpt 0x328(1)\n" /* store timer */ | 299 | " lghi 1,0x1000\n" |
| 302 | " stckc 0x330(1)\n" /* store clock comparator */ | 300 | " stpt 0x328(1)\n" /* store timer */ |
| 303 | " stpx 0x318(1)\n" /* store prefix register */ | 301 | " stckc 0x330(1)\n" /* store clock comparator */ |
| 304 | " stam 0,15,0x340(1)\n" /* store access registers */ | 302 | " stpx 0x318(1)\n" /* store prefix register */ |
| 305 | " stfpc 0x31c(1)\n" /* store fpu control */ | 303 | " stam 0,15,0x340(1)\n"/* store access registers */ |
| 306 | " std 0,0x200(1)\n" /* store f0 */ | 304 | " stfpc 0x31c(1)\n" /* store fpu control */ |
| 307 | " std 1,0x208(1)\n" /* store f1 */ | 305 | " std 0,0x200(1)\n" /* store f0 */ |
| 308 | " std 2,0x210(1)\n" /* store f2 */ | 306 | " std 1,0x208(1)\n" /* store f1 */ |
| 309 | " std 3,0x218(1)\n" /* store f3 */ | 307 | " std 2,0x210(1)\n" /* store f2 */ |
| 310 | " std 4,0x220(1)\n" /* store f4 */ | 308 | " std 3,0x218(1)\n" /* store f3 */ |
| 311 | " std 5,0x228(1)\n" /* store f5 */ | 309 | " std 4,0x220(1)\n" /* store f4 */ |
| 312 | " std 6,0x230(1)\n" /* store f6 */ | 310 | " std 5,0x228(1)\n" /* store f5 */ |
| 313 | " std 7,0x238(1)\n" /* store f7 */ | 311 | " std 6,0x230(1)\n" /* store f6 */ |
| 314 | " std 8,0x240(1)\n" /* store f8 */ | 312 | " std 7,0x238(1)\n" /* store f7 */ |
| 315 | " std 9,0x248(1)\n" /* store f9 */ | 313 | " std 8,0x240(1)\n" /* store f8 */ |
| 316 | " std 10,0x250(1)\n" /* store f10 */ | 314 | " std 9,0x248(1)\n" /* store f9 */ |
| 317 | " std 11,0x258(1)\n" /* store f11 */ | 315 | " std 10,0x250(1)\n" /* store f10 */ |
| 318 | " std 12,0x260(1)\n" /* store f12 */ | 316 | " std 11,0x258(1)\n" /* store f11 */ |
| 319 | " std 13,0x268(1)\n" /* store f13 */ | 317 | " std 12,0x260(1)\n" /* store f12 */ |
| 320 | " std 14,0x270(1)\n" /* store f14 */ | 318 | " std 13,0x268(1)\n" /* store f13 */ |
| 321 | " std 15,0x278(1)\n" /* store f15 */ | 319 | " std 14,0x270(1)\n" /* store f14 */ |
| 322 | " stmg 0,15,0x280(1)\n" /* store general registers */ | 320 | " std 15,0x278(1)\n" /* store f15 */ |
| 323 | " stctg 0,15,0x380(1)\n" /* store control registers */ | 321 | " stmg 0,15,0x280(1)\n"/* store general registers */ |
| 324 | " oi 0x384(1),0x10\n" /* fake protection bit */ | 322 | " stctg 0,15,0x380(1)\n"/* store control registers */ |
| 325 | " lpswe 0(%1)" | 323 | " oi 0x384(1),0x10\n"/* fake protection bit */ |
| 326 | : "=m" (ctl_buf) | 324 | " lpswe 0(%1)" |
| 327 | : "a" (&dw_psw), "a" (&ctl_buf), | 325 | : "=m" (ctl_buf) |
| 328 | "m" (dw_psw) : "cc", "0", "1"); | 326 | : "a" (&dw_psw), "a" (&ctl_buf), "m" (dw_psw) : "cc", "0"); |
| 329 | #endif /* __s390x__ */ | 327 | #endif /* __s390x__ */ |
| 330 | } | 328 | } |
| 331 | 329 | ||
| @@ -339,6 +337,25 @@ struct notifier_block; | |||
| 339 | int register_idle_notifier(struct notifier_block *nb); | 337 | int register_idle_notifier(struct notifier_block *nb); |
| 340 | int unregister_idle_notifier(struct notifier_block *nb); | 338 | int unregister_idle_notifier(struct notifier_block *nb); |
| 341 | 339 | ||
| 340 | #define ARCH_LOW_ADDRESS_LIMIT 0x7fffffffUL | ||
| 341 | |||
| 342 | #endif | ||
| 343 | |||
| 344 | /* | ||
| 345 | * Helper macro for exception table entries | ||
| 346 | */ | ||
| 347 | #ifndef __s390x__ | ||
| 348 | #define EX_TABLE(_fault,_target) \ | ||
| 349 | ".section __ex_table,\"a\"\n" \ | ||
| 350 | " .align 4\n" \ | ||
| 351 | " .long " #_fault "," #_target "\n" \ | ||
| 352 | ".previous\n" | ||
| 353 | #else | ||
| 354 | #define EX_TABLE(_fault,_target) \ | ||
| 355 | ".section __ex_table,\"a\"\n" \ | ||
| 356 | " .align 8\n" \ | ||
| 357 | " .quad " #_fault "," #_target "\n" \ | ||
| 358 | ".previous\n" | ||
| 342 | #endif | 359 | #endif |
| 343 | 360 | ||
| 344 | #endif /* __ASM_S390_PROCESSOR_H */ | 361 | #endif /* __ASM_S390_PROCESSOR_H */ |
