Commit abfcc11e authored by Dave Airlie's avatar Dave Airlie

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's avatarEric Anholt <eric@anholt.net>
parent 6c84a266
Pipeline #56750 failed with stages
in 12 minutes and 38 seconds
...@@ -1034,7 +1034,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major') ...@@ -1034,7 +1034,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major')
pre_args += '-DMAJOR_IN_MKDEV' pre_args += '-DMAJOR_IN_MKDEV'
endif endif
foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'execinfo.h', 'sys/shm.h'] foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'execinfo.h', 'sys/shm.h', 'cet.h']
if cc.compiles('#include <@0@>'.format(h), name : '@0@'.format(h)) if cc.compiles('#include <@0@>'.format(h), name : '@0@'.format(h))
pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
endif endif
......
...@@ -21,6 +21,11 @@ ...@@ -21,6 +21,11 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifdef HAVE_CET_H
#include <cet.h>
#else
#define _CET_ENDBR
#endif
#ifdef USE_X86_64_ASM #ifdef USE_X86_64_ASM
...@@ -33,6 +38,7 @@ ...@@ -33,6 +38,7 @@
.globl _mesa_x86_64_cpuid .globl _mesa_x86_64_cpuid
.hidden _mesa_x86_64_cpuid .hidden _mesa_x86_64_cpuid
_mesa_x86_64_cpuid: _mesa_x86_64_cpuid:
_CET_ENDBR
pushq %rbx pushq %rbx
movl (%rdi), %eax movl (%rdi), %eax
movl 8(%rdi), %ecx movl 8(%rdi), %ecx
...@@ -55,6 +61,7 @@ _mesa_x86_64_transform_points4_general: ...@@ -55,6 +61,7 @@ _mesa_x86_64_transform_points4_general:
* rsi = matrix * rsi = matrix
* rdx = source * rdx = source
*/ */
_CET_ENDBR
movl V4F_COUNT(%rdx), %ecx /* count */ movl V4F_COUNT(%rdx), %ecx /* count */
movzbl V4F_STRIDE(%rdx), %eax /* stride */ movzbl V4F_STRIDE(%rdx), %eax /* stride */
...@@ -130,7 +137,7 @@ p4_constants: ...@@ -130,7 +137,7 @@ p4_constants:
* because it ensures that the last matrix row (or is it column?) is 0,0,0,1 * because it ensures that the last matrix row (or is it column?) is 0,0,0,1
*/ */
_mesa_x86_64_transform_points4_3d: _mesa_x86_64_transform_points4_3d:
_CET_ENDBR
leaq p4_constants(%rip), %rax leaq p4_constants(%rip), %rax
prefetchnta 64(%rsi) prefetchnta 64(%rsi)
...@@ -198,7 +205,7 @@ p4_3d_done: ...@@ -198,7 +205,7 @@ p4_3d_done:
.globl _mesa_x86_64_transform_points4_identity .globl _mesa_x86_64_transform_points4_identity
.hidden _mesa_x86_64_transform_points4_identity .hidden _mesa_x86_64_transform_points4_identity
_mesa_x86_64_transform_points4_identity: _mesa_x86_64_transform_points4_identity:
_CET_ENDBR
movl V4F_COUNT(%rdx), %ecx /* count */ movl V4F_COUNT(%rdx), %ecx /* count */
movzbl V4F_STRIDE(%rdx), %eax /* stride */ movzbl V4F_STRIDE(%rdx), %eax /* stride */
...@@ -227,7 +234,7 @@ p4_identity_done: ...@@ -227,7 +234,7 @@ p4_identity_done:
.globl _mesa_3dnow_transform_points4_3d_no_rot .globl _mesa_3dnow_transform_points4_3d_no_rot
.hidden _mesa_3dnow_transform_points4_3d_no_rot .hidden _mesa_3dnow_transform_points4_3d_no_rot
_mesa_3dnow_transform_points4_3d_no_rot: _mesa_3dnow_transform_points4_3d_no_rot:
_CET_ENDBR
movl V4F_COUNT(%rdx), %ecx /* count */ movl V4F_COUNT(%rdx), %ecx /* count */
movzbl V4F_STRIDE(%rdx), %eax /* stride */ movzbl V4F_STRIDE(%rdx), %eax /* stride */
...@@ -292,7 +299,7 @@ p4_3d_no_rot_done: ...@@ -292,7 +299,7 @@ p4_3d_no_rot_done:
.globl _mesa_3dnow_transform_points4_perspective .globl _mesa_3dnow_transform_points4_perspective
.hidden _mesa_3dnow_transform_points4_perspective .hidden _mesa_3dnow_transform_points4_perspective
_mesa_3dnow_transform_points4_perspective: _mesa_3dnow_transform_points4_perspective:
_CET_ENDBR
movl V4F_COUNT(%rdx), %ecx /* count */ movl V4F_COUNT(%rdx), %ecx /* count */
movzbl V4F_STRIDE(%rdx), %eax /* stride */ movzbl V4F_STRIDE(%rdx), %eax /* stride */
...@@ -359,7 +366,7 @@ p4_perspective_done: ...@@ -359,7 +366,7 @@ p4_perspective_done:
.globl _mesa_3dnow_transform_points4_2d_no_rot .globl _mesa_3dnow_transform_points4_2d_no_rot
.hidden _mesa_3dnow_transform_points4_2d_no_rot .hidden _mesa_3dnow_transform_points4_2d_no_rot
_mesa_3dnow_transform_points4_2d_no_rot: _mesa_3dnow_transform_points4_2d_no_rot:
_CET_ENDBR
movl V4F_COUNT(%rdx), %ecx /* count */ movl V4F_COUNT(%rdx), %ecx /* count */
movzbl V4F_STRIDE(%rdx), %eax /* stride */ movzbl V4F_STRIDE(%rdx), %eax /* stride */
...@@ -415,7 +422,7 @@ p4_2d_no_rot_done: ...@@ -415,7 +422,7 @@ p4_2d_no_rot_done:
.globl _mesa_3dnow_transform_points4_2d .globl _mesa_3dnow_transform_points4_2d
.hidden _mesa_3dnow_transform_points4_2d .hidden _mesa_3dnow_transform_points4_2d
_mesa_3dnow_transform_points4_2d: _mesa_3dnow_transform_points4_2d:
_CET_ENDBR
movl V4F_COUNT(%rdx), %ecx /* count */ movl V4F_COUNT(%rdx), %ecx /* count */
movzbl V4F_STRIDE(%rdx), %eax /* stride */ movzbl V4F_STRIDE(%rdx), %eax /* stride */
......
...@@ -38,7 +38,7 @@ ALIGNTEXT16 ...@@ -38,7 +38,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points1_general ) GLOBL GLNAME( _mesa_3dnow_transform_points1_general )
HIDDEN(_mesa_3dnow_transform_points1_general) HIDDEN(_mesa_3dnow_transform_points1_general)
GLNAME( _mesa_3dnow_transform_points1_general ): GLNAME( _mesa_3dnow_transform_points1_general ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -103,7 +103,7 @@ ALIGNTEXT16 ...@@ -103,7 +103,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points1_identity ) GLOBL GLNAME( _mesa_3dnow_transform_points1_identity )
HIDDEN(_mesa_3dnow_transform_points1_identity) HIDDEN(_mesa_3dnow_transform_points1_identity)
GLNAME( _mesa_3dnow_transform_points1_identity ): GLNAME( _mesa_3dnow_transform_points1_identity ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -151,7 +151,7 @@ ALIGNTEXT16 ...@@ -151,7 +151,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points1_3d_no_rot ) GLOBL GLNAME( _mesa_3dnow_transform_points1_3d_no_rot )
HIDDEN(_mesa_3dnow_transform_points1_3d_no_rot) HIDDEN(_mesa_3dnow_transform_points1_3d_no_rot)
GLNAME( _mesa_3dnow_transform_points1_3d_no_rot ): GLNAME( _mesa_3dnow_transform_points1_3d_no_rot ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -209,7 +209,7 @@ ALIGNTEXT16 ...@@ -209,7 +209,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points1_perspective ) GLOBL GLNAME( _mesa_3dnow_transform_points1_perspective )
HIDDEN(_mesa_3dnow_transform_points1_perspective) HIDDEN(_mesa_3dnow_transform_points1_perspective)
GLNAME( _mesa_3dnow_transform_points1_perspective ): GLNAME( _mesa_3dnow_transform_points1_perspective ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -263,7 +263,7 @@ ALIGNTEXT16 ...@@ -263,7 +263,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points1_2d ) GLOBL GLNAME( _mesa_3dnow_transform_points1_2d )
HIDDEN(_mesa_3dnow_transform_points1_2d) HIDDEN(_mesa_3dnow_transform_points1_2d)
GLNAME( _mesa_3dnow_transform_points1_2d ): GLNAME( _mesa_3dnow_transform_points1_2d ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -319,7 +319,7 @@ ALIGNTEXT16 ...@@ -319,7 +319,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points1_2d_no_rot ) GLOBL GLNAME( _mesa_3dnow_transform_points1_2d_no_rot )
HIDDEN(_mesa_3dnow_transform_points1_2d_no_rot) HIDDEN(_mesa_3dnow_transform_points1_2d_no_rot)
GLNAME( _mesa_3dnow_transform_points1_2d_no_rot ): GLNAME( _mesa_3dnow_transform_points1_2d_no_rot ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -373,7 +373,7 @@ ALIGNTEXT16 ...@@ -373,7 +373,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points1_3d ) GLOBL GLNAME( _mesa_3dnow_transform_points1_3d )
HIDDEN(_mesa_3dnow_transform_points1_3d) HIDDEN(_mesa_3dnow_transform_points1_3d)
GLNAME( _mesa_3dnow_transform_points1_3d ): GLNAME( _mesa_3dnow_transform_points1_3d ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
......
...@@ -38,7 +38,7 @@ ALIGNTEXT16 ...@@ -38,7 +38,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points2_general ) GLOBL GLNAME( _mesa_3dnow_transform_points2_general )
HIDDEN(_mesa_3dnow_transform_points2_general) HIDDEN(_mesa_3dnow_transform_points2_general)
GLNAME( _mesa_3dnow_transform_points2_general ): GLNAME( _mesa_3dnow_transform_points2_general ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -119,7 +119,7 @@ ALIGNTEXT16 ...@@ -119,7 +119,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points2_perspective ) GLOBL GLNAME( _mesa_3dnow_transform_points2_perspective )
HIDDEN(_mesa_3dnow_transform_points2_perspective) HIDDEN(_mesa_3dnow_transform_points2_perspective)
GLNAME( _mesa_3dnow_transform_points2_perspective ): GLNAME( _mesa_3dnow_transform_points2_perspective ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -175,7 +175,7 @@ ALIGNTEXT16 ...@@ -175,7 +175,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points2_3d ) GLOBL GLNAME( _mesa_3dnow_transform_points2_3d )
HIDDEN(_mesa_3dnow_transform_points2_3d) HIDDEN(_mesa_3dnow_transform_points2_3d)
GLNAME( _mesa_3dnow_transform_points2_3d ): GLNAME( _mesa_3dnow_transform_points2_3d ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -252,7 +252,7 @@ ALIGNTEXT16 ...@@ -252,7 +252,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points2_3d_no_rot ) GLOBL GLNAME( _mesa_3dnow_transform_points2_3d_no_rot )
HIDDEN(_mesa_3dnow_transform_points2_3d_no_rot) HIDDEN(_mesa_3dnow_transform_points2_3d_no_rot)
GLNAME( _mesa_3dnow_transform_points2_3d_no_rot ): GLNAME( _mesa_3dnow_transform_points2_3d_no_rot ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -311,7 +311,7 @@ ALIGNTEXT16 ...@@ -311,7 +311,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points2_2d ) GLOBL GLNAME( _mesa_3dnow_transform_points2_2d )
HIDDEN(_mesa_3dnow_transform_points2_2d) HIDDEN(_mesa_3dnow_transform_points2_2d)
GLNAME( _mesa_3dnow_transform_points2_2d ): GLNAME( _mesa_3dnow_transform_points2_2d ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -375,7 +375,7 @@ ALIGNTEXT16 ...@@ -375,7 +375,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points2_2d_no_rot ) GLOBL GLNAME( _mesa_3dnow_transform_points2_2d_no_rot )
HIDDEN(_mesa_3dnow_transform_points2_2d_no_rot) HIDDEN(_mesa_3dnow_transform_points2_2d_no_rot)
GLNAME( _mesa_3dnow_transform_points2_2d_no_rot ): GLNAME( _mesa_3dnow_transform_points2_2d_no_rot ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -431,7 +431,7 @@ ALIGNTEXT16 ...@@ -431,7 +431,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points2_identity ) GLOBL GLNAME( _mesa_3dnow_transform_points2_identity )
HIDDEN(_mesa_3dnow_transform_points2_identity) HIDDEN(_mesa_3dnow_transform_points2_identity)
GLNAME( _mesa_3dnow_transform_points2_identity ): GLNAME( _mesa_3dnow_transform_points2_identity ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
......
...@@ -38,7 +38,7 @@ ALIGNTEXT16 ...@@ -38,7 +38,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points3_general ) GLOBL GLNAME( _mesa_3dnow_transform_points3_general )
HIDDEN(_mesa_3dnow_transform_points3_general) HIDDEN(_mesa_3dnow_transform_points3_general)
GLNAME( _mesa_3dnow_transform_points3_general ): GLNAME( _mesa_3dnow_transform_points3_general ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -123,7 +123,7 @@ ALIGNTEXT16 ...@@ -123,7 +123,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points3_perspective ) GLOBL GLNAME( _mesa_3dnow_transform_points3_perspective )
HIDDEN(_mesa_3dnow_transform_points3_perspective) HIDDEN(_mesa_3dnow_transform_points3_perspective)
GLNAME( _mesa_3dnow_transform_points3_perspective ): GLNAME( _mesa_3dnow_transform_points3_perspective ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -204,7 +204,7 @@ ALIGNTEXT16 ...@@ -204,7 +204,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points3_3d ) GLOBL GLNAME( _mesa_3dnow_transform_points3_3d )
HIDDEN(_mesa_3dnow_transform_points3_3d) HIDDEN(_mesa_3dnow_transform_points3_3d)
GLNAME( _mesa_3dnow_transform_points3_3d ): GLNAME( _mesa_3dnow_transform_points3_3d ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -292,7 +292,7 @@ ALIGNTEXT16 ...@@ -292,7 +292,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points3_3d_no_rot ) GLOBL GLNAME( _mesa_3dnow_transform_points3_3d_no_rot )
HIDDEN(_mesa_3dnow_transform_points3_3d_no_rot) HIDDEN(_mesa_3dnow_transform_points3_3d_no_rot)
GLNAME( _mesa_3dnow_transform_points3_3d_no_rot ): GLNAME( _mesa_3dnow_transform_points3_3d_no_rot ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -368,7 +368,7 @@ ALIGNTEXT16 ...@@ -368,7 +368,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points3_2d ) GLOBL GLNAME( _mesa_3dnow_transform_points3_2d )
HIDDEN(_mesa_3dnow_transform_points3_2d) HIDDEN(_mesa_3dnow_transform_points3_2d)
GLNAME( _mesa_3dnow_transform_points3_2d ): GLNAME( _mesa_3dnow_transform_points3_2d ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -441,7 +441,7 @@ ALIGNTEXT16 ...@@ -441,7 +441,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points3_2d_no_rot ) GLOBL GLNAME( _mesa_3dnow_transform_points3_2d_no_rot )
HIDDEN(_mesa_3dnow_transform_points3_2d_no_rot) HIDDEN(_mesa_3dnow_transform_points3_2d_no_rot)
GLNAME( _mesa_3dnow_transform_points3_2d_no_rot ): GLNAME( _mesa_3dnow_transform_points3_2d_no_rot ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -508,7 +508,7 @@ ALIGNTEXT16 ...@@ -508,7 +508,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points3_identity ) GLOBL GLNAME( _mesa_3dnow_transform_points3_identity )
HIDDEN(_mesa_3dnow_transform_points3_identity) HIDDEN(_mesa_3dnow_transform_points3_identity)
GLNAME( _mesa_3dnow_transform_points3_identity ): GLNAME( _mesa_3dnow_transform_points3_identity ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
......
...@@ -38,7 +38,7 @@ ALIGNTEXT16 ...@@ -38,7 +38,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points4_general ) GLOBL GLNAME( _mesa_3dnow_transform_points4_general )
HIDDEN(_mesa_3dnow_transform_points4_general) HIDDEN(_mesa_3dnow_transform_points4_general)
GLNAME( _mesa_3dnow_transform_points4_general ): GLNAME( _mesa_3dnow_transform_points4_general ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -131,7 +131,7 @@ ALIGNTEXT16 ...@@ -131,7 +131,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points4_perspective ) GLOBL GLNAME( _mesa_3dnow_transform_points4_perspective )
HIDDEN(_mesa_3dnow_transform_points4_perspective) HIDDEN(_mesa_3dnow_transform_points4_perspective)
GLNAME( _mesa_3dnow_transform_points4_perspective ): GLNAME( _mesa_3dnow_transform_points4_perspective ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -211,7 +211,7 @@ ALIGNTEXT16 ...@@ -211,7 +211,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points4_3d ) GLOBL GLNAME( _mesa_3dnow_transform_points4_3d )
HIDDEN(_mesa_3dnow_transform_points4_3d) HIDDEN(_mesa_3dnow_transform_points4_3d)
GLNAME( _mesa_3dnow_transform_points4_3d ): GLNAME( _mesa_3dnow_transform_points4_3d ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -301,7 +301,7 @@ ALIGNTEXT16 ...@@ -301,7 +301,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points4_3d_no_rot ) GLOBL GLNAME( _mesa_3dnow_transform_points4_3d_no_rot )
HIDDEN(_mesa_3dnow_transform_points4_3d_no_rot) HIDDEN(_mesa_3dnow_transform_points4_3d_no_rot)
GLNAME( _mesa_3dnow_transform_points4_3d_no_rot ): GLNAME( _mesa_3dnow_transform_points4_3d_no_rot ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
MOV_L ( ARG_MATRIX, ESI ) MOV_L ( ARG_MATRIX, ESI )
...@@ -374,7 +374,7 @@ ALIGNTEXT16 ...@@ -374,7 +374,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points4_2d ) GLOBL GLNAME( _mesa_3dnow_transform_points4_2d )
HIDDEN(_mesa_3dnow_transform_points4_2d) HIDDEN(_mesa_3dnow_transform_points4_2d)
GLNAME( _mesa_3dnow_transform_points4_2d ): GLNAME( _mesa_3dnow_transform_points4_2d ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -449,7 +449,7 @@ ALIGNTEXT16 ...@@ -449,7 +449,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points4_2d_no_rot ) GLOBL GLNAME( _mesa_3dnow_transform_points4_2d_no_rot )
HIDDEN(_mesa_3dnow_transform_points4_2d_no_rot) HIDDEN(_mesa_3dnow_transform_points4_2d_no_rot)
GLNAME( _mesa_3dnow_transform_points4_2d_no_rot ): GLNAME( _mesa_3dnow_transform_points4_2d_no_rot ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
...@@ -517,7 +517,7 @@ ALIGNTEXT16 ...@@ -517,7 +517,7 @@ ALIGNTEXT16
GLOBL GLNAME( _mesa_3dnow_transform_points4_identity ) GLOBL GLNAME( _mesa_3dnow_transform_points4_identity )
HIDDEN(_mesa_3dnow_transform_points4_identity) HIDDEN(_mesa_3dnow_transform_points4_identity)
GLNAME( _mesa_3dnow_transform_points4_identity ): GLNAME( _mesa_3dnow_transform_points4_identity ):
_CET_ENDBR
PUSH_L ( ESI ) PUSH_L ( ESI )
MOV_L ( ARG_DEST, ECX ) MOV_L ( ARG_DEST, ECX )
......
...@@ -1736,4 +1736,11 @@ ...@@ -1736,4 +1736,11 @@
# define HIDDEN(x) # define HIDDEN(x)
#endif #endif
/* Control flow enforcement support */
#ifdef HAVE_CET_H
#include <cet.h>
#else
#define _CET_ENDBR
#endif
#endif /* __ASSYNTAX_H__ */ #endif /* __ASSYNTAX_H__ */
...@@ -48,7 +48,7 @@ ALIGNTEXT4 ...@@ -48,7 +48,7 @@ ALIGNTEXT4
GLOBL GLNAME(_mesa_x86_has_cpuid) GLOBL GLNAME(_mesa_x86_has_cpuid)
HIDDEN(_mesa_x86_has_cpuid) HIDDEN(_mesa_x86_has_cpuid)
GLNAME(_mesa_x86_has_cpuid): GLNAME(_mesa_x86_has_cpuid):
_CET_ENDBR
/* Test for the CPUID command. If the ID Flag bit in EFLAGS /* Test for the CPUID command. If the ID Flag bit in EFLAGS
* (bit 21) is writable, the CPUID command is present */ * (bit 21) is writable, the CPUID command is present */
PUSHF_L PUSHF_L
...@@ -72,7 +72,7 @@ ALIGNTEXT4 ...@@ -72,7 +72,7 @@ ALIGNTEXT4
GLOBL GLNAME(_mesa_x86_cpuid) GLOBL GLNAME(_mesa_x86_cpuid)
HIDDEN(_mesa_x86_cpuid) HIDDEN(_mesa_x86_cpuid)
GLNAME(_mesa_x86_cpuid): GLNAME(_mesa_x86_cpuid):
_CET_ENDBR
MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */
PUSH_L (EDI) PUSH_L (EDI)
PUSH_L (EBX) PUSH_L (EBX)
...@@ -96,7 +96,7 @@ ALIGNTEXT4 ...@@ -96,7 +96,7 @@ ALIGNTEXT4
GLOBL GLNAME(_mesa_x86_cpuid_eax) GLOBL GLNAME(_mesa_x86_cpuid_eax)
HIDDEN(_mesa_x86_cpuid_eax) HIDDEN(_mesa_x86_cpuid_eax)
GLNAME(_mesa_x86_cpuid_eax): GLNAME(_mesa_x86_cpuid_eax):
_CET_ENDBR
MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */
PUSH_L (EBX) PUSH_L (EBX)
...@@ -109,7 +109,7 @@ ALIGNTEXT4 ...@@ -109,7 +109,7 @@ ALIGNTEXT4
GLOBL GLNAME(_mesa_x86_cpuid_ebx) GLOBL GLNAME(_mesa_x86_cpuid_ebx)
HIDDEN(_mesa_x86_cpuid_ebx) HIDDEN(_mesa_x86_cpuid_ebx)
GLNAME(_mesa_x86_cpuid_ebx): GLNAME(_mesa_x86_cpuid_ebx):
_CET_ENDBR
MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */
PUSH_L (EBX) PUSH_L (EBX)
...@@ -123,7 +123,7 @@ ALIGNTEXT4 ...@@ -123,7 +123,7 @@ ALIGNTEXT4
GLOBL GLNAME(_mesa_x86_cpuid_ecx) GLOBL GLNAME(_mesa_x86_cpuid_ecx)
HIDDEN(_mesa_x86_cpuid_ecx) HIDDEN(_mesa_x86_cpuid_ecx)
GLNAME(_mesa_x86_cpuid_ecx): GLNAME(_mesa_x86_cpuid_ecx):
_CET_ENDBR
MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */
PUSH_L (EBX) PUSH_L (EBX)
...@@ -137,7 +137,7 @@ ALIGNTEXT4 ...@@ -137,7 +137,7 @@ ALIGNTEXT4
GLOBL GLNAME(_mesa_x86_cpuid_edx) GLOBL GLNAME(_mesa_x86_cpuid_edx)
HIDDEN(_mesa_x86_cpuid_edx) HIDDEN(_mesa_x86_cpuid_edx)
GLNAME(_mesa_x86_cpuid_edx): GLNAME(_mesa_x86_cpuid_edx):
_CET_ENDBR
MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */
PUSH_L (EBX) PUSH_L (EBX)
...@@ -163,7 +163,7 @@ ALIGNTEXT4 ...@@ -163,7 +163,7 @@ ALIGNTEXT4
GLOBL GLNAME( _mesa_test_os_sse_support ) GLOBL GLNAME( _mesa_test_os_sse_support )
HIDDEN(_mesa_test_os_sse_support) HIDDEN(_mesa_test_os_sse_support)
GLNAME( _mesa_test_os_sse_support ): GLNAME( _mesa_test_os_sse_support ):
_CET_ENDBR
XORPS ( XMM0, XMM0 ) XORPS ( XMM0, XMM0 )
RET RET
...@@ -178,7 +178,7 @@ ALIGNTEXT4 ...@@ -178,7 +178,7 @@ ALIGNTEXT4
GLOBL GLNAME( _mesa_test_os_sse_exception_support ) GLOBL GLNAME( _mesa_test_os_sse_exception_support )
HIDDEN(_mesa_test_os_sse_exception_support) HIDDEN(_mesa_test_os_sse_exception_support)
GLNAME( _mesa_test_os_sse_exception_support ): GLNAME( _mesa_test_os_sse_exception_support ):
_CET_ENDBR
PUSH_L ( EBP ) PUSH_L ( EBP )
MOV_L ( ESP, EBP ) MOV_L ( ESP, EBP )
SUB_L ( CONST( 8 ), ESP ) SUB_L ( CONST( 8 ), ESP )
......
...@@ -15,7 +15,7 @@ ALIGNTEXT16 ...@@ -15,7 +15,7 @@ ALIGNTEXT16
GLOBL GLNAME( TAG(_mesa_mmx_blend) ) GLOBL GLNAME( TAG(_mesa_mmx_blend) )
HIDDEN( TAG(_mesa_mmx_blend) ) HIDDEN( TAG(_mesa_mmx_blend) )
GLNAME( TAG(_mesa_mmx_blend) ): GLNAME( TAG(_mesa_mmx_blend) ):
_CET_ENDBR
PUSH_L ( EBP ) PUSH_L ( EBP )
MOV_L ( ESP, EBP ) MOV_L ( ESP, EBP )
PUSH_L ( ESI ) PUSH_L ( ESI )
......
...@@ -29,6 +29,12 @@ ...@@ -29,6 +29,12 @@
* *
* \author Ian Romanick <idr@us.ibm.com> * \author Ian Romanick <idr@us.ibm.com>
*/ */
/* Control flow enforcement support */
#ifdef HAVE_CET_H
#include <cet.h>
#else
#define _CET_ENDBR
#endif
.file "read_rgba_span_x86.S" .file "read_rgba_span_x86.S"
#if !defined(__MINGW32__) && !defined(__APPLE__) /* this one cries for assyntax.h */ #if !defined(__MINGW32__) && !defined(__APPLE__) /* this one cries for assyntax.h */
...@@ -80,6 +86,7 @@ ...@@ -80,6 +86,7 @@
.hidden _generic_read_RGBA_span_BGRA8888_REV_MMX .hidden _generic_read_RGBA_span_BGRA8888_REV_MMX
.type _generic_read_RGBA_span_BGRA8888_REV_MMX, @function .type _generic_read_RGBA_span_BGRA8888_REV_MMX, @function
_generic_read_RGBA_span_BGRA8888_REV_MMX: _generic_read_RGBA_span_BGRA8888_REV_MMX:
_CET_ENDBR
pushl %ebx pushl %ebx
#ifdef USE_INNER_EMMS #ifdef USE_INNER_EMMS
...@@ -175,6 +182,7 @@ _generic_read_RGBA_span_BGRA8888_REV_MMX: ...@@ -175,6 +182,7 @@ _generic_read_RGBA_span_BGRA8888_REV_MMX:
.hidden _generic_read_RGBA_span_BGRA8888_REV_SSE .hidden _generic_read_RGBA_span_BGRA8888_REV_SSE
.type _generic_read_RGBA_span_BGRA8888_REV_SSE, @function .type _generic_read_RGBA_span_BGRA8888_REV_SSE, @function
_generic_read_RGBA_span_BGRA8888_REV_SSE: _generic_read_RGBA_span_BGRA8888_REV_SSE:
_CET_ENDBR
pushl %esi pushl %esi
pushl %ebx pushl %ebx
pushl %ebp pushl %ebp
...@@ -338,6 +346,7 @@ _generic_read_RGBA_span_BGRA8888_REV_SSE: ...@@ -338,6 +346,7 @@ _generic_read_RGBA_span_BGRA8888_REV_SSE:
.hidden _generic_read_RGBA_span_BGRA8888_REV_SSE2 .hidden _generic_read_RGBA_span_BGRA8888_REV_SSE2
.type _generic_read_RGBA_span_BGRA8888_REV_SSE2, @function .type _generic_read_RGBA_span_BGRA8888_REV_SSE2, @function
_generic_read_RGBA_span_BGRA8888_REV_SSE2: _generic_read_RGBA_span_BGRA8888_REV_SSE2:
_CET_ENDBR
pushl %esi pushl %esi
pushl %ebx pushl %ebx
...@@ -498,7 +507,7 @@ _generic_read_RGBA_span_BGRA8888_REV_SSE2: ...@@ -498,7 +507,7 @@ _generic_read_RGBA_span_BGRA8888_REV_SSE2:
.type _generic_read_RGBA_span_RGB565_MMX, @function .type _generic_read_RGBA_span_RGB565_MMX, @function
_generic_read_RGBA_span_RGB565_MMX: _generic_read_RGBA_span_RGB565_MMX:
_CET_ENDBR
#ifdef USE_INNER_EMMS #ifdef USE_INNER_EMMS
emms emms
#endif #endif
......
...@@ -48,7 +48,7 @@ ALIGNTEXT16 ...@@ -48,7 +48,7 @@ ALIGNTEXT16
GLOBL GLNAME(_mesa_sse_transform_rescale_normals_no_rot) GLOBL GLNAME(_mesa_sse_transform_rescale_normals_no_rot)
HIDDEN(_mesa_sse_transform_rescale_normals_no_rot) HIDDEN(_mesa_sse_transform_rescale_normals_no_rot)
GLNAME(_mesa_sse_transform_rescale_normals_no_rot): GLNAME(_mesa_sse_transform_rescale_normals_no_rot):
_CET_ENDBR
#define FRAME_OFFSET 8 #define FRAME_OFFSET 8
PUSH_L ( ESI ) PUSH_L ( ESI )
PUSH_L ( EDI ) PUSH_L ( EDI )
...@@ -110,7 +110,7 @@ ALIGNTEXT16 ...@@ -110,7 +110,7 @@ ALIGNTEXT16
GLOBL GLNAME(_mesa_sse_transform_rescale_normals) GLOBL GLNAME(_mesa_sse_transform_rescale_normals)
HIDDEN(_mesa_sse_transform_rescale_normals) HIDDEN(_mesa_sse_transform_rescale_normals)
GLNAME(_mesa_sse_transform_rescale_normals): GLNAME(_mesa_sse_transform_rescale_normals):
_CET_ENDBR
#define FRAME_OFFSET 8 #define FRAME_OFFSET 8
PUSH_L ( ESI ) PUSH_L ( ESI )
PUSH_L ( EDI ) PUSH_L ( EDI )
...@@ -203,7 +203,7 @@ ALIGNTEXT16 ...@@ -203,7 +203,7 @@ ALIGNTEXT16
GLOBL GLNAME(_mesa_sse_transform_normals_no_rot) GLOBL GLNAME(_mesa_sse_transform_normals_no_rot)
HIDDEN(_mesa_sse_transform_normals_no_rot) HIDDEN(_mesa_sse_transform_normals_no_rot)
GLNAME(_mesa_sse_transform_normals_no_rot): GLNAME(_mesa_sse_transform_normals_no_rot):
_CET_ENDBR
#define FRAME_OFFSET 8 #define FRAME_OFFSET 8
PUSH_L ( ESI ) PUSH_L ( ESI )
PUSH_L ( EDI ) PUSH_L ( EDI )
......
...@@ -47,7 +47,7 @@ ALIGNTEXT4 ...@@ -47,7 +47,7 @@ ALIGNTEXT4
GLOBL GLNAME(_mesa_sse_transform_points1_general) GLOBL GLNAME(_mesa_sse_transform_points1_general)
HIDDEN( _mesa_sse_transform_points1_general ) HIDDEN( _mesa_sse_transform_points1_general )
GLNAME( _mesa_sse_transform_points1_general ): GLNAME( _mesa_sse_transform_points1_general ):
_CET_ENDBR
#define FRAME_OFFSET 8 #define FRAME_OFFSET 8
PUSH_L ( ESI ) PUSH_L ( ESI )
PUSH_L ( EDI ) PUSH_L ( EDI )
...@@ -104,7 +104,7 @@ ALIGNTEXT4 ...@@ -104,7 +104,7 @@ ALIGNTEXT4
GLOBL GLNAME(_mesa_sse_transform_points1_identity) GLOBL GLNAME(_mesa_sse_transform_points1_identity)
HIDDEN(_mesa_sse_transform_points1_identity) HIDDEN(_mesa_sse_transform_points1_identity)
GLNAME( _mesa_sse_transform_points1_identity ): GLNAME( _mesa_sse_transform_points1_identity ):
_CET_ENDBR
#define FRAME_OFFSET 8 #define FRAME_OFFSET 8
PUSH_L ( ESI ) PUSH_L ( ESI )
PUSH_L ( EDI ) PUSH_L ( EDI )
...@@ -156,7 +156,7 @@ ALIGNTEXT4 ...@@ -156,7 +156,7 @@ ALIGNTEXT4
GLOBL GLNAME(_mesa_sse_transform_points1_3d_no_rot) GLOBL GLNAME(_mesa_sse_transform_points1_3d_no_rot)
HIDDEN(_mesa_sse_transform_points1_3d_no_rot) HIDDEN(_mesa_sse_transform_points1_3d_no_rot)
GLNAME(_mesa_sse_transform_points1_3d_no_rot): GLNAME(_mesa_sse_transform_points1_3d_no_rot):
_CET_ENDBR
#define FRAME_OFFSET 8 #define FRAME_OFFSET 8
PUSH_L( ESI ) PUSH_L( ESI )
PUSH_L( EDI ) PUSH_L( EDI )
...@@ -217,7 +217,7 @@ ALIGNTEXT4 ...@@ -217,7 +217,7 @@ ALIGNTEXT4
GLOBL GLNAME(_mesa_sse_transform_points1_perspective) GLOBL GLNAME(_mesa_sse_transform_points1_perspective)