]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/ia64/kernel/unaligned.c
Merge commit 'v2.6.27-rc5' into tip/oprofile
[linux-2.6-omap-h63xx.git] / arch / ia64 / kernel / unaligned.c
index fe6aa5a9f8fa94edc851c59b4d1cd9d28839cf32..ff0e7c10faa7222d48964d355bf3322b45506800 100644 (file)
@@ -13,6 +13,7 @@
  * 2001/08/13  Correct size of extended floats (float_fsz) from 16 to 10 bytes.
  * 2001/01/17  Add support emulation of unaligned kernel accesses.
  */
+#include <linux/jiffies.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/tty.h>
 #include <asm/uaccess.h>
 #include <asm/unaligned.h>
 
-extern void die_if_kernel(char *str, struct pt_regs *regs, long err);
+extern int die_if_kernel(char *str, struct pt_regs *regs, long err);
 
 #undef DEBUG_UNALIGNED_TRAP
 
 #ifdef DEBUG_UNALIGNED_TRAP
-# define DPRINT(a...)  do { printk("%s %u: ", __FUNCTION__, __LINE__); printk (a); } while (0)
+# define DPRINT(a...)  do { printk("%s %u: ", __func__, __LINE__); printk (a); } while (0)
 # define DDUMP(str,vp,len)     dump(str, vp, len)
 
 static void
@@ -674,9 +675,10 @@ emulate_load_updates (update_t type, load_store_t ld, struct pt_regs *regs, unsi
         * just in case.
         */
        if (ld.x6_op == 1 || ld.x6_op == 3) {
-               printk(KERN_ERR "%s: register update on speculative load, error\n", __FUNCTION__);
-               die_if_kernel("unaligned reference on speculative load with register update\n",
-                             regs, 30);
+               printk(KERN_ERR "%s: register update on speculative load, error\n", __func__);
+               if (die_if_kernel("unaligned reference on speculative load with register update\n",
+                                 regs, 30))
+                       return;
        }
 
 
@@ -1103,7 +1105,7 @@ emulate_load_floatpair (unsigned long ifa, load_store_t ld, struct pt_regs *regs
                 */
                if (ld.x6_op == 1 || ld.x6_op == 3)
                        printk(KERN_ERR "%s: register update on speculative load pair, error\n",
-                              __FUNCTION__);
+                              __func__);
 
                setreg(ld.r3, ifa, 0, regs);
        }
@@ -1289,7 +1291,7 @@ within_logging_rate_limit (void)
 {
        static unsigned long count, last_time;
 
-       if (jiffies - last_time > 5*HZ)
+       if (time_after(jiffies, last_time + 5 * HZ))
                count = 0;
        if (count < 5) {
                last_time = jiffies;
@@ -1317,7 +1319,8 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
 
        if (ia64_psr(regs)->be) {
                /* we don't support big-endian accesses */
-               die_if_kernel("big-endian unaligned accesses are not supported", regs, 0);
+               if (die_if_kernel("big-endian unaligned accesses are not supported", regs, 0))
+                       return;
                goto force_sigbus;
        }
 
@@ -1340,7 +1343,8 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
                        size_t len;
 
                        len = sprintf(buf, "%s(%d): unaligned access to 0x%016lx, "
-                                     "ip=0x%016lx\n\r", current->comm, current->pid,
+                                     "ip=0x%016lx\n\r", current->comm,
+                                     task_pid_nr(current),
                                      ifa, regs->cr_iip + ipsr->ri);
                        /*
                         * Don't call tty_write_message() if we're in the kernel; we might
@@ -1363,7 +1367,7 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
                                       "administrator\n"
                                       "echo 0 > /proc/sys/kernel/ignore-"
                                       "unaligned-usertrap to re-enable\n",
-                                      current->comm, current->pid);
+                                      current->comm, task_pid_nr(current));
                        }
                }
        } else {
@@ -1487,16 +1491,19 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
              case LDFA_OP:
              case LDFCCLR_OP:
              case LDFCNC_OP:
-             case LDF_IMM_OP:
-             case LDFA_IMM_OP:
-             case LDFCCLR_IMM_OP:
-             case LDFCNC_IMM_OP:
                if (u.insn.x)
                        ret = emulate_load_floatpair(ifa, u.insn, regs);
                else
                        ret = emulate_load_float(ifa, u.insn, regs);
                break;
 
+             case LDF_IMM_OP:
+             case LDFA_IMM_OP:
+             case LDFCCLR_IMM_OP:
+             case LDFCNC_IMM_OP:
+               ret = emulate_load_float(ifa, u.insn, regs);
+               break;
+
              case STF_OP:
              case STF_IMM_OP:
                ret = emulate_store_float(ifa, u.insn, regs);
@@ -1530,7 +1537,8 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
                        ia64_handle_exception(regs, eh);
                        goto done;
                }
-               die_if_kernel("error during unaligned kernel access\n", regs, ret);
+               if (die_if_kernel("error during unaligned kernel access\n", regs, ret))
+                       return;
                /* NOT_REACHED */
        }
   force_sigbus: