WineX and FreeBSD
Damian Gerow <[email protected]> Thu, 9 Dec 2004 12:58:39 -0500
| Newsgroups | gmane.comp.emulators.winex.devel |
|---|---|
| Message-ID | <[email protected]> |
So I haven't really accomplished much at this point, but Cedega /does/ compile *and* load up properly on FreeBSD now. In that, you can get the output of 'winex --help', but there's some issues in the threading. To make this a little easier, I've just recompiled my base with -g, which should help with the hangs in external libraries. Patch attached.
cedega.patch
(text/plain, 6.9 KB)
diff -ru winex-orig/dlls/ntdll/cdrom.c winex/dlls/ntdll/cdrom.c
--- winex-orig/dlls/ntdll/cdrom.c Mon Nov 15 10:39:49 2004
+++ winex/dlls/ntdll/cdrom.c Fri Dec 3 00:51:18 2004
@@ -977,27 +977,11 @@
}
#elif defined(__FreeBSD__)
{
- struct ioc_read_audio ira;
+ off_t offset;
- switch (raw->TrackMode)
- {
- case YellowMode2:
- FIXME("YellowMode2: NIY\n");
- return ret;
- case XAForm2:
- FIXME("XAForm2: NIY\n");
- return ret;
- case CDDA:
- /* 2048 = 2 ** 11 */
- if (raw->DiskOffset.s.HighPart & ~2047) FIXME("Unsupported value\n");
- ira.address.lba = ((raw->DiskOffset.s.LowPart >> 11) |
+ offset = ((raw->DiskOffset.s.LowPart >> 11) |
raw->DiskOffset.s.HighPart << (32 - 11)) - 1;
- ira.address_format = CD_LBA_FORMAT;
- ira.nframes = raw->SectorCount;
- ira.buffer = buffer;
- io = ioctl(dev, CDIOCREADAUDIO, &ira);
- break;
- }
+ io = pread(dev, buffer, sectSize * raw->SectorCount, offset);
}
#elif defined(__NetBSD__)
{
diff -ru winex-orig/dlls/ntdll/signal_i386.c winex/dlls/ntdll/signal_i386.c
--- winex-orig/dlls/ntdll/signal_i386.c Tue Jul 27 14:49:20 2004
+++ winex/dlls/ntdll/signal_i386.c Fri Dec 3 01:01:14 2004
@@ -881,6 +881,7 @@
}
}
}
+#endif
#if defined(USE_PTHREADS)
static void raise_signal_if_unexpected_thread( int sig, int sig_to_raise )
@@ -901,28 +902,6 @@
#endif /* USE_PTHREADS */
-#if 0 /* Now using SIGUSR2 for eject handling */
-/**********************************************************************
- * usr2_handler
- *
- * Handler for SIGUSR2.
- * We use it to signal that the running __wine_enter_vm86() should
- * immediately set VIP_MASK, causing pending events to be handled
- * as early as possible.
- */
-static HANDLER_DEF(usr2_handler)
-{
- CONTEXT context;
-
- raise_signal_if_unexpected_thread( SIGUSR2, SIGQUIT );
-
- save_context( &context, HANDLER_CONTEXT );
- set_vm86_pend( &context );
- restore_context( &context, HANDLER_CONTEXT );
-}
-
-#else /* Now using SIGUSR2 for eject handling */
-
/**********************************************************************
* usr2_handler
*
@@ -984,16 +963,13 @@
return -1;
}
-
static HANDLER_DEF(usr2_handler)
{
FILE_ForceEjectCDDrive(get_cdrom_eject_drive());
}
-#endif
-
-
+#if 0
/**********************************************************************
* alrm_handler
*
@@ -1011,9 +987,7 @@
set_vm86_pend( &context );
restore_context( &context, HANDLER_CONTEXT );
}
-#else /* __HAVE_VM86 */
-# define raise_signal_if_unexpected_thread(a,b)
-#endif /* __HAVE_VM86 */
+#endif
/**********************************************************************
@@ -1284,7 +1258,9 @@
#endif
#endif
+#if 1 /* This was in BMS's patch. Why? */
if (set_handler( SIGUSR2, have_sigaltstack, (void (*)())usr2_handler ) == -1) goto error;
+#endif
#ifdef USE_PTHREADS
if (set_handler( SIGTERM, have_sigaltstack, (void (*)())sigterm_handler ) == -1) goto error;
diff -ru winex-orig/dlls/winedos/dosvm.c winex/dlls/winedos/dosvm.c
--- winex-orig/dlls/winedos/dosvm.c Wed May 12 14:54:54 2004
+++ winex/dlls/winedos/dosvm.c Fri Dec 3 02:08:09 2004
@@ -669,7 +669,7 @@
/**********************************************************************
* DOSVM_Init
*/
-BOOL WINAPI DOSVM_Init( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
+BOOL WINAPI DOSVM_Init( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved, CRITICAL_SECTION qcrit )
{
TRACE_(module)("(0x%08x,%ld,%p)\n", hinstDLL, fdwReason, lpvReserved);
diff -ru winex-orig/scheduler/pthread.c winex/scheduler/pthread.c
--- winex-orig/scheduler/pthread.c Tue Mar 16 15:16:04 2004
+++ winex/scheduler/pthread.c Fri Dec 3 01:10:23 2004
@@ -28,6 +28,8 @@
static void create_atfork_cs(void);
static void grab_libc(void);
+static CRITICAL_SECTION atfork_section;
+
void PTHREAD_init_done(void)
{
create_atfork_cs(); /* Must be called before setting init_done */
@@ -258,19 +260,12 @@
#define MAX_ATFORK 8 /* libc doesn't need that many anyway */
-static CRITICAL_SECTION atfork_section;
typedef void (*atfork_handler)();
static atfork_handler atfork_prepare[MAX_ATFORK];
static atfork_handler atfork_parent[MAX_ATFORK];
static atfork_handler atfork_child[MAX_ATFORK];
static int atfork_count;
-static void create_atfork_cs(void)
-{
- InitializeCriticalSection( &atfork_section );
- CRITICAL_SECTION_NAME( &atfork_section, "atfork_section" );
-}
-
int __pthread_atfork(void (*prepare)(void),
void (*parent)(void),
void (*child)(void))
@@ -710,5 +705,11 @@
}
#endif /* __GLIBC__ */
+
+static void create_atfork_cs(void)
+{
+ InitializeCriticalSection( &atfork_section );
+ CRITICAL_SECTION_NAME( &atfork_section, "atfork_section" );
+}
#endif /* USE_PTHREADS */
diff -ru winex-orig/server/cdrom_eject.c winex/server/cdrom_eject.c
--- winex-orig/server/cdrom_eject.c Thu Nov 18 12:57:40 2004
+++ winex/server/cdrom_eject.c Fri Dec 3 01:58:33 2004
@@ -568,7 +568,9 @@
memcpy( entry->devicename, devicepath, devicepathlen );
entry->devicename[devicepathlen] = 0;
entry->next = SERVER_STATIC_VARIABLE(cdrom_eject, cdrom_list);
- entry->try_poll = 0;
+#if defined( linux )
+ entry->try_poll = 0;
+#endif
/* Store at the list head */
SERVER_STATIC_VARIABLE(cdrom_eject, cdrom_list) = entry;
diff -ru winex-orig/server/fd_server.c winex/server/fd_server.c
--- winex-orig/server/fd_server.c Mon Nov 15 10:36:12 2004
+++ winex/server/fd_server.c Fri Dec 3 02:58:14 2004
@@ -583,6 +583,25 @@
pthread_attr_destroy( &attr );
}
+#elif defined(__FreeBSD__)
+ {
+ pid_t child;
+
+ switch (child = rfork(RFMEM | RFPROC | RFLINUXTHPN)) {
+ case 0:
+ /* in child, successful */
+ exit(fd_server_thread(NULL));
+ break;
+ case -1:
+ /* in parent, unsuccessful */
+ fatal_perror( "wineserver: rfork" );
+ break;
+ default:
+ /* in parent, successful */
+ break;
+ }
+ }
+
#else
{
void* stack = malloc( stack_size );
diff -ru winex-orig/server/mem_malloc.c winex/server/mem_malloc.c
--- winex-orig/server/mem_malloc.c Thu Jun 24 16:17:58 2004
+++ winex/server/mem_malloc.c Fri Dec 3 01:14:21 2004
@@ -7,6 +7,7 @@
#define DEBUG /* In case you need to turn on some more debug checks to track down a corruptor. Need to have PH_TRACE on to make sense */
#endif
+#include "config.h"
#include "mem_defs.h"
#include "mem_globals.c"