[Sound-open-firmware] [PATCH] arch: add API call to get stack current pointer.

Liam Girdwood liam.r.girdwood at linux.intel.com
Thu Dec 21 18:18:58 CET 2017


Return the current stack pointer.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 src/arch/xtensa/include/arch/reef.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/arch/xtensa/include/arch/reef.h b/src/arch/xtensa/include/arch/reef.h
index ef2f395..149de5d 100644
--- a/src/arch/xtensa/include/arch/reef.h
+++ b/src/arch/xtensa/include/arch/reef.h
@@ -40,4 +40,16 @@ void *xthal_memcpy(void *dst, const void *src, size_t len);
 #define arch_memcpy(dest, src, size) \
 	xthal_memcpy(dest, src, size)
 
+static inline size_t arch_get_stack_ptr(void)
+{
+	size_t ptr;
+
+	/* stack pointer is in a1 */
+	__asm__ __volatile__ ("mov %0, a1"
+		: "=a" (ptr)
+		:
+		: "memory");
+	return ptr;
+}
+
 #endif
-- 
2.14.1



More information about the Sound-open-firmware mailing list