help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Makefiles for 64 bit Windows - 16 byte alignment


From: glpk xypron
Subject: Re: [Help-glpk] Makefiles for 64 bit Windows - 16 byte alignment
Date: Fri, 29 Aug 2008 04:44:11 +0200

Hello Andrew,

in the Microsoft SDK for Windows 2003 setjmp.h contains the following lines:

/*
 * AMD64 setjmp definitions.
 */

typedef struct __declspec(align(16)) _SETJMP_FLOAT128 {
    unsigned __int64 Part[2];
} SETJMP_FLOAT128;
typedef SETJMP_FLOAT128 _JBTYPE;
typedef _JBTYPE jmp_buf[_JBLEN];

glpmpl.h uses structure jmp_buf in the definition of struct MPL.

glpmpl4.c contains the following line:
      mpl = xmalloc(sizeof(MPL));

The implementation of xmalloc is in glplib07.c. Xmalloc prepends 
align_datasize(sizeof(LIBMEM)) bytes to the structure MPL.

If align_boundary != 16 the alignment of jmp_buf is destroyed.

http://www.usenix.org/events/sec03/tech/full_papers/broadwell/broadwell_html/node16.html
teaches
A longjmpcall takes a previously populated jmp_buf as an argument and restores 
the registers saved in this structure. Since restoring the jmp_buf replaces the 
stack pointer and program counter, the stack is unwound and the program returns 
to the site of the setjmp call, ...

For AMD64 the stack must be 16 byte aligned. I guess if jmp_buf is not 16 byte 
aligned this will cause the observed alignment error.

cf. the note by Peter Ingerfeld
http://www.nabble.com/Building-GLPK-under-VS2005-for-x64-to16345612.html#a16345612

Besides the AMD64 ABI also the 64-bit PowerPC ABI requires 16 byte stack 
alignment:
http://www.ibm.com/developerworks/power/library/l-powasm4.html

Same with Intel Itanium:
http://msdn.microsoft.com/en-us/library/aa290049.aspx

Best regards

Xypron

-- 
GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!
http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196




reply via email to

[Prev in Thread] Current Thread [Next in Thread]