about summary refs log tree commit diff
path: root/sysdeps/powerpc/powerpc32
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-02-07 06:37:42 +0000
committerUlrich Drepper <drepper@redhat.com>2004-02-07 06:37:42 +0000
commitacd262e611f704a7ae47101bec76c22d89a2401a (patch)
tree09a8663d895d868c92663ecaca21fa889b8b51e7 /sysdeps/powerpc/powerpc32
parent1e7947dcc92a6488d77e98da148ce64517999c0b (diff)
downloadglibc-acd262e611f704a7ae47101bec76c22d89a2401a.tar.gz
glibc-acd262e611f704a7ae47101bec76c22d89a2401a.tar.xz
glibc-acd262e611f704a7ae47101bec76c22d89a2401a.zip
Update.
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.
Diffstat (limited to 'sysdeps/powerpc/powerpc32')
-rw-r--r--sysdeps/powerpc/powerpc32/dl-machine.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/sysdeps/powerpc/powerpc32/dl-machine.c b/sysdeps/powerpc/powerpc32/dl-machine.c
index cf22fc707c..642cad48a2 100644
--- a/sysdeps/powerpc/powerpc32/dl-machine.c
+++ b/sysdeps/powerpc/powerpc32/dl-machine.c
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation functions.  PowerPC version.
-   Copyright (C) 1995-2001,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1995-2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -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...  */
@@ -304,14 +309,30 @@ __elf_machine_runtime_setup (struct link_map *map, int lazy, int profile)
 	 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.  */
+
+      /* Default minimum 4 words per cache line.  */
+      int line_size_words = 4;
+
+      /* Don't try this until ld.so has relocated itself!  */
+      int *line_size_ptr = &__cache_line_size;
+      if (lazy && 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 / 4;
+	}
 
       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;
     }