VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[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         bust_spinlocks(0);
247         spin_unlock_irq(&die_lock);
248         if (in_interrupt())
249                 panic("Fatal exception in interrupt");
250         if (panic_on_oops)
251                 panic("Fatal exception: panic_on_oops");
252         do_exit(SIGSEGV);
253 }
254
255 static void inline do_trap(long interruption_code, int signr, char *str,
256                            struct pt_regs *regs, siginfo_t *info)
257 {
258         /*
259          * We got all needed information from the lowcore and can
260          * now safely switch on interrupts.
261          */
262         if (regs->psw.mask & PSW_MASK_PSTATE)
263                 local_irq_enable();
264
265         if (regs->psw.mask & PSW_MASK_PSTATE) {
266                 struct task_struct *tsk = current;
267
268                 tsk->thread.trap_no = interruption_code & 0xffff;
269                 if (info)
270                         force_sig_info(signr, info, tsk);
271                 else
272                         force_sig(signr, tsk);
273 #ifndef CONFIG_SYSCTL
274 #ifdef CONFIG_PROCESS_DEBUG
275                 printk("User process fault: interruption code 0x%lX\n",
276                        interruption_code);
277                 show_regs(regs);
278 #endif
279 #else
280                 if (sysctl_userprocess_debug) {
281                         printk("User process fault: interruption code 0x%lX\n",
282                                interruption_code);
283                         show_regs(regs);
284                 }
285 #endif
286         } else {
287                 const struct exception_table_entry *fixup;
288                 fixup = search_exception_tables(regs->psw.addr & PSW_ADDR_INSN);
289                 if (fixup)
290                         regs->psw.addr = fixup->fixup | PSW_ADDR_AMODE;
291                 else
292                         die(str, regs, interruption_code);
293         }
294 }
295
296 static inline void *get_check_address(struct pt_regs *regs)
297 {
298         return (void *)((regs->psw.addr-S390_lowcore.pgm_ilc) & PSW_ADDR_INSN);
299 }
300
301 void do_single_step(struct pt_regs *regs)
302 {
303         if ((current->ptrace & PT_PTRACED) != 0)
304                 force_sig(SIGTRAP, current);
305 }
306
307 #define DO_ERROR(signr, str, name) \
308 asmlinkage void name(struct pt_regs * regs, long interruption_code) \
309 { \
310         do_trap(interruption_code, signr, str, regs, NULL); \
311 }
312
313 #define DO_ERROR_INFO(signr, str, name, sicode, siaddr) \
314 asmlinkage void name(struct pt_regs * regs, long interruption_code) \
315 { \
316         siginfo_t info; \
317         info.si_signo = signr; \
318         info.si_errno = 0; \
319         info.si_code = sicode; \
320         info.si_addr = (void *)siaddr; \
321         do_trap(interruption_code, signr, str, regs, &info); \
322 }
323
324 DO_ERROR(SIGSEGV, "Unknown program exception", default_trap_handler)
325
326 DO_ERROR_INFO(SIGILL, "addressing exception", addressing_exception,
327               ILL_ILLADR, get_check_address(regs))
328 DO_ERROR_INFO(SIGILL,  "execute exception", execute_exception,
329               ILL_ILLOPN, get_check_address(regs))
330 DO_ERROR_INFO(SIGFPE,  "fixpoint divide exception", divide_exception,
331               FPE_INTDIV, get_check_address(regs))
332 DO_ERROR_INFO(SIGFPE,  "fixpoint overflow exception", overflow_exception,
333               FPE_INTOVF, get_check_address(regs))
334 DO_ERROR_INFO(SIGFPE,  "HFP overflow exception", hfp_overflow_exception,
335               FPE_FLTOVF, get_check_address(regs))
336 DO_ERROR_INFO(SIGFPE,  "HFP underflow exception", hfp_underflow_exception,
337               FPE_FLTUND, get_check_address(regs))
338 DO_ERROR_INFO(SIGFPE,  "HFP significance exception", hfp_significance_exception,
339               FPE_FLTRES, get_check_address(regs))
340 DO_ERROR_INFO(SIGFPE,  "HFP divide exception", hfp_divide_exception,
341               FPE_FLTDIV, get_check_address(regs))
342 DO_ERROR_INFO(SIGFPE,  "HFP square root exception", hfp_sqrt_exception,
343               FPE_FLTINV, get_check_address(regs))
344 DO_ERROR_INFO(SIGILL,  "operand exception", operand_exception,
345               ILL_ILLOPN, get_check_address(regs))
346 DO_ERROR_INFO(SIGILL,  "privileged operation", privileged_op,
347               ILL_PRVOPC, get_check_address(regs))
348 DO_ERROR_INFO(SIGILL,  "special operation exception", special_op_exception,
349               ILL_ILLOPN, get_check_address(regs))
350 DO_ERROR_INFO(SIGILL,  "translation exception", translation_exception,
351               ILL_ILLOPN, get_check_address(regs))
352
353 static inline void
354 do_fp_trap(struct pt_regs *regs, void *location,
355            int fpc, long interruption_code)
356 {
357         siginfo_t si;
358
359         si.si_signo = SIGFPE;
360         si.si_errno = 0;
361         si.si_addr = location;
362         si.si_code = 0;
363         /* FPC[2] is Data Exception Code */
364         if ((fpc & 0x00000300) == 0) {
365                 /* bits 6 and 7 of DXC are 0 iff IEEE exception */
366                 if (fpc & 0x8000) /* invalid fp operation */
367                         si.si_code = FPE_FLTINV;
368                 else if (fpc & 0x4000) /* div by 0 */
369                         si.si_code = FPE_FLTDIV;
370                 else if (fpc & 0x2000) /* overflow */
371                         si.si_code = FPE_FLTOVF;
372                 else if (fpc & 0x1000) /* underflow */
373                         si.si_code = FPE_FLTUND;
374                 else if (fpc & 0x0800) /* inexact */
375                         si.si_code = FPE_FLTRES;
376         }
377         current->thread.ieee_instruction_pointer = (addr_t) location;
378         do_trap(interruption_code, SIGFPE,
379                 "floating point exception", regs, &si);
380 }
381
382 asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
383 {
384         __u8 opcode[6];
385         __u16 *location;
386         int signal = 0;
387
388         location = (__u16 *) get_check_address(regs);
389
390         /*
391          * We got all needed information from the lowcore and can
392          * now safely switch on interrupts.
393          */
394         if (regs->psw.mask & PSW_MASK_PSTATE)
395                 local_irq_enable();
396
397         if (regs->psw.mask & PSW_MASK_PSTATE) {
398                 get_user(*((__u16 *) opcode), (__u16 __user *) location);
399                 if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) {
400                         if (current->ptrace & PT_PTRACED)
401                                 force_sig(SIGTRAP, current);
402                         else
403                                 signal = SIGILL;
404 #ifdef CONFIG_MATHEMU
405                 } else 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 #endif
422                 } else
423                         signal = SIGILL;
424         } else
425                 signal = SIGILL;
426
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
485         if (signal == SIGFPE)
486                 do_fp_trap(regs, location,
487                            current->thread.fp_regs.fpc, interruption_code);
488         else if (signal) {
489                 siginfo_t info;
490                 info.si_signo = signal;
491                 info.si_errno = 0;
492                 info.si_code = ILL_ILLOPN;
493                 info.si_addr = location;
494                 do_trap(interruption_code, signal, 
495                         "specification exception", regs, &info);
496         }
497 }
498 #else
499 DO_ERROR_INFO(SIGILL, "specification exception", specification_exception,
500               ILL_ILLOPN, get_check_address(regs));
501 #endif
502
503 asmlinkage void data_exception(struct pt_regs * regs, long interruption_code)
504 {
505         __u16 *location;
506         int signal = 0;
507
508         location = (__u16 *) get_check_address(regs);
509
510         /*
511          * We got all needed information from the lowcore and can
512          * now safely switch on interrupts.
513          */
514         if (regs->psw.mask & PSW_MASK_PSTATE)
515                 local_irq_enable();
516
517         if (MACHINE_HAS_IEEE)
518                 __asm__ volatile ("stfpc %0\n\t" 
519                                   : "=m" (current->thread.fp_regs.fpc));
520
521 #ifdef CONFIG_MATHEMU
522         else if (regs->psw.mask & PSW_MASK_PSTATE) {
523                 __u8 opcode[6];
524                 get_user(*((__u16 *) opcode), location);
525                 switch (opcode[0]) {
526                 case 0x28: /* LDR Rx,Ry   */
527                         signal = math_emu_ldr(opcode);
528                         break;
529                 case 0x38: /* LER Rx,Ry   */
530                         signal = math_emu_ler(opcode);
531                         break;
532                 case 0x60: /* STD R,D(X,B) */
533                         get_user(*((__u16 *) (opcode+2)), location+1);
534                         signal = math_emu_std(opcode, regs);
535                         break;
536                 case 0x68: /* LD R,D(X,B) */
537                         get_user(*((__u16 *) (opcode+2)), location+1);
538                         signal = math_emu_ld(opcode, regs);
539                         break;
540                 case 0x70: /* STE R,D(X,B) */
541                         get_user(*((__u16 *) (opcode+2)), location+1);
542                         signal = math_emu_ste(opcode, regs);
543                         break;
544                 case 0x78: /* LE R,D(X,B) */
545                         get_user(*((__u16 *) (opcode+2)), location+1);
546                         signal = math_emu_le(opcode, regs);
547                         break;
548                 case 0xb3:
549                         get_user(*((__u16 *) (opcode+2)), location+1);
550                         signal = math_emu_b3(opcode, regs);
551                         break;
552                 case 0xed:
553                         get_user(*((__u32 *) (opcode+2)),
554                                  (__u32 *)(location+1));
555                         signal = math_emu_ed(opcode, regs);
556                         break;
557                 case 0xb2:
558                         if (opcode[1] == 0x99) {
559                                 get_user(*((__u16 *) (opcode+2)), location+1);
560                                 signal = math_emu_srnm(opcode, regs);
561                         } else if (opcode[1] == 0x9c) {
562                                 get_user(*((__u16 *) (opcode+2)), location+1);
563                                 signal = math_emu_stfpc(opcode, regs);
564                         } else if (opcode[1] == 0x9d) {
565                                 get_user(*((__u16 *) (opcode+2)), location+1);
566                                 signal = math_emu_lfpc(opcode, regs);
567                         } else
568                                 signal = SIGILL;
569                         break;
570                 default:
571                         signal = SIGILL;
572                         break;
573                 }
574         }
575 #endif 
576         if (current->thread.fp_regs.fpc & FPC_DXC_MASK)
577                 signal = SIGFPE;
578         else
579                 signal = SIGILL;
580         if (signal == SIGFPE)
581                 do_fp_trap(regs, location,
582                            current->thread.fp_regs.fpc, interruption_code);
583         else if (signal) {
584                 siginfo_t info;
585                 info.si_signo = signal;
586                 info.si_errno = 0;
587                 info.si_code = ILL_ILLOPN;
588                 info.si_addr = location;
589                 do_trap(interruption_code, signal, 
590                         "data exception", regs, &info);
591         }
592 }
593
594
595
596 /* init is done in lowcore.S and head.S */
597
598 void __init trap_init(void)
599 {
600         int i;
601
602         for (i = 0; i < 128; i++)
603           pgm_check_table[i] = &default_trap_handler;
604         pgm_check_table[1] = &illegal_op;
605         pgm_check_table[2] = &privileged_op;
606         pgm_check_table[3] = &execute_exception;
607         pgm_check_table[4] = &do_protection_exception;
608         pgm_check_table[5] = &addressing_exception;
609         pgm_check_table[6] = &specification_exception;
610         pgm_check_table[7] = &data_exception;
611         pgm_check_table[8] = &overflow_exception;
612         pgm_check_table[9] = &divide_exception;
613         pgm_check_table[0x0A] = &overflow_exception;
614         pgm_check_table[0x0B] = &divide_exception;
615         pgm_check_table[0x0C] = &hfp_overflow_exception;
616         pgm_check_table[0x0D] = &hfp_underflow_exception;
617         pgm_check_table[0x0E] = &hfp_significance_exception;
618         pgm_check_table[0x0F] = &hfp_divide_exception;
619         pgm_check_table[0x10] = &do_dat_exception;
620         pgm_check_table[0x11] = &do_dat_exception;
621         pgm_check_table[0x12] = &translation_exception;
622         pgm_check_table[0x13] = &special_op_exception;
623 #ifndef CONFIG_ARCH_S390X
624         pgm_check_table[0x14] = &do_pseudo_page_fault;
625 #else /* CONFIG_ARCH_S390X */
626         pgm_check_table[0x38] = &do_dat_exception;
627         pgm_check_table[0x39] = &do_dat_exception;
628         pgm_check_table[0x3A] = &do_dat_exception;
629         pgm_check_table[0x3B] = &do_dat_exception;
630 #endif /* CONFIG_ARCH_S390X */
631         pgm_check_table[0x15] = &operand_exception;
632         pgm_check_table[0x1C] = &privileged_op;
633         pgm_check_table[0x1D] = &hfp_sqrt_exception;
634         pgm_check_table[0x40] = &do_monitor_call;
635
636         if (MACHINE_IS_VM) {
637                 /*
638                  * First try to get pfault pseudo page faults going.
639                  * If this isn't available turn on pagex page faults.
640                  */
641 #ifdef CONFIG_PFAULT
642                 /* request the 0x2603 external interrupt */
643                 if (register_early_external_interrupt(0x2603, pfault_interrupt,
644                                                       &ext_int_pfault) != 0)
645                         panic("Couldn't request external interrupt 0x2603");
646
647                 if (pfault_init() == 0) 
648                         return;
649                 
650                 /* Tough luck, no pfault. */
651                 unregister_early_external_interrupt(0x2603, pfault_interrupt,
652                                                     &ext_int_pfault);
653 #endif
654 #ifndef CONFIG_ARCH_S390X
655                 cpcmd("SET PAGEX ON", NULL, 0);
656 #endif
657         }
658 }