Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Jun Sun <jsun@mvista.com>
To: Ralf Baechle <ralf@oss.sgi.com>
Cc: linux-mips <linux-mips@oss.sgi.com>
Subject: Re: what is the right behavior of copy_to_user(0x0, ..., ...)?
Date: Mon, 06 May 2002 11:18:18 -0700	[thread overview]
Message-ID: <3CD6C8EA.9060807@mvista.com> (raw)
In-Reply-To: 20020503184000.A1238@dea.linux-mips.net

[-- Attachment #1: Type: text/plain, Size: 2450 bytes --]


It would help if not for the gross typo. :-)  See the attachment.

Jun


Ralf Baechle wrote:

> On Fri, May 03, 2002 at 04:41:56PM -0700, Jun Sun wrote:
> 
> 
>>It appears earlier version of kernel does not have this problem.  I have not 
>>fully figured out why.
>>
> 
> We didn't handle exceptions in branch delay slots.  Try this patch and
> tell me if it helps.
> 
>   Ralf
> 
> Index: arch/mips/mm/fault.c
> ===================================================================
> RCS file: /home/pub/cvs/linux/arch/mips/mm/fault.c,v
> retrieving revision 1.25.2.2
> diff -u -r1.25.2.2 fault.c
> --- arch/mips/mm/fault.c	16 Jan 2002 03:49:24 -0000	1.25.2.2
> +++ arch/mips/mm/fault.c	4 May 2002 01:28:34 -0000
> @@ -19,6 +19,7 @@
>  #include <linux/smp_lock.h>
>  #include <linux/version.h>
>  
> +#include <asm/branch.h>
>  #include <asm/hardirq.h>
>  #include <asm/pgalloc.h>
>  #include <asm/mmu_context.h>
> @@ -77,7 +78,7 @@
>  	struct vm_area_struct * vma;
>  	struct task_struct *tsk = current;
>  	struct mm_struct *mm = tsk->mm;
> -	unsigned long fixup;
> +	unsigned long epc, fixup;
>  	siginfo_t info;
>  
>  	/*
> @@ -181,7 +182,8 @@
>  
>  no_context:
>  	/* Are we prepared to handle this kernel fault?  */
> -	fixup = search_exception_table(regs->cp0_epc);
> +	epc = regs->cp0_epc + delay_slot(regs) ? 4 : 0;
> +	fixup = search_exception_table(epc);
>  	if (fixup) {
>  		long new_epc;
>  
> Index: arch/mips64/mm/fault.c
> ===================================================================
> RCS file: /home/pub/cvs/linux/arch/mips64/mm/fault.c,v
> retrieving revision 1.26.2.6
> diff -u -r1.26.2.6 fault.c
> --- arch/mips64/mm/fault.c	23 Feb 2002 02:16:42 -0000	1.26.2.6
> +++ arch/mips64/mm/fault.c	4 May 2002 01:28:34 -0000
> @@ -21,6 +21,7 @@
>  #include <linux/smp_lock.h>
>  #include <linux/version.h>
>  
> +#include <asm/branch.h>
>  #include <asm/hardirq.h>
>  #include <asm/pgalloc.h>
>  #include <asm/mmu_context.h>
> @@ -103,7 +104,7 @@
>  	struct vm_area_struct * vma;
>  	struct task_struct *tsk = current;
>  	struct mm_struct *mm = tsk->mm;
> -	unsigned long fixup;
> +	unsigned long epc, fixup;
>  	siginfo_t info;
>  
>  #if 0
> @@ -208,7 +209,8 @@
>  
>  no_context:
>  	/* Are we prepared to handle this kernel fault?  */
> -	fixup = search_exception_table(regs->cp0_epc);
> +	epc = regs->cp0_epc + delay_slot(regs) ? 4 : 0;
> +	fixup = search_exception_table(epc);
>  	if (fixup) {
>  		long new_epc;
>  
> 


[-- Attachment #2: junk --]
[-- Type: text/plain, Size: 896 bytes --]

diff -Nru link/arch/mips/mm/fault.c.orig link/arch/mips/mm/fault.c
--- link/arch/mips/mm/fault.c.orig	Mon May  6 11:12:41 2002
+++ link/arch/mips/mm/fault.c	Mon May  6 11:15:12 2002
@@ -182,7 +182,7 @@
 
 no_context:
 	/* Are we prepared to handle this kernel fault?  */
-	epc = regs->cp0_epc + delay_slot(regs) ? 4 : 0;
+	epc = regs->cp0_epc + (delay_slot(regs) ? 4 : 0);
 	fixup = search_exception_table(epc);
 	if (fixup) {
 		long new_epc;
diff -Nru link/arch/mips64/mm/fault.c.orig link/arch/mips64/mm/fault.c
--- link/arch/mips64/mm/fault.c.orig	Mon May  6 11:12:44 2002
+++ link/arch/mips64/mm/fault.c	Mon May  6 11:15:26 2002
@@ -209,7 +209,7 @@
 
 no_context:
 	/* Are we prepared to handle this kernel fault?  */
-	epc = regs->cp0_epc + delay_slot(regs) ? 4 : 0;
+	epc = regs->cp0_epc + (delay_slot(regs) ? 4 : 0);
 	fixup = search_exception_table(epc);
 	if (fixup) {
 		long new_epc;

  reply	other threads:[~2002-05-06 18:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-03 21:46 what is the right behavior of copy_to_user(0x0, ..., ...)? Jun Sun
2002-05-03 23:23 ` Ralf Baechle
2002-05-03 23:41   ` Jun Sun
2002-05-04  1:40     ` Ralf Baechle
2002-05-06 18:18       ` Jun Sun [this message]
2002-05-08  3:16         ` Ralf Baechle
2002-05-07  8:47       ` Carsten Langgaard
2002-05-06 17:53         ` Ralf Baechle
2002-05-06 19:44         ` Ralf Baechle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3CD6C8EA.9060807@mvista.com \
    --to=jsun@mvista.com \
    --cc=linux-mips@oss.sgi.com \
    --cc=ralf@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox