diff options
author | Dave Airlie <[email protected]> | 2019-08-09 13:25:56 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2019-08-16 09:00:35 +1000 |
commit | f3af7886fe46706df9d21deb1ccb5de3d04a5507 (patch) | |
tree | a42a5e2bb6972438ba1187b7638bec5d8e51ac37 /src/mesa/x86-64 | |
parent | 78eda70892ebaa03e2c1d87cceb386828a1ce64b (diff) |
mesa: add support for CET to x86/x86-64 asm files.
Control-flow enforcement technology is a new instructions on x86
processors to denote where indirect jumps can land. Gcc auto adds
the instruction (which encodes as a NOP on older CPUs) to entrypoints
but assembler files need manual adding. This adds it to all the
entry points in the mesa x86/x86-64 assembler files.
This will only happen if mesa is built with the -fcf-protection flag
to gcc as some distros are wanting to do.
Acked-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/x86-64')
-rw-r--r-- | src/mesa/x86-64/xform4.S | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mesa/x86-64/xform4.S b/src/mesa/x86-64/xform4.S index b5d224237cf..e36a6276d2a 100644 --- a/src/mesa/x86-64/xform4.S +++ b/src/mesa/x86-64/xform4.S @@ -21,6 +21,11 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ +#ifdef HAVE_CET_H +#include <cet.h> +#else +#define _CET_ENDBR +#endif #ifdef USE_X86_64_ASM @@ -33,6 +38,7 @@ .globl _mesa_x86_64_cpuid .hidden _mesa_x86_64_cpuid _mesa_x86_64_cpuid: + _CET_ENDBR pushq %rbx movl (%rdi), %eax movl 8(%rdi), %ecx @@ -55,6 +61,7 @@ _mesa_x86_64_transform_points4_general: * rsi = matrix * rdx = source */ + _CET_ENDBR movl V4F_COUNT(%rdx), %ecx /* count */ movzbl V4F_STRIDE(%rdx), %eax /* stride */ @@ -130,7 +137,7 @@ p4_constants: * because it ensures that the last matrix row (or is it column?) is 0,0,0,1 */ _mesa_x86_64_transform_points4_3d: - + _CET_ENDBR leaq p4_constants(%rip), %rax prefetchnta 64(%rsi) @@ -198,7 +205,7 @@ p4_3d_done: .globl _mesa_x86_64_transform_points4_identity .hidden _mesa_x86_64_transform_points4_identity _mesa_x86_64_transform_points4_identity: - + _CET_ENDBR movl V4F_COUNT(%rdx), %ecx /* count */ movzbl V4F_STRIDE(%rdx), %eax /* stride */ @@ -227,7 +234,7 @@ p4_identity_done: .globl _mesa_3dnow_transform_points4_3d_no_rot .hidden _mesa_3dnow_transform_points4_3d_no_rot _mesa_3dnow_transform_points4_3d_no_rot: - + _CET_ENDBR movl V4F_COUNT(%rdx), %ecx /* count */ movzbl V4F_STRIDE(%rdx), %eax /* stride */ @@ -292,7 +299,7 @@ p4_3d_no_rot_done: .globl _mesa_3dnow_transform_points4_perspective .hidden _mesa_3dnow_transform_points4_perspective _mesa_3dnow_transform_points4_perspective: - + _CET_ENDBR movl V4F_COUNT(%rdx), %ecx /* count */ movzbl V4F_STRIDE(%rdx), %eax /* stride */ @@ -359,7 +366,7 @@ p4_perspective_done: .globl _mesa_3dnow_transform_points4_2d_no_rot .hidden _mesa_3dnow_transform_points4_2d_no_rot _mesa_3dnow_transform_points4_2d_no_rot: - + _CET_ENDBR movl V4F_COUNT(%rdx), %ecx /* count */ movzbl V4F_STRIDE(%rdx), %eax /* stride */ @@ -415,7 +422,7 @@ p4_2d_no_rot_done: .globl _mesa_3dnow_transform_points4_2d .hidden _mesa_3dnow_transform_points4_2d _mesa_3dnow_transform_points4_2d: - + _CET_ENDBR movl V4F_COUNT(%rdx), %ecx /* count */ movzbl V4F_STRIDE(%rdx), %eax /* stride */ |