Source: wine
Version: 1.6.1-8
Severity: important
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hurd

Hi,

Currently wine-1.6.1 FTBFS on GNU/Hurd, see
https://buildd.debian.org/status/fetch.php?pkg=wine&arch=hurd-i386&ver=1.6.1-8&stamp=1388378306

Attached is a patch enabling the build:

- dlls/mountmgr.sys/diskarb.c and dlls/ntdll/directory.c: Define
PATH_MAX to 4096 since it is not available for GNU/Hurd. A better
solution using dynamic string allocation will be provided in a separate
patch.

- libs/wine/ldt.c: Add LDT support for GNU/Hurd

- dlls/ntdll/signal_i386.c: Add i386 signal handling support for GNU/Hurd

Applications tested (but slow to start) include clock, notepad and wordpad.

Thanks!


--- a/dlls/mountmgr.sys/diskarb.c
+++ b/dlls/mountmgr.sys/diskarb.c
@@ -37,6 +37,9 @@
 
 #ifdef HAVE_DISKARBITRATION_DISKARBITRATION_H
 
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
 static void appeared_callback( DADiskRef disk, void *context )
 {
     CFDictionaryRef dict = DADiskCopyDescription( disk );
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -3204,6 +3204,9 @@
     RtlFreeHeap( GetProcessHeap(), 0, info );
 }
 
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
 static NTSTATUS read_changes_apc( void *user, PIO_STATUS_BLOCK iosb, NTSTATUS status, void **apc )
 {
     struct read_changes_info *info = user;
--- a/libs/wine/ldt.c
+++ b/libs/wine/ldt.c
@@ -80,6 +80,11 @@
 
 #endif  /* linux */
 
+#ifdef __GNU__
+#include <mach/i386/mach_i386.h>
+#include <mach/mach_traps.h>
+#endif  /* GNU */
+
 #if defined(__svr4__) || defined(_SCO_DS)
 #include <sys/sysi86.h>
 #ifndef __sun__
@@ -203,6 +208,52 @@
 #elif defined(__APPLE__)
     if ((ret = i386_set_ldt(index, (union ldt_entry *)entry, 1)) < 0)
         perror("i386_set_ldt");
+#elif defined(__GNU__)
+    {
+      /*
+mach/i386/mach_i386.defs:
+type    descriptor_t    =       struct[2] of int;
+type    descriptor_list_t =     array[*] of descriptor_t;
+
+include/winnt.h:
+typedef struct _LDT_ENTRY {
+    WORD        LimitLow;
+    WORD        BaseLow;
+    union {
+        struct {
+            BYTE    BaseMid;
+            BYTE    Flags1;
+            BYTE    Flags2;
+            BYTE    BaseHi;
+        } Bytes;
+        struct {
+            unsigned    BaseMid: 8;
+            unsigned    Type : 5;
+            unsigned    Dpl : 2;
+            unsigned    Pres : 1;
+            unsigned    LimitHi : 4;
+            unsigned    Sys : 1;
+            unsigned    Reserved_0 : 1;
+            unsigned    Default_Big : 1;
+            unsigned    Granularity : 1;
+            unsigned    BaseHi : 8;
+        } Bits;
+    } HighWord;
+} LDT_ENTRY, *PLDT_ENTRY;
+
+       */
+        LDT_ENTRY entry_copy = *entry;
+	//	thread_t target_thread = 1;
+	// FIXME: Check the conversion */
+	//ret = i386_set_ldt(target_thread, index, (descriptor_list_t)&entry_copy, 1);
+	ret = i386_set_ldt(mach_thread_self(), sel, (descriptor_list_t)&entry_copy, 1);
+        if (ret != KERN_SUCCESS)
+        {
+            perror("i386_set_ldt");
+            fprintf( stderr, "i386_set_ldt failed\n" );
+            exit(1);
+        }
+    }
 #else
     fprintf( stderr, "No LDT support on this platform\n" );
     exit(1);
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -235,6 +235,36 @@
 #define FPU_sig(context)     NULL  /* FIXME */
 #define FPUX_sig(context)    NULL  /* FIXME */
 
+#elif defined (__GNU__)
+
+#include <sys/ucontext.h>
+
+typedef ucontext_t SIGCONTEXT;
+
+#define EAX_sig(context)     ((context)->uc_mcontext.gregs[REG_EAX])
+#define EBX_sig(context)     ((context)->uc_mcontext.gregs[REG_EBX])
+#define ECX_sig(context)     ((context)->uc_mcontext.gregs[REG_ECX])
+#define EDX_sig(context)     ((context)->uc_mcontext.gregs[REG_EDX])
+#define ESI_sig(context)     ((context)->uc_mcontext.gregs[REG_ESI])
+#define EDI_sig(context)     ((context)->uc_mcontext.gregs[REG_EDI])
+#define EBP_sig(context)     ((context)->uc_mcontext.gregs[REG_EBP])
+#define ESP_sig(context)     ((context)->uc_mcontext.gregs[REG_ESP])
+
+#define CS_sig(context)      ((context)->uc_mcontext.gregs[REG_CS])
+#define DS_sig(context)      ((context)->uc_mcontext.gregs[REG_DS])
+#define ES_sig(context)      ((context)->uc_mcontext.gregs[REG_ES])
+#define SS_sig(context)      ((context)->uc_mcontext.gregs[REG_SS])
+#define FS_sig(context)      ((context)->uc_mcontext.gregs[REG_FS])
+#define GS_sig(context)      ((context)->uc_mcontext.gregs[REG_GS])
+
+#define EFL_sig(context)     ((context)->uc_mcontext.gregs[REG_EFL])
+#define EIP_sig(context)     ((context)->uc_mcontext.gregs[REG_EIP])
+#define TRAP_sig(context)    ((context)->uc_mcontext.gregs[REG_TRAPNO])
+#define ERROR_sig(context)   ((context)->uc_mcontext.gregs[REG_ERR])
+
+#define FPU_sig(context)     ((FLOATING_SAVE_AREA*)(&(context)->uc_mcontext.fpregs.fp_reg_set.fpchip_state))
+#define FPUX_sig(context)    NULL
+
 #elif defined (__OpenBSD__)
 
 typedef struct sigcontext SIGCONTEXT;

Reply via email to