Manually align registers array to a 16-byte boundary

This commit is contained in:
Sam Demeulemeester 2025-02-17 15:55:29 +01:00
parent 2c42ed3293
commit 1748d29f40
2 changed files with 7 additions and 4 deletions

View File

@ -86,7 +86,7 @@ static const char codes[][13] = {
#ifdef __x86_64__
typedef uint64_t reg_t;
typedef float __m128 __attribute__ ((__vector_size__ (16)));
typedef float __m128 __attribute__((__vector_size__ (16), __aligned__ (16)));
struct trap_regs {
reg_t ds;
@ -102,7 +102,8 @@ struct trap_regs {
reg_t r9;
reg_t r10;
reg_t r11;
reg_t xmm[16*2];
reg_t r12;
__m128 xmm[16];
reg_t bp;
reg_t vect;
reg_t code;

View File

@ -273,11 +273,11 @@ flush: movw $KERNEL_DS, %ax
testl $0x18000000, %ecx # Check bits 27 (OSXSAVE) and 28 (AVX)
jz no_avx
movq %cr4, %rax
orq $(1 << 18), %rax # Set bit 18 (OSXSAVE)
orl $(1 << 18), %eax # Set bit 18 (OSXSAVE)
movq %rax, %cr4
xorq %rcx, %rcx
xgetbv
orq $0x7, %rax # Enable x87 (bit 0), XMM (bit 1) and YMM (bit 2)
orb $0x07, %al # Enable x87 (bit 0), XMM (bit 1) and YMM (bit 2)
xsetbv
no_avx:
@ -445,6 +445,7 @@ int_handler:
movdqa %xmm14, 0xE0(%rsp)
movdqa %xmm15, 0xF0(%rsp)
pushq %r12
pushq %r11
pushq %r10
pushq %r9
@ -476,6 +477,7 @@ int_handler:
popq %r9
popq %r10
popq %r11
popq %r12
movdqa 0xF0(%rsp), %xmm15
movdqa 0xE0(%rsp), %xmm14