[rtems commit] bsp/qoriq: Use LA to load an address

Sebastian Huber sebh at rtems.org
Tue Aug 22 14:54:42 UTC 2017


Module:    rtems
Branch:    master
Commit:    c6994af7a7a1ba9afb0403d9e0785a905edab6ee
Changeset: http://git.rtems.org/rtems/commit/?id=c6994af7a7a1ba9afb0403d9e0785a905edab6ee

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Jul 31 15:10:33 2017 +0200

bsp/qoriq: Use LA to load an address

Add 64-bit support for LA.

Update #3082.

---

 c/src/lib/libbsp/powerpc/qoriq/start/start.S       | 44 +++++++++++-----------
 .../powerpc/shared/include/powerpc-utility.h       |  8 ++++
 2 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/c/src/lib/libbsp/powerpc/qoriq/start/start.S b/c/src/lib/libbsp/powerpc/qoriq/start/start.S
index bcdbb0c..0a2af7a 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/start/start.S
+++ b/c/src/lib/libbsp/powerpc/qoriq/start/start.S
@@ -54,45 +54,45 @@ _start:
 	bl	bsp_fdt_copy
 
 	/* Get start stack */
-	LWI	START_STACK, start_stack_end
+	LA	START_STACK, start_stack_end
 
 	bl	.Linitmore
 
 	/* Copy fast text */
-	LWI	r3, bsp_section_fast_text_begin
-	LWI	r4, bsp_section_fast_text_load_begin
-	LWI	r5, bsp_section_fast_text_size
+	LA	r3, bsp_section_fast_text_begin
+	LA	r4, bsp_section_fast_text_load_begin
+	LA	r5, bsp_section_fast_text_size
 	bl	.Lcopy
-	LWI	r3, bsp_section_fast_text_begin
-	LWI	r4, bsp_section_fast_text_size
+	LA	r3, bsp_section_fast_text_begin
+	LA	r4, bsp_section_fast_text_size
 	bl	rtems_cache_flush_multiple_data_lines
 
 	/* Copy read-only data */
-	LWI	r3, bsp_section_rodata_begin
-	LWI	r4, bsp_section_rodata_load_begin
-	LWI	r5, bsp_section_rodata_size
+	LA	r3, bsp_section_rodata_begin
+	LA	r4, bsp_section_rodata_load_begin
+	LA	r5, bsp_section_rodata_size
 	bl	.Lcopy
-	LWI	r3, bsp_section_rodata_begin
-	LWI	r4, bsp_section_rodata_size
+	LA	r3, bsp_section_rodata_begin
+	LA	r4, bsp_section_rodata_size
 	bl	rtems_cache_flush_multiple_data_lines
 
 	/* Copy fast data */
-	LWI	r3, bsp_section_fast_data_begin
-	LWI	r4, bsp_section_fast_data_load_begin
-	LWI	r5, bsp_section_fast_data_size
+	LA	r3, bsp_section_fast_data_begin
+	LA	r4, bsp_section_fast_data_load_begin
+	LA	r5, bsp_section_fast_data_size
 	bl	.Lcopy
 
 	/* Copy data */
-	LWI	r3, bsp_section_data_begin
-	LWI	r4, bsp_section_data_load_begin
-	LWI	r5, bsp_section_data_size
+	LA	r3, bsp_section_data_begin
+	LA	r4, bsp_section_data_load_begin
+	LA	r5, bsp_section_data_size
 	bl	.Lcopy
 
 	/* NULL pointer access protection (only core 0 has to do this) */
 	mfspr	r3, BOOKE_PIR
 	cmpwi	r3, 0
 	bne	.Lnull_area_setup_done
-	LWI	r3, bsp_section_start_begin
+	LA	r3, bsp_section_start_begin
 	srawi	r3, r3, 2
 	mtctr	r3
 	li	r3, -4
@@ -106,13 +106,13 @@ _start:
 	bl	.Linitmmu
 
 	/* Clear SBSS */
-	LWI	r3, bsp_section_sbss_begin
-	LWI	r4, bsp_section_sbss_size
+	LA	r3, bsp_section_sbss_begin
+	LA	r4, bsp_section_sbss_size
 	bl	bsp_start_zero
 
 	/* Clear BSS */
-	LWI	r3, bsp_section_bss_begin
-	LWI	r4, bsp_section_bss_size
+	LA	r3, bsp_section_bss_begin
+	LA	r4, bsp_section_bss_size
 	bl	bsp_start_zero
 
 	/* Set up EABI and SYSV environment */
diff --git a/c/src/lib/libcpu/powerpc/shared/include/powerpc-utility.h b/c/src/lib/libcpu/powerpc/shared/include/powerpc-utility.h
index ea063d5..4d6af38 100644
--- a/c/src/lib/libcpu/powerpc/shared/include/powerpc-utility.h
+++ b/c/src/lib/libcpu/powerpc/shared/include/powerpc-utility.h
@@ -869,8 +869,16 @@ void ShowBATS(void);
 #include <rtems/asm.h>
 
 .macro LA reg, addr
+#if defined(__powerpc64__)
+	lis	\reg, (\addr)@highest
+	ori	\reg, \reg, (\addr)@higher
+	rldicr	\reg, \reg, 32, 31
+	oris	\reg, \reg, (\addr)@h
+	ori	\reg, \reg, (\addr)@l
+#else
 	lis	\reg, (\addr)@h
 	ori	\reg, \reg, (\addr)@l
+#endif
 .endm
 
 .macro LA32 reg, addr



More information about the vc mailing list