memoryCall.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * arch/alpha/kernel/traps.c
  3. *
  4. * (C) Copyright 1994 Linus Torvalds
  5. */
  6. /*
  7. * This file initializes the trap entry points
  8. */
  9. #include <linux/jiffies.h>
  10. #include <linux/mm.h>
  11. #include <linux/sched.h>
  12. #include <linux/tty.h>
  13. #include <linux/delay.h>
  14. #include <linux/module.h>
  15. #include <linux/init.h>
  16. #include <linux/kallsyms.h>
  17. #include <linux/ratelimit.h>
  18. #include <asm/gentrap.h>
  19. #include <asm/uaccess.h>
  20. #include <asm/unaligned.h>
  21. #include <asm/sysinfo.h>
  22. #include <asm/hwrpb.h>
  23. #include <asm/mmu_context.h>
  24. #include <asm/special_insns.h>
  25. #include "proto.h"
  26. /* Work-around for some SRMs which mishandle opDEC faults. */
  27. static int opDEC_fix;
  28. static void __cpuinit
  29. opDEC_check(void)
  30. {
  31. __asm__ __volatile__ (
  32. /* Load the address of... */
  33. " br $16, 1f\n"
  34. /* A stub instruction fault handler. Just add 4 to the
  35. pc and continue. */
  36. " ldq $16, 8($sp)\n"
  37. " addq $16, 4, $16\n"
  38. " stq $16, 8($sp)\n"
  39. " call_pal %[rti]\n"
  40. /* Install the instruction fault handler. */
  41. "1: lda $17, 3\n"
  42. " call_pal %[wrent]\n"
  43. /* With that in place, the fault from the round-to-minf fp
  44. insn will arrive either at the "lda 4" insn (bad) or one
  45. past that (good). This places the correct fixup in %0. */
  46. " lda %[fix], 0\n"
  47. " cvttq/svm $f31,$f31\n"
  48. " lda %[fix], 4"
  49. : [fix] "=r" (opDEC_fix)
  50. : [rti] "n" (PAL_rti), [wrent] "n" (PAL_wrent)
  51. : "$0", "$1", "$16", "$17", "$22", "$23", "$24", "$25");
  52. if (opDEC_fix)
  53. printk("opDEC fixup enabled.\n");
  54. }
  55. void
  56. dik_show_regs(struct pt_regs *regs, unsigned long *r9_15)
  57. {
  58. printk("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx %s\n",
  59. regs->pc, regs->r26, regs->ps, print_tainted());
  60. print_symbol("pc is at %s\n", regs->pc);
  61. print_symbol("ra is at %s\n", regs->r26 );
  62. printk("v0 = %016lx t0 = %016lx t1 = %016lx\n",
  63. regs->r0, regs->r1, regs->r2);
  64. printk("t2 = %016lx t3 = %016lx t4 = %016lx\n",
  65. regs->r3, regs->r4, regs->r5);
  66. printk("t5 = %016lx t6 = %016lx t7 = %016lx\n",
  67. regs->r6, regs->r7, regs->r8);
  68. if (r9_15) {
  69. printk("s0 = %016lx s1 = %016lx s2 = %016lx\n",
  70. r9_15[9], r9_15[10], r9_15[11]);
  71. printk("s3 = %016lx s4 = %016lx s5 = %016lx\n",
  72. r9_15[12], r9_15[13], r9_15[14]);
  73. printk("s6 = %016lx\n", r9_15[15]);
  74. }
  75. printk("a0 = %016lx a1 = %016lx a2 = %016lx\n",
  76. regs->r16, regs->r17, regs->r18);
  77. printk("a3 = %016lx a4 = %016lx a5 = %016lx\n",
  78. regs->r19, regs->r20, regs->r21);
  79. printk("t8 = %016lx t9 = %016lx t10= %016lx\n",
  80. regs->r22, regs->r23, regs->r24);
  81. printk("t11= %016lx pv = %016lx at = %016lx\n",
  82. regs->r25, regs->r27, regs->r28);
  83. printk("gp = %016lx sp = %p\n", regs->gp, regs+1);
  84. #if 0
  85. __halt();
  86. #endif
  87. }
  88. #if 0
  89. static char * ireg_name[] = {"v0", "t0", "t1", "t2", "t3", "t4", "t5", "t6",
  90. "t7", "s0", "s1", "s2", "s3", "s4", "s5", "s6",
  91. "a0", "a1", "a2", "a3", "a4", "a5", "t8", "t9",
  92. "t10", "t11", "ra", "pv", "at", "gp", "sp", "zero"};
  93. #endif
  94. static void
  95. dik_show_code(unsigned int *pc)
  96. {
  97. long i;
  98. printk("Code:");
  99. for (i = -6; i < 2; i++) {
  100. unsigned int insn;
  101. if (__get_user(insn, (unsigned int __user *)pc + i))
  102. break;
  103. printk("%c%08x%c", i ? ' ' : '<', insn, i ? ' ' : '>');
  104. }
  105. printk("\n");
  106. }
  107. static void
  108. dik_show_trace(unsigned long *sp)
  109. {
  110. long i = 0;
  111. printk("Trace:\n");
  112. while (0x1ff8 & (unsigned long) sp) {
  113. extern char _stext[], _etext[];
  114. unsigned long tmp = *sp;
  115. sp++;
  116. if (tmp < (unsigned long) &_stext)
  117. continue;