Module Name: xsrc
Committed By: mrg
Date: Sat Dec 20 02:05:35 UTC 2014
Modified Files:
xsrc/external/mit/MesaLib/dist/src/mesa/main: dlist.c
Log Message:
fix my prior hack here to only apply on platforms that need it.
namely, any current netbsd 64 bit platform besides x86. (i meant
to do this before merging.)
the problem here is the "Node" type is only 4 bytes, an allocation
is assigned to a "Node *node", and then "node + 1" is returned.
this returns a 4-byte aligned pointer, and some callers expect to
be able to store 64-bit (pointer, at least) values there and demand
that the structure be properly aligned. this change forces Node to
be 8-byte aligned on all-but-x86 64 bit netbsd platforms.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/MesaLib/dist/src/mesa/main/dlist.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/external/mit/MesaLib/dist/src/mesa/main/dlist.c
diff -u xsrc/external/mit/MesaLib/dist/src/mesa/main/dlist.c:1.2 xsrc/external/mit/MesaLib/dist/src/mesa/main/dlist.c:1.3
--- xsrc/external/mit/MesaLib/dist/src/mesa/main/dlist.c:1.2 Thu Dec 18 06:20:51 2014
+++ xsrc/external/mit/MesaLib/dist/src/mesa/main/dlist.c Sat Dec 20 02:05:35 2014
@@ -505,6 +505,16 @@ typedef enum
* sake of compact display lists. We store 8-byte pointers in a pair of
* these nodes using the save/get_pointer() functions below.
*/
+#if defined(__NetBSD__) && defined(_LP64) && !defined(__x86_64__)
+/*
+ * This pointer typ is returned with "node + 1", which ends up at an
+ * illegal offset for 64 bit values, such as pointers, which may be
+ * stored in the returned space. As such, we have to force this
+ * structure to be 64-bit type aligned. x86-64 is the only known
+ * platform that allows this.
+ */
+#define STRICT_DLIST_ALIGNMENT
+#endif
union gl_dlist_node
{
OpCode opcode;
@@ -518,7 +528,7 @@ union gl_dlist_node
GLenum e;
GLfloat f;
GLsizei si;
-#ifdef __NetBSD__
+#ifdef STRICT_DLIST_ALIGNMENT
unsigned long long _dummy;
#endif
};
@@ -551,8 +561,12 @@ save_pointer(union gl_dlist_node *dest,
unsigned i;
STATIC_ASSERT(POINTER_DWORDS == 1 || POINTER_DWORDS == 2);
+#ifdef STRICT_DLIST_ALIGNMENT
STATIC_ASSERT(sizeof(union gl_dlist_node) == 4 ||
sizeof(union gl_dlist_node) == 8);
+#else
+ STATIC_ASSERT(sizeof(union gl_dlist_node) == 4);
+#endif
p.ptr = src;