aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/x86
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-07-19 08:30:15 +0200
committermarha <marha@users.sourceforge.net>2013-07-19 08:30:15 +0200
commit89bc3ee988b62eb5e10284bac32a176955546410 (patch)
tree186769abb7a48a7b04463706dee116795e07485f /mesalib/src/mesa/x86
parentf5e157731e6b51421ac89cfefb666b8bbf971b03 (diff)
downloadvcxsrv-89bc3ee988b62eb5e10284bac32a176955546410.tar.gz
vcxsrv-89bc3ee988b62eb5e10284bac32a176955546410.tar.bz2
vcxsrv-89bc3ee988b62eb5e10284bac32a176955546410.zip
mesa xkbcomp git update 19 Jul 2013
xkbcomp commit 0ebdf47fd4bc434ac3d2339544c022a869510738 esa commit 9f07ca11c1797ac12de1e1c6aef13cf58824b5f5
Diffstat (limited to 'mesalib/src/mesa/x86')
-rw-r--r--mesalib/src/mesa/x86/Makefile.am10
-rw-r--r--mesalib/src/mesa/x86/gen_matypes.c35
2 files changed, 39 insertions, 6 deletions
diff --git a/mesalib/src/mesa/x86/Makefile.am b/mesalib/src/mesa/x86/Makefile.am
index 21ce3607a..167857684 100644
--- a/mesalib/src/mesa/x86/Makefile.am
+++ b/mesalib/src/mesa/x86/Makefile.am
@@ -33,7 +33,17 @@ gen_matypes_SOURCES = gen_matypes.c
BUILT_SOURCES = matypes.h
CLEANFILES = matypes.h
+if GEN_ASM_OFFSETS
+
+matypes.h: $(gen_matypes_SOURCES)
+ $(AM_V_GEN)$(COMPILE) $< -DASM_OFFSETS -S -o - | \
+ sed -n '/^->/{s:^->::;/[$$]/{s:^:#define :;s:[$$]::};p}' > $@
+
+else
+
matypes.h: gen_matypes
$(AM_V_GEN)./gen_matypes > $@
endif
+
+endif
diff --git a/mesalib/src/mesa/x86/gen_matypes.c b/mesalib/src/mesa/x86/gen_matypes.c
index 80ee61aa8..1e904aa0b 100644
--- a/mesalib/src/mesa/x86/gen_matypes.c
+++ b/mesalib/src/mesa/x86/gen_matypes.c
@@ -52,7 +52,7 @@ do { \
printf( "\n" ); \
printf( "/* =====================================================" \
"========\n" ); \
- printf( " * Offsets for %s\n", x ); \
+ printf( " * Offsets for " x "\n" ); \
printf( " */\n" ); \
printf( "\n" ); \
} while (0)
@@ -61,20 +61,43 @@ do { \
do { \
printf( "\n" ); \
printf( "/*\n" ); \
- printf( " * Flags for %s\n", x ); \
+ printf( " * Flags for " x "\n" ); \
printf( " */\n" ); \
printf( "\n" ); \
} while (0)
-#define OFFSET( s, t, m ) \
- printf( "#define %s\t%lu\n", s, (unsigned long) offsetof( t, m ) );
+#ifdef ASM_OFFSETS
-#define SIZEOF( s, t ) \
- printf( "#define %s\t%lu\n", s, (unsigned long) sizeof(t) );
+/*
+ * Format the asm output in a special way that we can manipulate
+ * after the fact and turn into the final header for the target.
+ */
+
+#define DEFINE_UL( s, ul ) \
+ __asm__ __volatile__ ( "\n->" s " %0" : : "i" (ul) )
+
+#define DEFINE( s, d ) \
+ DEFINE_UL( s, d )
+
+#define printf( x ) \
+ __asm__ __volatile__ ( "\n->" x )
+
+#else
+
+#define DEFINE_UL( s, ul ) \
+ printf( "#define %s\t%lu\n", s, (unsigned long) (ul) );
#define DEFINE( s, d ) \
printf( "#define %s\t0x%" PRIx64 "\n", s, (uint64_t) d );
+#endif
+
+#define OFFSET( s, t, m ) \
+ DEFINE_UL( s, offsetof( t, m ) )
+
+#define SIZEOF( s, t ) \
+ DEFINE_UL( s, sizeof(t) )
+
int main( int argc, char **argv )