public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Add libgcc support for cache clearing on ARM VxWorks
@ 2017-08-01 14:31 Olivier Hainque
  2017-08-01 14:32 ` Olivier Hainque
  2017-08-10 13:27 ` Richard Earnshaw (lists)
  0 siblings, 2 replies; 5+ messages in thread
From: Olivier Hainque @ 2017-08-01 14:31 UTC (permalink / raw)
  To: GCC Patches
  Cc: Olivier Hainque, Douglas B Rupp, Jerome Lambourg,
	Richard Earnshaw (lists)

[-- Attachment #1: Type: text/plain, Size: 1317 bytes --]

Hello,

On top of previous changes reworking the arm-vxworks support

  https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00085.html
  https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00075.html
  https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00078.html

This patch adds a variant implementation of _clear_cache
for arm-vxworks*, needed for proper functioning of trampolines
on targets with separate instruction/data caches.

This allows, among other things, Ada tasking programs to
run on variety of configurations which we are exercising with
at least ACATS nightly with gcc-6 based compilers.

As this is touching a common ARM implementation file (lib1funcs.S),
this presumably requires approval from an ARM port maintainer. CC
Richard for this, as he participated in recent discussions regarding
VxWorks for ARM.

OK to commit ?

Thanks much in advance for your feedback,

With Kind Regards,

Olivier

2017-08-01  Doug Rupp  <rupp@adacore.com>
            Olivier Hainque  <hainque@adacore.com>

   	libgcc/
    	* config/arm/lib1funcs.S (_clear_cache): Add variant for __vxworks.
    	* config/arm/t-vxworks: New file, add _clear_cache to LIB1ASMFUNCS.
    	* config.host (arm-wrs-vxworks, arm-wrs-vxworks7): Add arm/t-vxworks
    	to tmake_file.
    
    	gcc/
    	* config/arm/vxworks.h (CLEAR_INSN_CACHE): Define.


[-- Attachment #2: 0004-Add-libgcc-support-for-insn-cache-clearing-on-ARM-Vx.patch --]
[-- Type: application/octet-stream, Size: 2461 bytes --]

--- a/gcc/config/arm/vxworks.h
+++ b/gcc/config/arm/vxworks.h
@@ -154,6 +154,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #undef TARGET_DEFAULT_WORD_RELOCATIONS
 #define TARGET_DEFAULT_WORD_RELOCATIONS 1
 
+/* Clear the instruction cache from `beg' to `end'.  This is
+   implemented in lib1funcs.S, so ensure an error if this definition
+   is used.  */
+#undef  CLEAR_INSN_CACHE
+#define CLEAR_INSN_CACHE(BEG, END) not_used
+
 /* Define this to be nonzero if static stack checking is supported.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
 
diff --git a/libgcc/config.host b/libgcc/config.host
index 9556c77..a35c8fb7 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -389,7 +389,7 @@ arc*-*-linux*)
 	extra_parts="$extra_parts crttls.o"
 	;;
 arm-wrs-vxworks|arm-wrs-vxworks7)
-	tmake_file="$tmake_file arm/t-arm arm/t-elf t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
+	tmake_file="$tmake_file arm/t-arm arm/t-elf t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp arm/t-vxworks"
 	extra_parts="$extra_parts crti.o crtn.o"
 	case ${host} in
 	*-*-vxworks7)
diff --git a/libgcc/config/arm/lib1funcs.S b/libgcc/config/arm/lib1funcs.S
index 8d8c3ce..4b21c02 100644
--- a/libgcc/config/arm/lib1funcs.S
+++ b/libgcc/config/arm/lib1funcs.S
@@ -1572,8 +1572,27 @@ LSYM(Lover12):
 	do_pop	{r7}
 	RET
 	FUNC_END clear_cache
+#elif defined __vxworks
+	ARM_FUNC_START clear_cache
+.L1:
+	mcr	p15, 0, r0, c7, c11, 1	@ Clean data cache by MVA to PoU
+	mcr	p15, 0, r0, c7, c10, 4	@ Ensure visibility of the data
+					@ cleaned from the cache
+	mcr	p15, 0, r0, c7, c5, 1	@ Invalidate instruction cache by
+					@ MVA to PoU
+	mcr	p15, 0, r0, c7, c5, 7	@ Invalidate branch predictor by
+					@ MVA to PoU
+	mcr	p15, 0, r0, c7, c10, 4	@ Ensure completion of the
+					@ invalidations
+	mcr	p15, 0, r0, c7, c5, 4	@ Synchronize fetched instruction
+					@ stream
+	add	r0, r0, #4		@ Increment MVA
+	cmp	r0, r1
+	ble	.L1			@ Loop if MVA <= End Address
+	RET
+	FUNC_END clear_cache
 #else
-#error "This is only for ARM EABI GNU/Linux"
+#error "This is only for ARM EABI GNU/Linux or ARM VxWorks"
 #endif
 #endif /* L_clear_cache */
 /* ------------------------------------------------------------------------ */
diff --git a/libgcc/config/arm/t-vxworks b/libgcc/config/arm/t-vxworks
new file mode 100644
index 0000000..ba0c109
--- /dev/null
+++ b/libgcc/config/arm/t-vxworks
@@ -0,0 +1 @@
+LIB1ASMFUNCS += _clear_cache
-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-08-28 12:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-01 14:31 [PATCH] Add libgcc support for cache clearing on ARM VxWorks Olivier Hainque
2017-08-01 14:32 ` Olivier Hainque
2017-08-10 13:27 ` Richard Earnshaw (lists)
2017-08-13 22:34   ` Olivier Hainque
2017-08-28 14:27     ` Olivier Hainque

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).