summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libexec/ld.so/sparc/rtld_machine.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/libexec/ld.so/sparc/rtld_machine.c b/libexec/ld.so/sparc/rtld_machine.c
index 9c462341a23..2f83bb4ce9c 100644
--- a/libexec/ld.so/sparc/rtld_machine.c
+++ b/libexec/ld.so/sparc/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.3 2002/07/29 15:20:38 art Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.4 2002/08/08 21:18:30 jason Exp $ */
/*
* Copyright (c) 1999 Dale Rahn
@@ -180,6 +180,15 @@ _dl_reloc_plt(Elf_Addr *where, Elf_Addr value)
where[1] = SETHI | ((value >> 10) & 0x003fffff);
__asm __volatile("iflush %0+8" : : "r" (where));
__asm __volatile("iflush %0+4" : : "r" (where));
+ /*
+ * iflush requires 5 subsequent cycles to be sure all copies
+ * are flushed from the CPU and the icache.
+ */
+ __asm __volatile("nop");
+ __asm __volatile("nop");
+ __asm __volatile("nop");
+ __asm __volatile("nop");
+ __asm __volatile("nop");
}
int
@@ -385,4 +394,17 @@ _dl_md_reloc_got(elf_object_t *object, int lazy)
((Elf_Addr)&_dl_bind_start - (Elf_Addr)&pltgot[1]) >> 2;
pltgot[2] = NOP;
pltgot[3] = (Elf_Addr) object;
+ __asm __volatile("iflush %0+12" : : "r" (pltgot));
+ __asm __volatile("iflush %0+8" : : "r" (pltgot));
+ __asm __volatile("iflush %0+4" : : "r" (pltgot));
+ __asm __volatile("iflush %0+0" : : "r" (pltgot));
+ /*
+ * iflush requires 5 subsequent cycles to be sure all copies
+ * are flushed from the CPU and the icache.
+ */
+ __asm __volatile("nop");
+ __asm __volatile("nop");
+ __asm __volatile("nop");
+ __asm __volatile("nop");
+ __asm __volatile("nop");
}