linux-mips
[Top] [All Lists]

[PATCH 29/36] Cavium OCTEON FPU EMU exception as TLB exception

To: linux-mips@linux-mips.org
Subject: [PATCH 29/36] Cavium OCTEON FPU EMU exception as TLB exception
From: David Daney <ddaney@caviumnetworks.com>
Date: Mon, 27 Oct 2008 17:03:01 -0700
Cc: David Daney <ddaney@caviumnetworks.com>, Tomaso Paoletti <tpaoletti@caviumnetworks.com>, Paul Gortmaker <Paul.Gortmaker@windriver.com>
In-reply-to: <1225152181-3221-28-git-send-email-ddaney@caviumnetworks.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <490655B6.4030406@caviumnetworks.com> <1225152181-3221-1-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-2-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-3-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-4-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-5-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-6-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-7-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-8-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-9-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-10-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-11-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-12-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-13-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-14-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-15-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-16-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-17-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-18-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-19-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-20-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-21-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-22-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-23-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-24-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-25-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-26-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-27-git-send-email-ddaney@caviumnetworks.com> <1225152181-3221-28-git-send-email-ddaney@caviumnetworks.com>
Sender: linux-mips-bounce@linux-mips.org
The FPU exceptions come in as TLB exceptions -- see if this is
one of them, and act accordingly.

Signed-off-by: Tomaso Paoletti <tpaoletti@caviumnetworks.com>
Signed-off-by: Paul Gortmaker <Paul.Gortmaker@windriver.com>
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/mips/mm/fault.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index fa636fc..c8a3fb5 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -25,6 +25,7 @@
 #include <asm/uaccess.h>
 #include <asm/ptrace.h>
 #include <asm/highmem.h>               /* For VMALLOC_END */
+#include <asm/fpu_emulator.h>
 
 /*
  * This routine handles page faults.  It determines the address,
@@ -47,6 +48,21 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned 
long write,
               field, regs->cp0_epc);
 #endif
 
+#ifdef CONFIG_CAVIUM_OCTEON_HW_FIX_UNALIGNED
+       /*
+        * Normally the FPU emulator uses a load word from address one
+        * to retake control of the CPU after executing the
+        * instruction in the delay slot of an emulated branch. The
+        * Octeon hardware unaligned access fix changes this from an
+        * address exception into a TLB exception. This code checks to
+        * see if this page fault was caused by an FPU emulation.
+        *
+        * Terminate if exception was recognized as a delay slot return.
+        */
+       if (do_dsemulret(regs))
+               return;
+#endif
+
        info.si_code = SEGV_MAPERR;
 
        /*
-- 
1.5.6.5


<Prev in Thread] Current Thread [Next in Thread>