Compare commits

...

2 Commits

Author SHA1 Message Date
Kim Woelders 0f378ef87f Add endbr32/64 instruction at the start of asm functions
Only do so when compiling with -fcf-protection (=> __CET__ is defined).

Inspired by:
004ff08738

Comment:
  Fixes SIGILL in tests on 11th gen intel (IBT)

#23
2024-04-13 15:36:12 +02:00
Kim Woelders e9a89df496 Some cleanups in asm code
Drop DO_MMX_ASM and DO_AMD64_ASM compile guards, handled by make.
Whitespace cleanups.
2024-04-13 09:59:07 +02:00
8 changed files with 2199 additions and 2225 deletions

View File

@ -1,8 +1,6 @@
#include <config.h>
#include "asm.h"
#ifdef DO_AMD64_ASM
/*\
|*| AMD64 SSE2 assembly blending routines for Imlib2
|*| Written by John Slaten <zartheenumerator@comcast.net>
@ -98,10 +96,8 @@ FN_(imlib_amd64_reshade_copy_rgb_to_rgba)
\*/
#define ENTER \
ENDBR_ ; \
pushq %rbp ; \
movq %rsp, %rbp ; \
pushq %rbx ; \
@ -5521,8 +5517,6 @@ PR_(imlib_amd64_reshade_copy_rgb_to_rgba):
LEAVE
SIZE(imlib_amd64_reshade_copy_rgb_to_rgba)
#endif
#ifdef __ELF__
.section .note.GNU-stack,"",@progbits
#endif

View File

@ -1,8 +1,6 @@
#include <config.h>
#include "asm.h"
#ifdef DO_AMD64_ASM
/*\
|*| AMD64 SSE2 assembly blending routines for Imlib2
|*| Written by John Slaten <zartheenumerator@comcast.net>
@ -106,14 +104,8 @@ FN_(imlib_amd64_reshade_copy_rgb_to_rgba_cmod)
\*/
#define ENTER \
ENDBR_ ; \
pushq %rbp ; \
movq %rsp, %rbp ; \
pushq %rbx ; \
@ -16778,8 +16770,6 @@ PR_(imlib_amd64_reshade_copy_rgb_to_rgba_cmod):
LEAVE
SIZE(imlib_amd64_reshade_copy_rgb_to_rgba_cmod)
#endif
#ifdef __ELF__
.section .note.GNU-stack,"",@progbits
#endif

View File

@ -17,4 +17,14 @@
.size PR_(sym),.-PR_(sym); \
.align 8;
#ifdef __CET__
#if defined(DO_MMX_ASM)
#define ENDBR_ endbr32
#elif defined(DO_AMD64_ASM)
#define ENDBR_ endbr64
#endif
#else
#define ENDBR_
#endif
#endif /* __ASM_H */

View File

@ -1,8 +1,6 @@
#include <config.h>
#include "asm.h"
#ifdef DO_MMX_ASM
/*\
|*| MMX assembly blending routines for Imlib2
|*| Written by Willem Monsuwe <willem@stack.nl>
@ -63,6 +61,7 @@ FN_(imlib_mmx_reshade_copy_rgb_to_rgba)
/*\ Common code \*/
/*\ Set MMX mode, save registers, load common parameters \*/
#define ENTER \
ENDBR_ ;\
pushl %ebp ;\
movl %esp, %ebp ;\
pushl %ebx ;\
@ -95,7 +94,6 @@ FN_(imlib_mmx_reshade_copy_rgb_to_rgba)
decl %edx ;\
jns 8b
/*\ Unset MMX mode, reset registers, return \*/
#define LEAVE \
9: ;\
@ -1024,8 +1022,6 @@ PR_(imlib_mmx_reshade_copy_rgb_to_rgba):
SIZE(imlib_mmx_reshade_copy_rgb_to_rgba)
#endif
#ifdef __ELF__
.section .note.GNU-stack,"",@progbits
#endif

View File

@ -1,8 +1,6 @@
#include <config.h>
#include "asm.h"
#ifdef DO_MMX_ASM
/*\
|*| MMX assembly blending routines, with colour modding, for Imlib2
|*| Written by Willem Monsuwe <willem@stack.nl>
@ -81,6 +79,7 @@ FN_(imlib_mmx_reshade_copy_rgb_to_rgba_cmod)
/*\ Common code \*/
/*\ Set MMX mode, save registers, load common parameters \*/
#define ENTER \
ENDBR_ ;\
pushl %ebp ;\
movl %esp, %ebp ;\
pushl %ebx ;\
@ -113,7 +112,6 @@ FN_(imlib_mmx_reshade_copy_rgb_to_rgba_cmod)
decl %edx ;\
jns 8b
/*\ Unset MMX mode, reset registers, return \*/
#define LEAVE \
9: ;\
@ -1563,8 +1561,6 @@ PR_(imlib_mmx_reshade_copy_rgb_to_rgba_cmod):
SIZE(imlib_mmx_reshade_copy_rgb_to_rgba_cmod)
#endif
#ifdef __ELF__
.section .note.GNU-stack,"",@progbits
#endif

View File

@ -1,8 +1,6 @@
#include <config.h>
#include "asm.h"
#ifdef DO_MMX_ASM
/*\
|*| MMX assembly rgba rendering routines for Imlib2
|*| Written by Willem Monsuwe <willem@stack.nl>
@ -38,6 +36,7 @@ FN_(imlib_get_cpuid)
/*\ Common code \*/
/*\ Save registers, load common parameters \*/
#define ENTER \
ENDBR_; \
pushl %ebp; \
movl %esp, %ebp; \
pushl %ebx; \
@ -81,7 +80,6 @@ FN_(imlib_get_cpuid)
ret
PR_(imlib_mmx_bgr565_fast):
LOAD_IMMQ(mul_bgr565, %mm7) /*\ This constant is the only difference \*/
CLEANUP_IMMQ_LOADS(1)
@ -273,8 +271,6 @@ PR_(imlib_get_cpuid):
SIZE(imlib_get_cpuid)
#endif
#ifdef __ELF__
.section .note.GNU-stack,"",@progbits
#endif

View File

@ -1,8 +1,6 @@
#include <config.h>
#include "asm.h"
#ifdef DO_MMX_ASM
/*\
|*| MMX assembly rotation routine for Imlib2
|*| Written by Willem Monsuwe <willem@stack.nl>
@ -447,8 +445,6 @@ PR_(imlib_mmx_RotateAA):
SIZE(imlib_mmx_RotateAA)
#endif
#ifdef __ELF__
.section .note.GNU-stack,"",@progbits
#endif

View File

@ -1,8 +1,6 @@
#include <config.h>
#include "asm.h"
#ifdef DO_MMX_ASM
/*\
|*| MMX assembly scaling routine for Imlib2
|*| Written by Willem Monsuwe <willem@stack.nl>
@ -788,8 +786,6 @@ PR_(imlib_Scale_mmx_AARGBA):
SIZE(imlib_Scale_mmx_AARGBA)
#endif
#ifdef __ELF__
.section .note.GNU-stack,"",@progbits
#endif