linux-mips-fnet
[Top] [All Lists]

Re: Memory corruption: is anybody who remeber why ?!

To: linux-mips@fnet.fr
Subject: Re: Memory corruption: is anybody who remeber why ?!
From: Richard van den Berg <R.vandenBerg@inter.NL.net>
Date: Sat, 1 Jul 2000 22:04:43 +0200 (MET DST)
In-reply-to: <20000525201540.A15206@uni-koblenz.de>
On Thu, 25 May 2000, Ralf Baechle wrote:

> [ralf@lappi linux-sgi-2.2]$ head /dev/urandom
> Index: pgtable.h
> ===================================================================
> RCS file: /home/pub/cvs/linux/include/asm-mips/pgtable.h,v
> retrieving revision 1.19
> retrieving revision 1.19.2.1
> diff -u -r1.19 -r1.19.2.1
> --- pgtable.h 1999/06/13 16:35:53     1.19
> +++ pgtable.h 1999/07/22 01:57:13     1.19.2.1
> @@ -1,4 +1,4 @@
> -/* $Id: pgtable.h,v 1.18 1999/02/15 02:22:11 ralf Exp $
> +/* $Id: pgtable.h,v 1.19 1999/06/13 16:35:53 ralf Exp $
>   *
>   * 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
> @@ -580,9 +580,9 @@
>  /*
>   * Kernel with 32 bit address space
>   */
> -#define SWP_TYPE(entry) (((entry) >> 1) & 0x3f)
> -#define SWP_OFFSET(entry) ((entry) >> 8)
> -#define SWP_ENTRY(type,offset) (((type) << 1) | ((offset) << 8))
> +#define SWP_TYPE(entry) (((entry) >> 8) & 0x7f)
> +#define SWP_OFFSET(entry) ((entry) >> 15)
> +#define SWP_ENTRY(type,offset) (((type) << 8) | ((offset) << 15))
>  
>  #define module_map      vmalloc
>  #define module_unmap    vfree
> [ralf@lappi linux-sgi-2.2]$

Does the oracle know why this patch has been reversed?

--- linux-2.3.21/include/asm-mips/pgtable.h     Sat Jul  1 07:53:21 2000
+++ linux-cvs/include/asm-mips/pgtable.h        Sat Jul  1 12:27:34 2000

...[snipped a lot of lines]
 
 extern void update_mmu_cache(struct vm_area_struct *vma,
                                unsigned long address, pte_t pte);
 
-/*
- * Kernel with 32 bit address space
- */
-#define SWP_TYPE(entry) (((entry) >> 8) & 0x7f)
-#define SWP_OFFSET(entry) ((entry) >> 15)
-#define SWP_ENTRY(type,offset) (((type) << 8) | ((offset) << 15))
+#define SWP_TYPE(x)            (((x).val >> 1) & 0x3f)
+#define SWP_OFFSET(x)          ((x).val >> 8)
+#define SWP_ENTRY(type,offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 
8) })
+#define pte_to_swp_entry(pte)  ((swp_entry_t) { pte_val(pte) })
+#define swp_entry_to_pte(x)    ((pte_t) { (x).val })
+
 
 #define module_map      vmalloc
 #define module_unmap    vfree


Anyways, attached patch makes swap usable on R3k based DECstations:

fortuna:~$ cat /proc/cpuinfo; free; uptime; uname -a
cpu                     : MIPS
cpu model               : R3000A V3.0
system type             : Digital DECstation 5000/1xx
BogoMIPS                : 32.70
byteorder               : little endian
unaligned accesses      : 0
wait instruction        : no
microsecond timers      : no
extra interrupt vector  : no
hardware watchpoint     : no
VCED exceptions         : not available
VCEI exceptions         : not available
             total       used       free     shared    buffers     cached
Mem:         30320      28960       1360          0        472      11284
-/+ buffers/cache:      17204      13116
Swap:        59372       3576      55796
 10:00pm  up  2:04,  1 user,  load average: 4.06, 4.04, 3.97
Linux fortuna 2.4.0-test2 #3 Sat Jul 1 17:46:26 CEST 2000 mips unknown
fortuna:~$

Regards,
Richard
--- pgtable.h.orig      Sat Jul  1 12:27:34 2000
+++ pgtable.h   Sat Jul  1 17:25:21 2000
@@ -443,9 +443,9 @@
 extern void update_mmu_cache(struct vm_area_struct *vma,
                                unsigned long address, pte_t pte);
 
-#define SWP_TYPE(x)            (((x).val >> 1) & 0x3f)
-#define SWP_OFFSET(x)          ((x).val >> 8)
-#define SWP_ENTRY(type,offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 
8) })
+#define SWP_TYPE(x)            (((x).val >> 8) & 0x7f)
+#define SWP_OFFSET(x)          ((x).val >> 15)
+#define SWP_ENTRY(type,offset) ((swp_entry_t) { ((type) << 8) | ((offset) << 
15) })
 #define pte_to_swp_entry(pte)  ((swp_entry_t) { pte_val(pte) })
 #define swp_entry_to_pte(x)    ((pte_t) { (x).val })
 
<Prev in Thread] Current Thread [Next in Thread>
  • Re: Memory corruption: is anybody who remeber why ?!, Richard van den Berg <=