Skip to content

Commit fefae72

Browse files
committed
fix alignment of registers structure
1 parent 82cb906 commit fefae72

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/rt/arch/x86_64/context.h

+3-6
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,18 @@ T align_down(T sp)
2121
// The struct in which we store the saved data. This is mostly the
2222
// volatile registers and instruction pointer, but it also includes
2323
// RCX/RDI which are used to pass arguments. The indices for each
24-
// register are found in "regs.h":
24+
// register are found in "regs.h". Note that the alignment must be
25+
// 16 bytes so that SSE instructions can be used.
2526
#include "regs.h"
2627
struct registers_t {
2728
uint64_t data[RUSTRT_MAX];
28-
};
29+
} __attribute__((aligned(16)));
2930

3031
extern "C" void __morestack(void *args, void *fn_ptr, uintptr_t stack_ptr);
3132

3233
class context {
3334
public:
34-
#ifdef __FreeBSD__
35-
registers_t regs __attribute__((aligned(16)));
36-
#else
3735
registers_t regs;
38-
#endif
3936

4037
context();
4138

0 commit comments

Comments
 (0)