[pkg-wine-party] Bug#733605: [PATCH] Add support for GNU/Hurd
Svante Signell
svante.signell at gmail.com
Fri Jan 3 11:32:49 UTC 2014
Hi,
Currently wine-1.6.1 FTBFS on Debian GNU/Hurd, see
https://buildd.debian.org/status/fetch.php?pkg=wine&arch=hurd-i386&ver=1.6.1-11&stamp=1388629359
Attached is a patch enabling the build:
- dlls/ntdll/directory.c: Define a character array on the heap of size
4096 instead of using PATH_MAX, which is not defined for GNU/Hurd. This
approach was used in dlls/ntdll/file.c:server_get_unix_name() where an
array of size 1024 was defined. In case this solution is not OK, a fixed
size array on the stack could be used, or as a last resort adding
#ifndef PATH_MAX; #define PATH_MAX 4096 to that file (not recommended,
at least from a GNU/Hurd aspect).
- 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 so far (slow to start) include cmd, hostname, clock,
winemine, wineconsole, notepad, wordpad and explorer.
This patch is sent upstream on recommendation by the Debian Wine
maintainers, see
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=733605
Thanks!
-------------- next part --------------
---
dlls/ntdll/directory.c | 9 ++++++--
dlls/ntdll/signal_i386.c | 30 +++++++++++++++++++++++++++++
libs/wine/ldt.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 85 insertions(+), 2 deletions(-)
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -3207,14 +3207,18 @@
static NTSTATUS read_changes_apc( void *user, PIO_STATUS_BLOCK iosb, NTSTATUS status, void **apc )
{
struct read_changes_info *info = user;
- char data[PATH_MAX];
+ char *data;
+ data_size_t data_size = 4096;
NTSTATUS ret;
int size;
SERVER_START_REQ( read_change )
{
req->handle = wine_server_obj_handle( info->FileHandle );
- wine_server_set_reply( req, data, PATH_MAX );
+ data = RtlAllocateHeap( GetProcessHeap(), 0, data_size + 1 );
+ if (!data) return STATUS_NO_MEMORY;
+
+ wine_server_set_reply( req, data, data_size );
ret = wine_server_call( req );
size = wine_server_reply_size( reply );
}
@@ -3271,6 +3275,7 @@
size = 0;
}
+ RtlFreeHeap( GetProcessHeap(), 0, data );
iosb->u.Status = ret;
iosb->Information = size;
*apc = read_changes_user_apc;
--- 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,49 @@
#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;
+ 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;
More information about the pkg-wine-party
mailing list