[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libunwind-devel] [PATCH 24/27] Flush icache with __builtin___clear_cach
From: |
Tommi Rantala |
Subject: |
[Libunwind-devel] [PATCH 24/27] Flush icache with __builtin___clear_cache() in tests when compiling with GCC |
Date: |
Wed, 22 Aug 2012 14:28:50 +0300 |
When compiling with GCC, use the builtin instruction cache flushing
mechanism in all tests where it is needed.
Quoting GCC docs: ''If the target does not require instruction cache
flushes, __builtin___clear_cache has no effect. Otherwise either
instructions are emitted in-line to clear the instruction cache or a
call to the __clear_cache function in libgcc is made.''.
---
tests/Gtest-dyn1.c | 4 +++-
tests/flush-cache.S | 4 ++++
tests/ia64-test-dyn1.c | 6 ++++++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/tests/Gtest-dyn1.c b/tests/Gtest-dyn1.c
index b530dd7..df2ab4a 100644
--- a/tests/Gtest-dyn1.c
+++ b/tests/Gtest-dyn1.c
@@ -86,7 +86,9 @@ struct fdesc
# define get_gp(fdesc) (0)
#endif
+#ifndef __GNUC__
extern void flush_cache (void *addr, size_t len);
+#endif
void
template (int i, template_t self,
@@ -186,7 +188,7 @@ main (int argc, char *argv[] __attribute__((unused)))
2*getpagesize(), PROT_READ | PROT_WRITE | PROT_EXEC);
#ifdef __GNUC__
- __clear_cache(mem, mem + MAX_FUNC_SIZE);
+ __builtin___clear_cache(mem, mem + MAX_FUNC_SIZE);
#else
flush_cache (mem, MAX_FUNC_SIZE);
#endif
diff --git a/tests/flush-cache.S b/tests/flush-cache.S
index 2a17165..f441a74 100644
--- a/tests/flush-cache.S
+++ b/tests/flush-cache.S
@@ -1,3 +1,5 @@
+#ifndef __GNUC__
+
#if defined(__ia64__)
.global flush_cache
@@ -80,3 +82,5 @@ flush_cache:
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif
+
+#endif
diff --git a/tests/ia64-test-dyn1.c b/tests/ia64-test-dyn1.c
index c47097c..8331913 100644
--- a/tests/ia64-test-dyn1.c
+++ b/tests/ia64-test-dyn1.c
@@ -20,7 +20,9 @@ int verbose;
# define EXTRA 0
#endif
+#ifndef __GNUC__
extern void flush_cache (void *addr, size_t len);
+#endif
int
make_executable (void *addr, size_t len)
@@ -31,7 +33,11 @@ make_executable (void *addr, size_t len)
perror ("mprotect");
return -1;
}
+#ifdef __GNUC__
+ __builtin___clear_cache(addr, addr + len);
+#else
flush_cache (addr, len);
+#endif
return 0;
}
--
1.7.9.5
- [Libunwind-devel] [PATCH 17/27] Use constants for ELF magic bytes in _UCD_create.c, (continued)
- [Libunwind-devel] [PATCH 17/27] Use constants for ELF magic bytes in _UCD_create.c, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 23/27] Avoid -Wunused-value warning in tests/Gtest-exc.c, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 18/27] Remove unneeded length modifier from suppressed match in sscanf() format in tests/crasher.c, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 19/27] Fix memory leaks in unw_create_addr_space() wrong-endian error paths, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 16/27] Fix plain return from main() in tests/test-async-sig.c, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 22/27] test-resume-sig-rt: test unw_resume() in presence of "realtime" signal frame, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 25/27] Place `inline' at beginning of declaration of invalidate_edi(), Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 20/27] ARM: fix non-signal-frame local unw_resume() due to compiler optimization cleverness, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 21/27] ARM: fix with-signal-frame local unw_resume(), Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 24/27] Flush icache with __builtin___clear_cache() in tests when compiling with GCC,
Tommi Rantala <=
- [Libunwind-devel] [PATCH 26/27] Fix function name duplication in Debug() output, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 27/27] Add missing newline to debug message in _UCD_access_reg_linux.c, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 02/27] HPPA: add `global_cache' member to unw_addr_space struct, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 09/27] Run `autoupdate' to stop using obsoleted macros in `configure.in', Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 01/27] HPPA: fix tdep_put_unwind_info() macro, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 06/27] Eliminate unused parameters in tests, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 07/27] Annotate unused parameters in tests, Tommi Rantala, 2012/08/22
- [Libunwind-devel] [PATCH 03/27] HPPA: include `mempool.h' in `libunwind_i.h', Tommi Rantala, 2012/08/22