libEMF/libEMF-s390.patch
2009-06-03 13:49:57 +00:00

114 lines
3.0 KiB
Diff

--- libEMF-1.0.3/include/libEMF/wine/winnt.h.s390 2009-06-03 15:25:09.000000000 +0200
+++ libEMF-1.0.3/include/libEMF/wine/winnt.h 2009-06-03 15:36:56.000000000 +0200
@@ -45,6 +45,10 @@
# define WORDS_BIGENDIAN
# define BITFIELDS_BIGENDIAN
# undef ALLOW_UNALIGNED_ACCESS
+#elif defined(__s390__)
+# define WORDS_BIGENDIAN
+# define BITFIELDS_BIGENDIAN
+# undef ALLOW_UNALIGNED_ACCESS
#elif !defined(RC_INVOKED)
# error Unknown CPU architecture!
#endif
@@ -1065,6 +1069,65 @@ typedef struct _CONTEXT
#endif /* __sparc__ */
+#ifdef __s390__
+
+/*
+ * FIXME:
+ *
+ * There is no official CONTEXT structure defined for the S390
+ * architecture, so I just made one up.
+ *
+ * Note that this structure contains only the 'top-level' registers;
+ * the rest of the register window chain is not visible.
+ *
+ * The layout is based on the sparc one.
+ *
+ */
+
+#define CONTEXT_S390C 0x20000000
+
+#define CONTEXT_CONTROL (CONTEXT_S390 | 0x00000001)
+#define CONTEXT_FLOATING_POINT (CONTEXT_S390 | 0x00000002)
+#define CONTEXT_INTEGER (CONTEXT_S390 | 0x00000004)
+
+#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
+
+typedef struct _CONTEXT
+{
+ DWORD ContextFlags;
+
+ /* These are selected by CONTEXT_INTEGER */
+ DWORD r0;
+ DWORD r1;
+ DWORD r2;
+ DWORD r3;
+ DWORD r4;
+ DWORD r5;
+ DWORD r6;
+ DWORD r7;
+ DWORD r8;
+ DWORD r9;
+ DWORD r10;
+ DWORD r11;
+ DWORD r12;
+ DWORD r13;
+ DWORD r14;
+ DWORD r15;
+
+ /* FIXME: this section is fictional (copied from sparc) */
+ DWORD psr;
+ DWORD pc;
+ DWORD npc;
+ DWORD y;
+ DWORD wim;
+ DWORD tbr;
+
+ /* FIXME: floating point registers missing */
+
+} CONTEXT;
+
+#endif /* __s390__ */
+
#if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
#error You need to define a CONTEXT for your CPU
#endif
@@ -1183,6 +1246,33 @@ typedef CONTEXT *PCONTEXT;
#endif /* __sparc__ */
+#ifdef __s390__
+/* FIXME: use getcontext() to retrieve full context */
+#define _GET_CONTEXT \
+ CONTEXT context; \
+ do { memset(&context, 0, sizeof(CONTEXT)); \
+ context.ContextFlags = CONTEXT_CONTROL; \
+ context.pc = (DWORD)__builtin_return_address(0); \
+ } while (0)
+
+#define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
+ void WINAPI name ( void ) \
+ { _GET_CONTEXT; fn( &context ); }
+#define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
+ void WINAPI name ( t1 a1 ) \
+ { _GET_CONTEXT; fn( a1, &context ); }
+#define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
+ void WINAPI name ( t1 a1, t2 a2 ) \
+ { _GET_CONTEXT; fn( a1, a2, &context ); }
+#define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
+ void WINAPI name ( t1 a1, t2 a2, t3 a3 ) \
+ { _GET_CONTEXT; fn( a1, a2, a3, &context ); }
+#define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
+ void WINAPI name ( t1 a1, t2 a2, t3 a3, t4 a4 ) \
+ { _GET_CONTEXT; fn( a1, a2, a3, a4, &context ); }
+
+#endif /* __s390__ */
+
#ifdef __PPC__
/* FIXME: use getcontext() to retrieve full context */