On Mon, Sep 5, 2016 at 8:10 AM, stimits@comcast.net wrote:
There is a Linux kernel file "arch/arm64/kernel/deprecated.c". Within that file is a block of code which is apparently designed to detect some sort of older obsolete 32-bit code. Specifically, the warning message is "Using deprecated CP15 barrier instruction".
I assume this is the same file as armv8_deprecated.c in the linux 4.0 sources I have. The file provides code to emulate deprecated instructions. You can emulate a deprecated instruction if you catch the illegal instruction trap that was generated, and then call some emulation code instead of sending a signal to the program. The emulation code prints a warning to let you know that you have some very old code that really should be re-compiled. That is the point of the emulation. it isn't to handle any code generated by the current compiler for current targets, but rather code generated by an old compiler or for old targets that is using instructions that have since been deprecated.
It appears that you need to use an armv6 compiler to get the cp15 barrier instruction, which was deprecated in favor of the new dmb/dsb instructions in armv7.
Since these are memory synchronization barriers, you can get them from C code, but only if you are doing something special, like calling the old sync built-ins or the new atomic built-ins, or using a compiler feature that will cause these builtins to be called automatically such as a feature that uses thread support or coroutines or some similar feature.
There is no synchronization support in gcc-4.3. Looking at the gcc-4.4 arm support, I see that there are two special instructions for getting memory synchronization support from the kernel. #define __kernel_cmpxchg (*(__kernel_cmpxchg_t *) 0xffff0fc0) #define __kernel_dmb (*(__kernel_dmb_t *) 0xffff0fa0) It appears that reading from a protected memory location is somehow triggering the kernel support. In gcc-4.7, the sync intrinsics were rewritten, and here I see that gcc is now emitting dmb for armv7 and a cp15 barrier for armv6. The current support is the same.
So you can get a cp15 barrier from the current compiler, but you need to compile for armv6, and directly or indirectly call the synchronization and/or atomic builtins.
Jim