On Fri, Jan 16, 2009 at 5:35 PM, Francois Gouget <fgou...@free.fr> wrote: > On Fri, 16 Jan 2009, Austin English wrote: > >> I submitted OpenBSD's patch for CPU detection a while back >> (http://www.winehq.org/pipermail/wine-patches/2009-January/067002.html). >> Francois sent a 'more correct' one >> (http://www.winehq.org/pipermail/wine-patches/2009-January/067382.html), >> but that one is broken on NetBSD/OpenBSD >> (http://bugs.winehq.org/show_bug.cgi?id=16927). > > Argh! Sorry. I missed some places where value is used so my patch was > not quite right. > > >> With the below changes, it works again, but I'm not sure it's correct. >> Comments appreciated: > [...] >> - int value; >> + int value[2]; > [...] >> if (sysctl(mib, 2, &value, &val_len, NULL, 0) >= 0) > > If you change value to an array, then &value will be an int**. > AFAIU that's not what you for this sysctl. > > I think the attached patch would be better. Could you confirm? > > > -- > Francois Gouget <fgou...@free.fr> http://fgouget.free.fr/ > Hiroshima '45 - Czernobyl '86 - Windows '95
$ make ccache gcc -c -I. -I. -I../../include -I../../include -D__WINESRC__ -D_KERNEL32_ -D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wwrite-strings -Wpointer-arith -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -I/usr/X11R6/include -O2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -I/usr/X11R6/include -o cpu.o cpu.c cpu.c: In function 'GetSystemInfo': cpu.c:573: error: subscripted value is neither array nor pointer *** Error code 1 Seems you forgot another one ;-). Your patch, plus this: @@ -570,7 +570,7 @@ VOID WINAPI GetSystemInfo( #endif #ifdef CPU_SSE2 mib[1] = CPU_SSE2; /* this should imply MMX */ - value[1] = sizeof(value); + val_len = sizeof(value); if (sysctl(mib, 2, &value, &val_len, NULL, 0) >= 0) if (value) PF[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE; #endif Gets it working again on NetBSD (I suspect OpenBSD will as well, but I won't be able to test until probably tomorrow). -- -Austin