1 --- md.h	2009-10-01 20:46:43.000000000 +0200
2 +++ md.h	2014-12-16 22:52:34.000000000 +0100
3 @@ -161,6 +161,19 @@
4  #define MD_JB_SP  34
5  #elif defined(__amd64__)
6  #define MD_JB_SP   2
7 +/*
8 + * The following comment is taken from src/lib/libc/amd64/gen/makecontext.c
9 + * It explains why we specifically break the alignment to 64 byte boundary
10 + * that is unconditionally enforced by sched.c, by setting MD_STACK_PAD_SIZE
11 + * to this funky value.
12 + * Without this, anything using va_start() & friends fails unpredictably.
13 + */
14 +        /*
15 +         * Account for arguments on stack and do the funky C entry alignment.
16 +         * This means that we need an 8-byte-odd alignment since the ABI expects
17 +         * the return address to be pushed, thus breaking the 16 byte alignment.
18 +         */
19 +#define MD_STACK_PAD_SIZE 8
20  #else
21  #error Unknown CPU architecture
22  #endif
23