Subject: Re: wine on netbsd-stable still broken
To: Michal Pasternak <michal@pasternak.w.lub.pl>
From: Thomas Klausner <wiz@netbsd.org>
List: tech-pkg
Date: 01/17/2004 16:26:39
--0eh6TmSyL6TZE2Uz
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Jan 16, 2004 at 10:59:30PM +0100, Michal Pasternak wrote:
> Let me re-phrase: wine's not broken on -stable, wine just needs large
> datasize limit (even if built with OpenGL from MesaLib). Could we please add
> something to MESSAGE so users won't get confused about it, just like I did?

I added a message.

Btw, with the attached patch, ldd on wine works, but wine still
fails during startup if the limit is not high enough.

I hope I got the &~ stuff right :)

On the other hand, on 1.6L there's a warning during compilation:
main.c: In function `main':
main.c:33: warning: alignment of `pe_load' is greater than maximum object file alignment. Using 4.

so I guess that the old code doesn't work as intended anyway.

 Thomas

--0eh6TmSyL6TZE2Uz
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-af

$NetBSD$

--- loader/main.c.orig	Sat Nov 22 01:08:26 2003
+++ loader/main.c
@@ -18,6 +18,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include "wine/library.h"
@@ -28,10 +29,21 @@
 int main( int argc, char *argv[] )
 {
     char error[1024];
-
 #ifdef __i386__
-    static char pe_load[256*1024*1024] __attribute__((aligned(4096)));
-    wine_set_pe_load_area( pe_load, sizeof(pe_load) );
+    char *pe_load_temp;
+    static char *pe_load = NULL;
+
+    if (pe_load == NULL) {
+	pe_load_temp = malloc(256*1024*1024+4096);
+	if (pe_load_temp == NULL) {
+	    fprintf( stderr, "wine: malloc error: %s\n", strerror(errno) );
+	    exit(1);
+	}
+
+	pe_load = (char *)((unsigned long long)(pe_load_temp+4095) & ~0x1000ULL);
+    }
+
+    wine_set_pe_load_area( pe_load, 256*1024*1024 );
 #endif
 
     wine_init( argc, argv, error, sizeof(error) );

--0eh6TmSyL6TZE2Uz--