Patch: ifdef out i386 items on Sparc-Solaris

Warren_Baird at cimmetry.com Warren_Baird at cimmetry.com
Thu May 16 11:16:46 CDT 2002



ChangeLog:

    - wrapped a couple of i386 specific items in ifdefs (__set_fs, _control87)
    - fixed a few MSVCRT methods that either didn't have sparc versions
      or had incorrect versions

Warren Baird : Warren_Baird at cimmetry.com


diff -ur clean/wine-20020509/memory/selector.c wine-20020509/memory/selector.c
--- clean/wine-20020509/memory/selector.c     Tue May  7 20:20:40 2002
+++ wine-20020509/memory/selector.c      Wed May 15 17:24:41 2002
@@ -122,7 +122,9 @@
     if (!((__get_fs() ^ sel) & ~7))
     {
         WARN("Freeing %%fs selector (%04x), not good.\n", __get_fs() );
+#ifdef __i386__
         __set_fs( 0 );
+#endif
     }
     if (!((__get_gs() ^ sel) & ~7)) __set_gs( 0 );
 #endif  /* __i386__ */
@@ -144,7 +146,9 @@
     if (fs)
     {
         wine_ldt_copy.flags[fs >> __AHSHIFT] &= ~WINE_LDT_FLAGS_ALLOCATED;
+#ifdef __i386__
         __set_fs(0);
+#endif
         wine_ldt_set_entry( fs, &null_entry );
     }
 }

diff -ur clean/wine-20020509/dlls/msvcrt/math.c wine-20020509/dlls/msvcrt/math.c
--- clean/wine-20020509/dlls/msvcrt/math.c    Mon Apr  1 16:03:53 2002
+++ wine-20020509/dlls/msvcrt/math.c     Thu May 16 11:09:41 2002
@@ -572,7 +572,13 @@
  */
 unsigned int _controlfp(unsigned int newval, unsigned int mask)
 {
+
+    // _EM_DENORMAL is only defined for x86
+#ifdef __i386__
   return _control87( newval, mask & ~_EM_DENORMAL );
+#else
+  return _control87( newval, mask /*& ~_EM_DENORMAL*/ );
+#endif
 }

 /*********************************************************************
@@ -696,10 +702,19 @@
  *       div (MSVCRT.@)
  * VERSION
  *  [!i386] Non-x86 can't run win32 apps so we don't need binary compatibility
+ *
+ * Not sure why this is returning a different type than the x86 version,
+ * but fixed it to do the right thing.
  */
 MSVCRT_div_t MSVCRT_div(int num, int denom)
 {
-  return div(num,denom);
+  div_t dt = div(num,denom);
+  MSVCRT_div_t     ret;
+  ret.quot = dt.quot;
+  ret.rem = dt.rem;
+
+  return ret;
+
 }
 #endif /* ifdef __i386__ */

@@ -722,10 +737,19 @@
  *       ldiv (MSVCRT.@)
  * VERSION
  *  [!i386] Non-x86 can't run win32 apps so we don't need binary compatibility
+ *
+ * Not sure why this is returning a different type than the x86 version,
+ * but fixed it to do the right thing.
  */
 MSVCRT_ldiv_t MSVCRT_ldiv(long num, long denom)
 {
-  return ldiv(num,denom);
+  ldiv_t result = ldiv(num,denom);
+
+  MSVCRT_ldiv_t ret;
+  ret.quot = result.quot;
+  ret.rem = result.rem;
+
+  return ret;
 }
 #endif /* ifdef __i386__ */

diff -ur clean/wine-20020509/dlls/msvcrt/except.c
wine-20020509/dlls/msvcrt/except.c
--- clean/wine-20020509/dlls/msvcrt/except.c  Thu Apr 25 17:40:56 2002
+++ wine-20020509/dlls/msvcrt/except.c   Wed May 15 16:59:34 2002
@@ -82,6 +82,14 @@
   *dispatch = frame;
   return ExceptionCollidedUnwind;
 }
+#else
+static DWORD MSVCRT_nested_handler(PEXCEPTION_RECORD rec,
+                                   struct __EXCEPTION_FRAME* frame,
+                                   PCONTEXT context WINE_UNUSED,
+                                   struct __EXCEPTION_FRAME** dispatch)
+{
+  return ExceptionCollidedUnwind;
+}
 #endif


diff -ur clean/wine-20020509/relay32/snoop.c wine-20020509/relay32/snoop.c
--- clean/wine-20020509/relay32/snoop.c  Thu Apr 25 17:40:56 2002
+++ wine-20020509/relay32/snoop.c  Wed May 15 16:59:34 2002
@@ -410,7 +410,7 @@
                    ".long " __ASM_NAME("SNOOP_DoReturn") ",0" );

 #else    /* !__i386__ */
-void SNOOP_RegisterDLL(HMODULE hmod,LPCSTR name,DWORD nrofordinals) {
+void SNOOP_RegisterDLL(HMODULE hmod,LPCSTR name,DWORD nrofordinals, DWORD dw) {
     if (!TRACE_ON(snoop)) return;
     FIXME("snooping works only on i386 for now.\n");
 }





More information about the wine-patches mailing list