summaryrefslogtreecommitdiff
path: root/src/w32term.h
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2014-09-25 12:34:53 +0300
committerEli Zaretskii <eliz@gnu.org>2014-09-25 12:34:53 +0300
commitdb61bdb13915a15896ffb96d1ea3d23e00f4bf54 (patch)
tree9fb3faba58b2ec6b9da881003bc742ea97df634f /src/w32term.h
parent340e4cce7aaa1de72d384e4889f0f8aa65025874 (diff)
downloademacs-db61bdb13915a15896ffb96d1ea3d23e00f4bf54.tar.gz
Default to stack objects on DOS_NT platforms as well.
src/w32term.h (ALIGN_STACK) [__GNUC__]: Define to __attribute__((force_align_arg_pointer)) for GCC 4.2 and later. src/lisp.h (USE_STACK_LISP_OBJECTS): Remove the !DOS_NT condition. src/w32proc.c (enum_locale_fn, enum_codepage_fn): Add the ALIGN_STACK attribute. src/w32fns.c (w32_monitor_enum): Add the ALIGN_STACK attribute. src/w32uniscribe.c (add_opentype_font_name_to_list): Add the ALIGN_STACK attribute. src/w32font.c (add_font_name_to_list, add_font_entity_to_list) (add_one_font_entity_to_list): Add the ALIGN_STACK attribute.
Diffstat (limited to 'src/w32term.h')
-rw-r--r--src/w32term.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/w32term.h b/src/w32term.h
index 0fabe12819c..fcadca6a9af 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -22,6 +22,22 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "frame.h"
#include "atimer.h"
+/* Stack alignment stuff. Every CALLBACK function should have the
+ ALIGN_STACK attribute if it manipulates Lisp objects, because
+ Windows x86 32-bit ABI only guarantees 4-byte stack alignment, and
+ that is what we will get when a Windows function calls us. The
+ ALIGN_STACK attribute forces GCC to emit a preamble code to
+ re-align the stack at function entry. Further details about this
+ can be found in http://www.peterstock.co.uk/games/mingw_sse/. */
+#ifdef __GNUC__
+# if defined USE_STACK_LISP_OBJECTS && defined _W64 \
+ && __GNUC__ + (__GNUC_MINOR__ > 1) >= 5
+# define ALIGN_STACK __attribute__((force_align_arg_pointer))
+# else
+# define ALIGN_STACK
+# endif /* USE_STACK_LISP_OBJECTS */
+#endif
+
#define BLACK_PIX_DEFAULT(f) PALETTERGB(0,0,0)
#define WHITE_PIX_DEFAULT(f) PALETTERGB(255,255,255)