This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] ppc32 dl-machine.c


This patch was submitted back in September 2002 and Geoff Keating agreed it should be applied. Some how it was never applied.

http://sources.redhat.com/ml/libc-alpha/2002-09/msg00515.html

It is still valid and needed today and I just verifed that the patch applies clean and ran make check with todays cvs. So I am submitting again.
2004-02-06  Steven Munroe  <sjmunroe@us.ibm.com>

	* sysdeps/powerpc/powerpc32/dl-machine.c: Declare __cache_line_size as
	weak extern.
	(__elf_machine_runtime_setup): Invalidate the instruction cache over the 
	whole range of the PLT.


diff -urN libc23-cvstip-20040204/sysdeps/powerpc/powerpc32/dl-machine.c libc23/sysdeps/powerpc/powerpc32/dl-machine.c
--- libc23-cvstip-20040204/sysdeps/powerpc/powerpc32/dl-machine.c	2003-05-15 23:16:18.000000000 -0500
+++ libc23/sysdeps/powerpc/powerpc32/dl-machine.c	2004-02-06 13:54:37.000000000 -0600
@@ -26,6 +26,11 @@
 #include <dl-machine.h>
 #include <stdio-common/_itoa.h>
 
+/* The value __cache_line_size is defined in memset.S and is initialised
+   by _dl_sysdep_start via DL_PLATFORM_INIT.  */
+extern int __cache_line_size;
+weak_extern (__cache_line_size)
+
 /* Because ld.so is now versioned, these functions can be in their own file;
    no relocations need to be done to call them.
    Of course, if ld.so is not versioned...  */
@@ -214,6 +219,8 @@
       Elf32_Word rel_offset_words = PLT_DATA_START_WORDS (num_plt_entries);
       Elf32_Word data_words = (Elf32_Word) (plt + rel_offset_words);
       Elf32_Word size_modified;
+      int *line_size_ptr = & __cache_line_size;
+      int line_size_words;
 
       extern void _dl_runtime_resolve (void);
       extern void _dl_prof_resolve (void);
@@ -304,14 +311,26 @@
 	 there may be a little overlap at the start and the end.
 
 	 Assumes that dcbst and icbi apply to lines of 16 bytes or
-	 more.  Current known line sizes are 16, 32, and 128 bytes.  */
+	 more.  Current known line sizes are 16, 32, and 128 bytes.  
+	 The following gets the __cache_line_size, when available.  */
 
+      line_size_words = 4;/* Default minimum 4 words per cache line.  */
+      if (lazy) /* Don't try this until ld.so has relocated itself!  */
+        if (line_size_ptr != NULL)
+          { /*  Verify that __cache_line_size is defined and set.  */
+            if (*line_size_ptr != 0)  
+	            /* Convert bytes to words.  */
+              line_size_words = *line_size_ptr >> 2;	    
+          }
+	
       size_modified = lazy ? rel_offset_words : 6;
-      for (i = 0; i < size_modified; i += 4)
-	PPC_DCBST (plt + i);
+      for (i = 0; i < size_modified; i += line_size_words)
+        PPC_DCBST (plt + i);
       PPC_DCBST (plt + size_modified - 1);
       PPC_SYNC;
-      PPC_ICBI (plt);
+      
+      for (i = 0; i < size_modified; i += line_size_words)
+        PPC_ICBI (plt + i);
       PPC_ICBI (plt + size_modified - 1);
       PPC_ISYNC;
     }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]