Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Jun Sun <jsun@mvista.com>
To: Pete Popov <ppopov@mvista.com>
Cc: George Gensure <werkt@csh.rit.edu>, linux-mips@oss.sgi.com
Subject: Re: newest kernel
Date: Mon, 21 May 2001 16:23:52 -0700	[thread overview]
Message-ID: <3B09A388.8AC77827@mvista.com> (raw)
In-Reply-To: 3B09A074.2010809@mvista.com


The patch seems to be just a fast implementation of sysmips().  Why would it
solve an otherwise illegal instruction problem?

George, what was exactly the error and the faulty instruction?

Jun

Pete Popov wrote:
> 
> George Gensure wrote:
> 
> > I build the 2.4.3 #5 kernel from the CVS source, and have had some
> > trouble with specific programs.  I get illegal instruction errors on
> > find and tar.  Is there anything I can do to correct this?
> 
> I'm guessing you're running into the sys_sysmips problem. A patch has
> not yet been applied to the oss.sgi.com kernel.  I've attached a patch
> from Florian that seems to work well and should apply cleanly.
> 
> Pete
> 
>   ------------------------------------------------------------------------------
> diff -Nur linux.orig/arch/mips/kernel/Makefile linux/arch/mips/kernel/Makefile
> --- linux.orig/arch/mips/kernel/Makefile        Mon Apr  9 00:23:08 2001
> +++ linux/arch/mips/kernel/Makefile     Mon Apr  9 00:23:34 2001
> @@ -20,7 +20,7 @@
>  obj-y                          += branch.o process.o signal.o entry.o \
>                                    traps.o ptrace.o vm86.o ioport.o reset.o \
>                                    semaphore.o setup.o syscall.o sysmips.o \
> -                                  ipc.o scall_o32.o unaligned.o
> +                                  ipc.o scall_o32.o unaligned.o fast-sysmips.o
>  obj-$(CONFIG_MODULES)          += mips_ksyms.o
> 
>  ifdef CONFIG_CPU_R3000
> @@ -69,5 +69,6 @@
> 
>  entry.o: entry.S
>  head.o: head.S
> +fast-sysmips.o: fast-sysmips.S
> 
>  include $(TOPDIR)/Rules.make
> diff -Nur linux.orig/arch/mips/kernel/fast-sysmips.S linux/arch/mips/kernel/fast-sysmips.S
> --- linux.orig/arch/mips/kernel/fast-sysmips.S  Thu Jan  1 01:00:00 1970
> +++ linux/arch/mips/kernel/fast-sysmips.S       Mon Apr  9 00:28:20 2001
> @@ -0,0 +1,85 @@
> +/*
> + * MIPS_ATOMIC_SET asm implementation for ll/sc capable cpus
> + *
> + * This file is subject to the terms and conditions of the GNU General Public
> + * License.  See the file "COPYING" in the main directory of this archive
> + * for more details.
> + *
> + * Copyright (C) 2001 Florian Lohoff <flo@rfc822.org>
> + *
> + */
> +#include <asm/asm.h>
> +#include <asm/mipsregs.h>
> +#include <asm/regdef.h>
> +#include <asm/stackframe.h>
> +#include <asm/isadep.h>
> +#include <asm/unistd.h>
> +#include <asm/sysmips.h>
> +#include <asm/offset.h>
> +#include <asm/errno.h>
> +
> +#define PT_TRACESYS     0x00000002
> +
> +       EXPORT(fast_sysmips)
> +
> +       .set    noreorder
> +
> +       li      t0, MIPS_ATOMIC_SET
> +       beq     a0, t0, 1f
> +        nop
> +       j       sys_sysmips
> +        nop
> +
> +1:
> +
> +       # a0 - MIPS_ATOMIC_SET
> +       # a1 - mem ptr
> +       # a2 - value
> +
> +       addiu   sp, sp, -8                      # Reserve space
> +       sw      a0, (sp)                        # Save arg0
> +
> +       addiu   a0, a1, 4                       # addr+size
> +       ori     v0, a1, 4                       # addr | size
> +       lw      v1, THREAD_CURDS(gp)            # current->thread.current_ds
> +       or      v0, v0, a0                      # addr | size | (addr+size)
> +       and     v1, v1, v0                      # (mask)&(addr | size | (addr+size)
> +       bltz    v1, 5f
> +        nop
> +
> +2:
> +       ll      v0, (a1)
> +       move    t0, a2
> +       sc      t0, (a1)
> +       beqz    t0, 2b
> +        nop
> +
> +       sw      v0, PT_R2+8(sp)                 # Result value
> +       sw      zero, PT_R7+8(sp)               # Success indicator
> +
> +       lw      t0, TASK_PTRACE(gp)             # syscall tracing enabled?
> +       andi    t0, PT_TRACESYS
> +       bnez    t0, 3f
> +        nop
> +
> +4:
> +       lw      a0, (sp)                        # Restore arg0
> +       addiu   sp, sp, 8                       # Restore sp
> +
> +       j       o32_ret_from_sys_call
> +        nop
> +
> +3:
> +       sw      ra, 4(sp)
> +       jal     syscall_trace
> +        nop
> +       lw      ra, 4(sp)
> +       j       4b
> +        nop
> +
> +5:
> +       lw      a0, (sp)                        # Restore arg0
> +       addiu   sp, sp, 8                       # Restore sp
> +       j       ra
> +        li     v0, -EFAULT
> +
> diff -Nur linux.orig/arch/mips/kernel/irix5sys.h linux/arch/mips/kernel/irix5sys.h
> --- linux.orig/arch/mips/kernel/irix5sys.h      Mon Apr  9 00:16:29 2001
> +++ linux/arch/mips/kernel/irix5sys.h   Sun Apr  8 21:21:16 2001
> @@ -69,7 +69,7 @@
>  SYS(irix_getgid, 0)                    /* 1047  getgid()              V*/
>  SYS(irix_unimp, 0)                     /* 1048  (XXX IRIX 4 ssig)     V*/
>  SYS(irix_msgsys, 6)                    /* 1049  sys_msgsys            V*/
> -SYS(sys_sysmips, 4)                    /* 1050  sysmips()            HV*/
> +SYS(fast_sysmips, 4)                   /* 1050  sysmips()            HV*/
>  SYS(irix_unimp, 0)                     /* 1051  XXX sysacct()        IV*/
>  SYS(irix_shmsys, 5)                    /* 1052  sys_shmsys            V*/
>  SYS(irix_semsys, 0)                    /* 1053  sys_semsys            V*/
> diff -Nur linux.orig/arch/mips/kernel/syscalls.h linux/arch/mips/kernel/syscalls.h
> --- linux.orig/arch/mips/kernel/syscalls.h      Mon Apr  9 00:16:30 2001
> +++ linux/arch/mips/kernel/syscalls.h   Sun Apr  8 21:21:43 2001
> @@ -163,7 +163,7 @@
>  SYS(sys_writev, 3)
>  SYS(sys_cacheflush, 3)
>  SYS(sys_cachectl, 3)
> -SYS(sys_sysmips, 4)
> +SYS(fast_sysmips, 4)
>  SYS(sys_ni_syscall, 0)                         /* 4150 */
>  SYS(sys_getsid, 1)
>  SYS(sys_fdatasync, 0)

  reply	other threads:[~2001-05-21 23:24 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-21 22:45 newest kernel George Gensure
2001-05-21 23:10 ` Pete Popov
2001-05-21 23:23   ` Jun Sun [this message]
2001-05-21 23:25     ` Pete Popov
2001-05-22 12:33     ` Florian Lohoff
2001-05-22 17:04       ` George Gensure
2001-05-22 17:04         ` George Gensure
2001-05-22 22:46       ` MIPS_ATOMIC_SET again (Re: " Jun Sun
2001-05-23  6:37         ` Joe deBlaquiere
2001-05-23 13:34           ` Maciej W. Rozycki
2001-05-23 17:48             ` Joe deBlaquiere
2001-05-23 18:20               ` Kevin D. Kissell
2001-05-23 18:20                 ` Kevin D. Kissell
2001-05-23 19:37                 ` Maciej W. Rozycki
2001-05-23 23:49                   ` Kevin D. Kissell
2001-05-23 23:49                     ` Kevin D. Kissell
2001-05-24  4:11                     ` Joe deBlaquiere
2001-05-24 10:56                       ` Maciej W. Rozycki
2001-05-24 10:44                     ` Maciej W. Rozycki
2001-05-24 15:15                       ` Kevin D. Kissell
2001-05-24 15:15                         ` Kevin D. Kissell
2001-05-24 16:21                         ` Maciej W. Rozycki
2001-05-24 22:46                           ` Joe deBlaquiere
2001-05-25 17:19                             ` Maciej W. Rozycki
2001-05-25 22:02                             ` Surprise! (Re: " Jun Sun
2001-05-25 23:56                               ` Jun Sun
2001-05-28 15:34                               ` Maciej W. Rozycki
2001-05-29 22:32                                 ` Jun Sun
2001-05-30  6:46                                   ` Kevin D. Kissell
2001-05-30  6:46                                     ` Kevin D. Kissell
2001-05-30 13:42                                   ` Maciej W. Rozycki
2001-05-30 17:39                                     ` Jun Sun
2001-05-31  8:37                                       ` Maciej W. Rozycki
2001-05-31 11:54                                 ` Ralf Baechle
2001-05-31 19:16                                   ` Jun Sun
2001-05-23 18:41               ` Jun Sun
2001-05-23 18:54                 ` Florian Lohoff
2001-05-23 18:55                   ` Florian Lohoff
2001-05-23 20:04                     ` Joe deBlaquiere
2001-05-24  9:32                       ` Maciej W. Rozycki
2001-05-26 13:14                         ` Florian Lohoff
2001-05-28 15:37                           ` Maciej W. Rozycki
2001-05-26 13:15                       ` Florian Lohoff
2001-05-28 15:43                         ` Maciej W. Rozycki
2001-05-28 16:25                           ` Kevin D. Kissell
2001-05-28 16:25                             ` Kevin D. Kissell
2001-05-28 17:10                             ` Maciej W. Rozycki
2001-05-29  6:57                               ` Geert Uytterhoeven
2001-05-29 10:45                                 ` Maciej W. Rozycki
2001-05-29 13:02                               ` Joe deBlaquiere
2001-05-29 15:45                                 ` Mike McDonald
2001-05-30  1:32                                   ` Mike McDonald
2001-05-30  7:09                                   ` Kevin D. Kissell
2001-05-30  7:09                                     ` Kevin D. Kissell
2001-05-30 14:48                                   ` J. Scott Kasten
2001-05-30 14:48                                     ` J. Scott Kasten
2001-05-29 22:37                               ` Jun Sun
2001-05-30 12:01                                 ` Maciej W. Rozycki
2001-05-30 17:54                                   ` Jun Sun
2001-05-31  7:39                                     ` Maciej W. Rozycki
2001-05-23 19:44                   ` Maciej W. Rozycki
2001-05-24  4:25                     ` Keith M Wesolowski
2001-05-23 21:06                   ` Jun Sun
2001-05-23 19:29               ` Maciej W. Rozycki
2001-05-23 17:10           ` Jun Sun
2001-05-23 13:18         ` Maciej W. Rozycki
2001-05-23 17:38           ` Jun Sun
2001-05-23 18:47             ` Maciej W. Rozycki
2001-05-23 20:58               ` Jun Sun
2001-05-23 13:45         ` wrt irc joshua
2001-05-23 15:19           ` porting from headers Keith M Wesolowski
2001-05-23 15:55           ` wrt irc nick
2001-05-23 15:57             ` Keith M Wesolowski
2001-05-23 16:03               ` nick

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=3B09A388.8AC77827@mvista.com \
    --to=jsun@mvista.com \
    --cc=linux-mips@oss.sgi.com \
    --cc=ppopov@mvista.com \
    --cc=werkt@csh.rit.edu \
    /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