- add support for s390/s390x

This commit is contained in:
Dan Horák 2009-06-03 13:49:57 +00:00
parent 248b8962c7
commit b1d23f2e1a
2 changed files with 119 additions and 1 deletions

113
libEMF-s390.patch Normal file
View File

@ -0,0 +1,113 @@
--- 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 */

View File

@ -2,7 +2,7 @@ Summary: A library for generating Enhanced Metafiles
Summary(pl): Biblioteka do generowania plików w formacie Enhanced Metafile
Name: libEMF
Version: 1.0.3
Release: 8%{?dist}
Release: 9%{?dist}
License: LGPLv2+ and GPLv2+
Group: System Environment/Libraries
Source0: http://dl.sourceforge.net/pstoedit/%{name}-%{version}.tar.gz
@ -10,6 +10,7 @@ Source0: http://dl.sourceforge.net/pstoedit/%{name}-%{version}.tar.gz
Patch0: %{name}-amd64.patch
Patch1: %{name}-axp.patch
Patch2: %{name}-gcc43.patch
Patch3: %{name}-s390.patch
URL: http://libemf.sourceforge.net/
BuildRequires: libstdc++-devel
BuildRequires: libtool
@ -47,6 +48,7 @@ Pliki nagłówkowe libEMF.
%patch0 -p1 -b .amd64
%patch1 -p1 -b .axp
%patch2 -p1 -b .gcc43
%patch3 -p1 -b .s390
chmod 0644 libemf/libemf.h
%build
@ -92,6 +94,9 @@ rm -rf $RPM_BUILD_ROOT
%{_includedir}/libEMF
%changelog
* Wed Jun 3 2009 Dan Horak <dan[at]danny.cz> - 1.0.3-9
- add support for s390/s390x
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.3-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild