[PATCH v3 3/4] ARM: aarch64: add ENTRY_PROC macro for arm64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



arm64 has no __naked__ attribute and the compiler adds a function prologue
for saving x29 and x30 to the stack for all C functions. This includes
functions defined using the ENTRY_FUNCTION macro. Therefore, the stack
needs to be setup before entering a C function, which is not possible if
the entry is a C function.

Provide a macro to implement the entry in assembly to be able to setup the
stack before entering the low level entry function.

Signed-off-by: Michael Tretter <m.tretter@xxxxxxxxxxxxxx>
---
v3:
- add SPDX-License-Identifier
---
 arch/arm/include/asm/barebox-arm64.h | 35 ++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 arch/arm/include/asm/barebox-arm64.h

diff --git a/arch/arm/include/asm/barebox-arm64.h b/arch/arm/include/asm/barebox-arm64.h
new file mode 100644
index 0000000000..58ff7b9b36
--- /dev/null
+++ b/arch/arm/include/asm/barebox-arm64.h
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef _BAREBOX_ARM64_H_
+#define _BAREBOX_ARM64_H_
+
+#include <linux/linkage.h>
+
+/*
+ * ENTRY_PROC - mark start of entry procedure
+ */
+#define ENTRY_PROC(name) \
+	.section .text_head_entry_##name; \
+	ENTRY(##name); \
+		b 2f; \
+		nop; \
+		nop; \
+		nop; \
+		nop; \
+		nop; \
+		nop; \
+		nop; \
+		.asciz "barebox"; \
+		.word 0xffffffff; \
+		.word _barebox_image_size; \
+		.rept 8; \
+		.word 0x55555555; \
+		.endr; \
+		2:
+
+/*
+ * ENTRY_PROC_END - mark end of entry procedure
+ */
+#define ENTRY_PROC_END(name) \
+	END(##name)
+
+#endif /* _BAREBOX_ARM64_H_ */
-- 
2.19.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux