patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / arch / s390 / kernel / traps.c
1 /*
2  *  arch/s390/kernel/traps.c
3  *
4  *  S390 version
5  *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6  *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7  *               Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
8  *
9  *  Derived from "arch/i386/kernel/traps.c"
10  *    Copyright (C) 1991, 1992 Linus Torvalds
11  */
12
13 /*
14  * 'Traps.c' handles hardware traps and faults after we have saved some
15  * state in 'asm.s'.
16  */
17 #include <linux/config.h>
18 #include <linux/sched.h>
19 #include <linux/kernel.h>
20 #include <linux/string.h>
21 #include <linux/errno.h>
22 #include <linux/ptrace.h>
23 #include <linux/timer.h>
24 #include <linux/mm.h>
25 #include <linux/smp.h>
26 #include <linux/smp_lock.h>
27 #include <linux/init.h>
28 #include <linux/interrupt.h>
29 #include <linux/delay.h>
30 #include <linux/module.h>
31 #include <linux/kallsyms.h>
32
33 #include <asm/system.h>
34 #include <asm/uaccess.h>
35 #include <asm/io.h>
36 #include <asm/atomic.h>
37 #include <asm/mathemu.h>
38 #include <asm/cpcmd.h>
39 #include <asm/s390_ext.h>
40 #include <asm/lowcore.h>
41
42 /* Called from entry.S only */
43 extern void handle_per_exception(struct pt_regs *regs);
44
45 typedef void pgm_check_handler_t(struct pt_regs *, long);
46 pgm_check_handler_t *pgm_check_table[128];
47
48 #ifdef CONFIG_SYSCTL
49 #ifdef CONFIG_PROCESS_DEBUG
50 int sysctl_userprocess_debug = 1;
51 #else
52 int sysctl_userprocess_debug = 0;
53 #endif
54 #endif
55
56 extern pgm_check_handler_t do_protection_exception;
57 extern pgm_check_handler_t do_segment_exception;
58 extern pgm_check_handler_t do_region_exception;
59 extern pgm_check_handler_t do_page_exception;
60 extern pgm_check_handler_t do_pseudo_page_fault;
61 #ifdef CONFIG_PFAULT
62 extern int pfault_init(void);
63 extern void pfault_fini(void);
64 extern void pfault_interrupt(struct pt_regs *regs, __u16 error_code);
65 static ext_int_info_t ext_int_pfault;
66 #endif
67 #if defined(CONFIG_NO_IDLE_HZ) || defined(CONFIG_VIRT_TIMER)
68 extern pgm_check_handler_t do_monitor_call;
69 #endif
70
71 #define stack_pointer ({ void **sp; asm("la %0,0(15)" : "=&d" (sp)); sp; })
72
73 #ifndef CONFIG_ARCH_S390X
74 #define RET_ADDR 56
75 #define FOURLONG "%08lx %08lx %08lx %08lx\n"
76 static int kstack_depth_to_print = 12;
77
78 #else /* CONFIG_ARCH_S390X */
79 #define RET_ADDR 112
80 #define FOURLONG "%016lx %016lx %016lx %016lx\n"
81 static int kstack_depth_to_print = 20;
82
83 #endif /* CONFIG_ARCH_S390X */
84
85 void show_trace(struct task_struct *task, unsigned long * stack)
86 {
87         unsigned long backchain, low_addr, high_addr, ret_addr;
88
89         if (!stack)
90                 stack = (task == NULL) ? *stack_pointer : &(task->thread.ksp);
91
92         printk("Call Trace:\n");
93         low_addr = ((unsigned long) stack) & PSW_ADDR_INSN;
94         high_addr = (low_addr & (-THREAD_SIZE)) + THREAD_SIZE;
95         /* Skip the first frame (biased stack) */
96         backchain = *((unsigned long *) low_addr) & PSW_ADDR_INSN;
97         /* Print up to 8 lines */
98         while  (backchain > low_addr && backchain <= high_addr) {
99                 ret_addr = *((unsigned long *) (backchain+RET_ADDR)) & PSW_ADDR_INSN;
100                 printk(" [<%016lx>] ", ret_addr);
101                 print_symbol("%s\n", ret_addr);
102                 low_addr = backchain;
103                 backchain = *((unsigned long *) backchain) & PSW_ADDR_INSN;
104         }
105         printk("\n");
106 }
107
108 void show_stack(struct task_struct *task, unsigned long *sp)
109 {
110         unsigned long *stack;
111         int i;
112
113         // debugging aid: "show_stack(NULL);" prints the
114         // back trace for this cpu.
115
116         if (!sp) {
117                 if (task)
118                         sp = (unsigned long *) task->thread.ksp;
119                 else
120                         sp = *stack_pointer;
121         }
122
123         stack = sp;
124         for (i = 0; i < kstack_depth_to_print; i++) {
125                 if (((addr_t) stack & (THREAD_SIZE-1)) == 0)
126                         break;
127                 if (i && ((i * sizeof (long) % 32) == 0))
128                         printk("\n       ");
129                 printk("%p ", (void *)*stack++);
130         }
131         printk("\n");
132         show_trace(task, sp);
133 }
134
135 /*
136  * The architecture-independent dump_stack generator
137  */
138 void dump_stack(void)
139 {
140         show_stack(0, 0);
141 }
142
143 EXPORT_SYMBOL(dump_stack);
144
145 void show_registers(struct pt_regs *regs)
146 {
147         mm_segment_t old_fs;
148         char *mode;
149         int i;
150
151         mode = (regs->psw.mask & PSW_MASK_PSTATE) ? "User" : "Krnl";
152         printk("%s PSW : %p %p",
153                mode, (void *) regs->psw.mask,
154                (void *) regs->psw.addr);
155         print_symbol(" (%s)\n", regs->psw.addr & PSW_ADDR_INSN);
156         printk("%s GPRS: " FOURLONG, mode,
157                regs->gprs[0], regs->gprs[1], regs->gprs[2], regs->gprs[3]);
158         printk("           " FOURLONG,
159                regs->gprs[4], regs->gprs[5], regs->gprs[6], regs->gprs[7]);
160         printk("           " FOURLONG,
161                regs->gprs[8], regs->gprs[9], regs->gprs[10], regs->gprs[11]);
162         printk("           " FOURLONG,
163                regs->gprs[12], regs->gprs[13], regs->gprs[14], regs->gprs[15]);
164
165 #if 0
166         /* FIXME: this isn't needed any more but it changes the ksymoops
167          * input. To remove or not to remove ... */
168         save_access_regs(regs->acrs);
169         printk("%s ACRS: %08x %08x %08x %08x\n", mode,
170                regs->acrs[0], regs->acrs[1], regs->acrs[2], regs->acrs[3]);
171         printk("           %08x %08x %08x %08x\n",
172                regs->acrs[4], regs->acrs[5], regs->acrs[6], regs->acrs[7]);
173         printk("           %08x %08x %08x %08x\n",
174                regs->acrs[8], regs->acrs[9], regs->acrs[10], regs->acrs[11]);
175         printk("           %08x %08x %08x %08x\n",
176                regs->acrs[12], regs->acrs[13], regs->acrs[14], regs->acrs[15]);
177 #endif
178
179         /*
180          * Print the first 20 byte of the instruction stream at the
181          * time of the fault.
182          */
183         old_fs = get_fs();
184         if (regs->psw.mask & PSW_MASK_PSTATE)
185                 set_fs(USER_DS);
186         else
187                 set_fs(KERNEL_DS);
188         printk("%s Code: ", mode);
189         for (i = 0; i < 20; i++) {
190                 unsigned char c;
191                 if (__get_user(c, (char __user *)(regs->psw.addr + i))) {
192                         printk(" Bad PSW.");
193                         break;
194                 }
195                 printk("%02x ", c);
196         }
197         set_fs(old_fs);
198
199         printk("\n");
200 }       
201
202 /* This is called from fs/proc/array.c */
203 char *task_show_regs(struct task_struct *task, char *buffer)
204 {
205         struct pt_regs *regs;
206
207         regs = __KSTK_PTREGS(task);
208         buffer += sprintf(buffer, "task: %p, ksp: %p\n",
209                        task, (void *)task->thread.ksp);
210         buffer += sprintf(buffer, "User PSW : %p %p\n",
211                        (void *) regs->psw.mask, (void *)regs->psw.addr);
212
213         buffer += sprintf(buffer, "User GPRS: " FOURLONG,
214                           regs->gprs[0], regs->gprs[1],
215                           regs->gprs[2], regs->gprs[3]);
216         buffer += sprintf(buffer, "           " FOURLONG,
217                           regs->gprs[4], regs->gprs[5],
218                           regs->gprs[6], regs->gprs[7]);
219         buffer += sprintf(buffer, "           " FOURLONG,
220                           regs->gprs[8], regs->gprs[9],
221                           regs->gprs[10], regs->gprs[11]);
222         buffer += sprintf(buffer, "           " FOURLONG,
223                           regs->gprs[12], regs->gprs[13],
224                           regs->gprs[14], regs->gprs[15]);
225         buffer += sprintf(buffer, "User ACRS: %08x %08x %08x %08x\n",
226                           task->thread.acrs[0], task->thread.acrs[1],
227                           task->thread.acrs[2], task->thread.acrs[3]);
228         buffer += sprintf(buffer, "           %08x %08x %08x %08x\n",
229                           task->thread.acrs[4], task->thread.acrs[5],
230                           task->thread.acrs[6], task->thread.acrs[7]);
231         buffer += sprintf(buffer, "           %08x %08x %08x %08x\n",
232                           task->thread.acrs[8], task->thread.acrs[9],
233                           task->thread.acrs[10], task->thread.acrs[11]);
234         buffer += sprintf(buffer, "           %08x %08x %08x %08x\n",
235                           task->thread.acrs[12], task->thread.acrs[13],
236                           task->thread.acrs[14], task->thread.acrs[15]);
237         return buffer;
238 }
239
240 spinlock_t die_lock = SPIN_LOCK_UNLOCKED;
241
242 void die(const char * str, struct pt_regs * regs, long err)
243 {
244         static int die_counter;
245         console_verbose();
246         spin_lock_irq(&die_lock);
247         bust_spinlocks(1);
248         printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
249         show_regs(regs);
250         bust_spinlocks(0);
251         spin_unlock_irq(&die_lock);
252         if (in_interrupt())
253                 panic("Fatal exception in interrupt");
254         if (panic_on_oops)
255                 panic("Fatal exception: panic_on_oops");
256         do_exit(SIGSEGV);
257 }
258
259 static void inline do_trap(long interruption_code, int signr, char *str,
260                            struct pt_regs *regs, siginfo_t *info)
261 {
262         /*
263          * We got all needed information from the lowcore and can
264          * now safely switch on interrupts.
265          */
266         if (regs->psw.mask & PSW_MASK_PSTATE)
267                 local_irq_enable();
268
269         if (regs->psw.mask & PSW_MASK_PSTATE) {
270                 struct task_struct *tsk = current;
271
272                 tsk->thread.trap_no = interruption_code & 0xffff;
273                 if (info)
274                         force_sig_info(signr, info, tsk);
275                 else
276                         force_sig(signr, tsk);
277 #ifndef CONFIG_SYSCTL
278 #ifdef CONFIG_PROCESS_DEBUG
279                 printk("User process fault: interruption code 0x%lX\n",
280                        interruption_code);
281                 show_regs(regs);
282 #endif
283 #else
284                 if (sysctl_userprocess_debug) {
285                         printk("User process fault: interruption code 0x%lX\n",
286                                interruption_code);
287                         show_regs(regs);
288                 }
289 #endif
290         } else {
291                 const struct exception_table_entry *fixup;
292                 fixup = search_exception_tables(regs->psw.addr & PSW_ADDR_INSN);
293                 if (fixup)
294                         regs->psw.addr = fixup->fixup | PSW_ADDR_AMODE;
295                 else
296                         die(str, regs, interruption_code);
297         }
298 }
299
300 static inline void *get_check_address(struct pt_regs *regs)
301 {
302         return (void *)((regs->psw.addr-S390_lowcore.pgm_ilc) & PSW_ADDR_INSN);
303 }
304
305 int do_debugger_trap(struct pt_regs *regs)
306 {
307         if ((regs->psw.mask & PSW_MASK_PSTATE) &&
308             (current->ptrace & PT_PTRACED)) {
309                 force_sig(SIGTRAP,current);
310                 return 0;
311         }
312         return 1;
313 }
314
315 #define DO_ERROR(signr, str, name) \
316 asmlinkage void name(struct pt_regs * regs, long interruption_code) \
317 { \
318         do_trap(interruption_code, signr, str, regs, NULL); \
319 }
320
321 #define DO_ERROR_INFO(signr, str, name, sicode, siaddr) \
322 asmlinkage void name(struct pt_regs * regs, long interruption_code) \
323 { \
324         siginfo_t info; \
325         info.si_signo = signr; \
326         info.si_errno = 0; \
327         info.si_code = sicode; \
328         info.si_addr = (void *)siaddr; \
329         do_trap(interruption_code, signr, str, regs, &info); \
330 }
331
332 DO_ERROR(SIGSEGV, "Unknown program exception", default_trap_handler)
333
334 DO_ERROR_INFO(SIGBUS, "addressing exception", addressing_exception,
335               BUS_ADRERR, get_check_address(regs))
336 DO_ERROR_INFO(SIGILL,  "execute exception", execute_exception,
337               ILL_ILLOPN, get_check_address(regs))
338 DO_ERROR_INFO(SIGFPE,  "fixpoint divide exception", divide_exception,
339               FPE_INTDIV, get_check_address(regs))
340 DO_ERROR_INFO(SIGILL,  "operand exception", operand_exception,
341               ILL_ILLOPN, get_check_address(regs))
342 DO_ERROR_INFO(SIGILL,  "privileged operation", privileged_op,
343               ILL_PRVOPC, get_check_address(regs))
344 DO_ERROR_INFO(SIGILL,  "special operation exception", special_op_exception,
345               ILL_ILLOPN, get_check_address(regs))
346 DO_ERROR_INFO(SIGILL,  "translation exception", translation_exception,
347               ILL_ILLOPN, get_check_address(regs))
348
349 static inline void
350 do_fp_trap(struct pt_regs *regs, void *location,
351            int fpc, long interruption_code)
352 {
353         siginfo_t si;
354
355         si.si_signo = SIGFPE;
356         si.si_errno = 0;
357         si.si_addr = location;
358         si.si_code = 0;
359         /* FPC[2] is Data Exception Code */
360         if ((fpc & 0x00000300) == 0) {
361                 /* bits 6 and 7 of DXC are 0 iff IEEE exception */
362                 if (fpc & 0x8000) /* invalid fp operation */
363                         si.si_code = FPE_FLTINV;
364                 else if (fpc & 0x4000) /* div by 0 */
365                         si.si_code = FPE_FLTDIV;
366                 else if (fpc & 0x2000) /* overflow */
367                         si.si_code = FPE_FLTOVF;
368                 else if (fpc & 0x1000) /* underflow */
369                         si.si_code = FPE_FLTUND;
370                 else if (fpc & 0x0800) /* inexact */
371                         si.si_code = FPE_FLTRES;
372         }
373         current->thread.ieee_instruction_pointer = (addr_t) location;
374         do_trap(interruption_code, SIGFPE,
375                 "floating point exception", regs, &si);
376 }
377
378 asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
379 {
380         __u8 opcode[6];
381         __u16 *location;
382         int signal = 0;
383
384         location = (__u16 *) get_check_address(regs);
385
386         /*
387          * We got all needed information from the lowcore and can
388          * now safely switch on interrupts.
389          */
390         if (regs->psw.mask & PSW_MASK_PSTATE)
391                 local_irq_enable();
392
393         if (regs->psw.mask & PSW_MASK_PSTATE)
394                 get_user(*((__u16 *) opcode), (__u16 __user *)location);
395         else
396                 *((__u16 *)opcode)=*((__u16 *)location);
397         if (*((__u16 *)opcode)==S390_BREAKPOINT_U16)
398         {
399                 if(do_debugger_trap(regs))
400                         signal = SIGILL;
401         }
402 #ifdef CONFIG_MATHEMU
403         else if (regs->psw.mask & PSW_MASK_PSTATE)
404         {
405                 if (opcode[0] == 0xb3) {
406                         get_user(*((__u16 *) (opcode+2)), location+1);
407                         signal = math_emu_b3(opcode, regs);
408                 } else if (opcode[0] == 0xed) {
409                         get_user(*((__u32 *) (opcode+2)),
410                                  (__u32 *)(location+1));
411                         signal = math_emu_ed(opcode, regs);
412                 } else if (*((__u16 *) opcode) == 0xb299) {
413                         get_user(*((__u16 *) (opcode+2)), location+1);
414                         signal = math_emu_srnm(opcode, regs);
415                 } else if (*((__u16 *) opcode) == 0xb29c) {
416                         get_user(*((__u16 *) (opcode+2)), location+1);
417                         signal = math_emu_stfpc(opcode, regs);
418                 } else if (*((__u16 *) opcode) == 0xb29d) {
419                         get_user(*((__u16 *) (opcode+2)), location+1);
420                         signal = math_emu_lfpc(opcode, regs);
421                 } else
422                         signal = SIGILL;
423         }
424 #endif 
425         else
426                 signal = SIGILL;
427         if (signal == SIGFPE)
428                 do_fp_trap(regs, location,
429                            current->thread.fp_regs.fpc, interruption_code);
430         else if (signal)
431                 do_trap(interruption_code, signal,
432                         "illegal operation", regs, NULL);
433 }
434
435
436 #ifdef CONFIG_MATHEMU
437 asmlinkage void 
438 specification_exception(struct pt_regs * regs, long interruption_code)
439 {
440         __u8 opcode[6];
441         __u16 *location = NULL;
442         int signal = 0;
443
444         location = (__u16 *) get_check_address(regs);
445
446         /*
447          * We got all needed information from the lowcore and can
448          * now safely switch on interrupts.
449          */
450         if (regs->psw.mask & PSW_MASK_PSTATE)
451                 local_irq_enable();
452                 
453         if (regs->psw.mask & PSW_MASK_PSTATE) {
454                 get_user(*((__u16 *) opcode), location);
455                 switch (opcode[0]) {
456                 case 0x28: /* LDR Rx,Ry   */
457                         signal = math_emu_ldr(opcode);
458                         break;
459                 case 0x38: /* LER Rx,Ry   */
460                         signal = math_emu_ler(opcode);
461                         break;
462                 case 0x60: /* STD R,D(X,B) */
463                         get_user(*((__u16 *) (opcode+2)), location+1);
464                         signal = math_emu_std(opcode, regs);
465                         break;
466                 case 0x68: /* LD R,D(X,B) */
467                         get_user(*((__u16 *) (opcode+2)), location+1);
468                         signal = math_emu_ld(opcode, regs);
469                         break;
470                 case 0x70: /* STE R,D(X,B) */
471                         get_user(*((__u16 *) (opcode+2)), location+1);
472                         signal = math_emu_ste(opcode, regs);
473                         break;
474                 case 0x78: /* LE R,D(X,B) */
475                         get_user(*((__u16 *) (opcode+2)), location+1);
476                         signal = math_emu_le(opcode, regs);
477                         break;
478                 default:
479                         signal = SIGILL;
480                         break;
481                 }
482         } else
483                 signal = SIGILL;
484         if (signal == SIGFPE)
485                 do_fp_trap(regs, location,
486                            current->thread.fp_regs.fpc, interruption_code);
487         else if (signal) {
488                 siginfo_t info;
489                 info.si_signo = signal;
490                 info.si_errno = 0;
491                 info.si_code = ILL_ILLOPN;
492                 info.si_addr = location;
493                 do_trap(interruption_code, signal, 
494                         "specification exception", regs, &info);
495         }
496 }
497 #else
498 DO_ERROR_INFO(SIGILL, "specification exception", specification_exception,
499               ILL_ILLOPN, get_check_address(regs));
500 #endif
501
502 asmlinkage void data_exception(struct pt_regs * regs, long interruption_code)
503 {
504         __u16 *location;
505         int signal = 0;
506
507         location = (__u16 *) get_check_address(regs);
508
509         /*
510          * We got all needed information from the lowcore and can
511          * now safely switch on interrupts.
512          */
513         if (regs->psw.mask & PSW_MASK_PSTATE)
514                 local_irq_enable();
515
516         if (MACHINE_HAS_IEEE)
517                 __asm__ volatile ("stfpc %0\n\t" 
518                                   : "=m" (current->thread.fp_regs.fpc));
519
520 #ifdef CONFIG_MATHEMU
521         else if (regs->psw.mask & PSW_MASK_PSTATE) {
522                 __u8 opcode[6];
523                 get_user(*((__u16 *) opcode), location);
524                 switch (opcode[0]) {
525                 case 0x28: /* LDR Rx,Ry   */
526                         signal = math_emu_ldr(opcode);
527                         break;
528                 case 0x38: /* LER Rx,Ry   */
529                         signal = math_emu_ler(opcode);
530                         break;
531                 case 0x60: /* STD R,D(X,B) */
532                         get_user(*((__u16 *) (opcode+2)), location+1);
533                         signal = math_emu_std(opcode, regs);
534                         break;
535                 case 0x68: /* LD R,D(X,B) */
536                         get_user(*((__u16 *) (opcode+2)), location+1);
537                         signal = math_emu_ld(opcode, regs);
538                         break;
539                 case 0x70: /* STE R,D(X,B) */
540                         get_user(*((__u16 *) (opcode+2)), location+1);
541                         signal = math_emu_ste(opcode, regs);
542                         break;
543                 case 0x78: /* LE R,D(X,B) */
544                         get_user(*((__u16 *) (opcode+2)), location+1);
545                         signal = math_emu_le(opcode, regs);
546                         break;
547                 case 0xb3:
548                         get_user(*((__u16 *) (opcode+2)), location+1);
549                         signal = math_emu_b3(opcode, regs);
550                         break;
551                 case 0xed:
552                         get_user(*((__u32 *) (opcode+2)),
553                                  (__u32 *)(location+1));
554                         signal = math_emu_ed(opcode, regs);
555                         break;
556                 case 0xb2:
557                         if (opcode[1] == 0x99) {
558                                 get_user(*((__u16 *) (opcode+2)), location+1);
559                                 signal = math_emu_srnm(opcode, regs);
560                         } else if (opcode[1] == 0x9c) {
561                                 get_user(*((__u16 *) (opcode+2)), location+1);
562                                 signal = math_emu_stfpc(opcode, regs);
563                         } else if (opcode[1] == 0x9d) {
564                                 get_user(*((__u16 *) (opcode+2)), location+1);
565                                 signal = math_emu_lfpc(opcode, regs);
566                         } else
567                                 signal = SIGILL;
568                         break;
569                 default:
570                         signal = SIGILL;
571                         break;
572                 }
573         }
574 #endif 
575         if (current->thread.fp_regs.fpc & FPC_DXC_MASK)
576                 signal = SIGFPE;
577         else
578                 signal = SIGILL;
579         if (signal == SIGFPE)
580                 do_fp_trap(regs, location,
581                            current->thread.fp_regs.fpc, interruption_code);
582         else if (signal) {
583                 siginfo_t info;
584                 info.si_signo = signal;
585                 info.si_errno = 0;
586                 info.si_code = ILL_ILLOPN;
587                 info.si_addr = location;
588                 do_trap(interruption_code, signal, 
589                         "data exception", regs, &info);
590         }
591 }
592
593
594
595 /* init is done in lowcore.S and head.S */
596
597 void __init trap_init(void)
598 {
599         int i;
600
601         for (i = 0; i < 128; i++)
602           pgm_check_table[i] = &default_trap_handler;
603         pgm_check_table[1] = &illegal_op;
604         pgm_check_table[2] = &privileged_op;
605         pgm_check_table[3] = &execute_exception;
606         pgm_check_table[4] = &do_protection_exception;
607         pgm_check_table[5] = &addressing_exception;
608         pgm_check_table[6] = &specification_exception;
609         pgm_check_table[7] = &data_exception;
610         pgm_check_table[9] = &divide_exception;
611         pgm_check_table[0x10] = &do_segment_exception;
612         pgm_check_table[0x11] = &do_page_exception;
613         pgm_check_table[0x12] = &translation_exception;
614         pgm_check_table[0x13] = &special_op_exception;
615 #ifndef CONFIG_ARCH_S390X
616         pgm_check_table[0x14] = &do_pseudo_page_fault;
617 #else /* CONFIG_ARCH_S390X */
618         pgm_check_table[0x38] = &addressing_exception;
619         pgm_check_table[0x3B] = &do_region_exception;
620 #endif /* CONFIG_ARCH_S390X */
621         pgm_check_table[0x15] = &operand_exception;
622         pgm_check_table[0x1C] = &privileged_op;
623 #if defined(CONFIG_VIRT_TIMER) || defined(CONFIG_NO_IDLE_HZ)
624         pgm_check_table[0x40] = &do_monitor_call;
625 #endif
626         if (MACHINE_IS_VM) {
627                 /*
628                  * First try to get pfault pseudo page faults going.
629                  * If this isn't available turn on pagex page faults.
630                  */
631 #ifdef CONFIG_PFAULT
632                 /* request the 0x2603 external interrupt */
633                 if (register_early_external_interrupt(0x2603, pfault_interrupt,
634                                                       &ext_int_pfault) != 0)
635                         panic("Couldn't request external interrupt 0x2603");
636
637                 if (pfault_init() == 0) 
638                         return;
639                 
640                 /* Tough luck, no pfault. */
641                 unregister_early_external_interrupt(0x2603, pfault_interrupt,
642                                                     &ext_int_pfault);
643 #endif
644 #ifndef CONFIG_ARCH_S390X
645                 cpcmd("SET PAGEX ON", NULL, 0);
646 #endif
647         }
648 }