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