summaryrefslogtreecommitdiff
path: root/debian/patches/upstreamme0003-kern-lock-use-compiler-built-in-functions-to-get-ret.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/upstreamme0003-kern-lock-use-compiler-built-in-functions-to-get-ret.patch')
-rw-r--r--debian/patches/upstreamme0003-kern-lock-use-compiler-built-in-functions-to-get-ret.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/debian/patches/upstreamme0003-kern-lock-use-compiler-built-in-functions-to-get-ret.patch b/debian/patches/upstreamme0003-kern-lock-use-compiler-built-in-functions-to-get-ret.patch
new file mode 100644
index 0000000..6389074
--- /dev/null
+++ b/debian/patches/upstreamme0003-kern-lock-use-compiler-built-in-functions-to-get-ret.patch
@@ -0,0 +1,55 @@
+From 1451a958347f5e683c63466cd7dfb893c1651f19 Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sat, 18 Jul 2015 18:46:24 +0200
+Subject: [PATCH gnumach 3/5] kern/lock: use compiler built-in functions to get
+ return address
+
+* kern/lock.c (struct simple_locks_info): Fix type of `ra'.
+(simple_lock, simple_lock_try): Use compiler built-in functions to get
+return address.
+---
+ kern/lock.c | 14 +++++---------
+ 1 file changed, 5 insertions(+), 9 deletions(-)
+
+diff --git a/kern/lock.c b/kern/lock.c
+index fb5e344..3c74fec 100644
+--- a/kern/lock.c
++++ b/kern/lock.c
+@@ -133,7 +133,7 @@ unsigned int simple_locks_taken = 0;
+
+ struct simple_locks_info {
+ simple_lock_t l;
+- unsigned int ra;
++ void *ra;
+ } simple_locks_info[NSLINFO];
+
+ void check_simple_locks(void)
+@@ -161,10 +161,8 @@ void simple_lock(
+
+ info = &simple_locks_info[simple_locks_taken++];
+ info->l = l;
+- /* XXX we want our return address, if possible */
+-#if defined(__i386__)
+- info->ra = *((unsigned long *)&l - 1);
+-#endif /* i386 */
++ info->ra =
++ __builtin_extract_return_addr (__builtin_return_address (0));
+ }
+
+ boolean_t simple_lock_try(
+@@ -179,10 +177,8 @@ boolean_t simple_lock_try(
+
+ info = &simple_locks_info[simple_locks_taken++];
+ info->l = l;
+- /* XXX we want our return address, if possible */
+-#if defined(__i386__)
+- info->ra = *((unsigned long *)&l - 1);
+-#endif /* i386 */
++ info->ra =
++ __builtin_extract_return_addr (__builtin_return_address (0));
+
+ return TRUE;
+ }
+--
+2.1.4
+