[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libunwind-devel] [PATCH 3/5] ARM: tests/Gtest-dyn1.c fixes.
From: |
Ken Werner |
Subject: |
[Libunwind-devel] [PATCH 3/5] ARM: tests/Gtest-dyn1.c fixes. |
Date: |
Thu, 21 Apr 2011 17:52:40 +0200 |
Define an appropriate fdesc struct and its corresponding accessors that take
care of the thumb marker on ARM. Call the __clear_cache built-in instead of
flush_cache if the GNU compiler is used.
Signed-off-by: Ken Werner <address@hidden>
---
tests/Gtest-dyn1.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/tests/Gtest-dyn1.c b/tests/Gtest-dyn1.c
index ad49a5c..b7b788f 100644
--- a/tests/Gtest-dyn1.c
+++ b/tests/Gtest-dyn1.c
@@ -62,6 +62,16 @@ struct fdesc
# define get_fdesc(fdesc,func) (fdesc = *(struct fdesc *) &(func))
# define get_funcp(fdesc) ((template_t) &(fdesc))
# define get_gp(fdesc) ((fdesc).gp)
+#elif __arm__
+struct fdesc
+ {
+ long code;
+ long is_thumb;
+ };
+# define get_fdesc(fdesc,func) ({(fdesc).code = (long) &(func) & ~0x1; \
+ (fdesc).is_thumb = (long) &(func) & 0x1;})
+# define get_funcp(fdesc) ((template_t) ((fdesc).code |
(fdesc).is_thumb))
+# define get_gp(fdesc) (0)
#else
struct fdesc
{
@@ -170,7 +180,12 @@ main (int argc, char *argv[])
memcpy (mem, (void *) fdesc.code, MAX_FUNC_SIZE);
mprotect ((void *) ((long) mem & ~(getpagesize () - 1)),
2*getpagesize(), PROT_READ | PROT_WRITE | PROT_EXEC);
+
+#ifdef __GNUC__
+ __clear_cache(mem, mem + MAX_FUNC_SIZE);
+#else
flush_cache (mem, MAX_FUNC_SIZE);
+#endif
signal (SIGSEGV, sighandler);
--
1.7.4.1
- [Libunwind-devel] [PATCH 0/5] ARM: initial support for local unw_resume and minor fixes, Ken Werner, 2011/04/21
- [Libunwind-devel] [PATCH 2/5] ARM: tests/Gtest-trace.c - IP printing, Ken Werner, 2011/04/21
- [Libunwind-devel] [PATCH 4/5] ARM: tests/Gtest-dyn1.c workaround for GCC bug., Ken Werner, 2011/04/21
- [Libunwind-devel] [PATCH 3/5] ARM: tests/Gtest-dyn1.c fixes.,
Ken Werner <=
- [Libunwind-devel] [PATCH 1/5] Add the appropriate libraries to the *_LDADD variables., Ken Werner, 2011/04/21
- [Libunwind-devel] [PATCH 5/5] Add initial support for local unw_resume on ARM Linux., Ken Werner, 2011/04/21
- Re: [Libunwind-devel] [PATCH 0/5] ARM: initial support for local unw_resume and minor fixes, Arun Sharma, 2011/04/21