Today on #picogui, Olivier found this same problem crashing pgserver on his Sparc workstation. He changed the handle size to 30 bits, and it worked fine. He committed this to CVS, and I removed the #ifdef for MIPS. Yeah, I don't know what I was thinking when i wrote that :)
On 2001.11.13 05:23 Sean Barnes wrote: > What really confused me is that PicoGUI still compiles and runs at all on > my > PC. I wrote a simple test program to try the shifting and it didn't work > right on either Mips or x86. Maybe gcc was smart enough to see the entire > expression (1<<32 -1) and figure out that it was in range. > > 30 bit handles will be plenty =) Feel free to get rid of my #ifndef when > you > change this. I just needed to get this working since it was causing an > infinite loop on my VR3 while trying to initialize (I spent hours > thinking > it was a problem with the rootdisk and libraries, etc... I finally went > through and put printf's all over the place until I figured out where it > was > stuck). > > > -----Original Message----- > > From: Micah Dowty [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, November 13, 2001 12:54 AM > > To: Sean Barnes > > Cc: [EMAIL PROTECTED] > > Subject: Re: [Pgui-commits] CVS: pgserver/include/pgserver > > handle.h,1.19,1.20 > > > > > > Oops! > > > > Maybe a good solution for all platforms would be to use 30 or 31-bit > > handles. A 30-bit handle would allow for a little overflow even when > using > > a signed long. We'd only get 1/4 the handles though... Think it will be > > enough? ;) > > > > On 2001.11.12 22:10 Sean Barnes wrote: > > > Update of /cvsroot/pgui/pgserver/include/pgserver > > > In directory usw-pr-cvs1:/tmp/cvs-serv7754/include/pgserver > > > > > > Modified Files: > > > handle.h > > > Log Message: > > > There seems to be a bug with the handle size. > > > > > > With the mips compiler I get a warning with this: > > > 1<<32 > > > > > > For MIPS, I've set it to use one less... It might be worthwhile > checking > > > if other platforms suffer from this proplem. For the VR3 it was > causing > > > an infinite loop when searching for a new handle (1 << 32 - 1 is not > the > > > maximum handle size) > > > > > > > > > > > > Index: handle.h > > > =================================================================== > > > RCS file: /cvsroot/pgui/pgserver/include/pgserver/handle.h,v > > > retrieving revision 1.19 > > > retrieving revision 1.20 > > > diff -C2 -r1.19 -r1.20 > > > *** handle.h 2001/10/17 05:25:01 1.19 > > > --- handle.h 2001/11/13 05:10:21 1.20 > > > *************** > > > *** 42,46 **** > > > --- 42,63 ---- > > > typedef u32 handle; > > > #define HANDLE_BITS 32 > > > + > > > + #ifndef CONFIG_LINUX_MIPS > > > #define HANDLE_SIZE (1<<HANDLE_BITS) > > > + #else > > > + > > > + //Hmm... 1<<32 doesn't seem like a good idea on a 32-bit machine. > > > + //Even (1<<32)-1 is an overflow for u32, due to the temporary > > > + //use of bit 32. While this works on the PC, it's killing > > > + //the VR3 in an infinite loop (Max handle is 0... =-) > > > + > > > + //Since HANDLE_SIZE is only used with a -1 following it, > > > + //it would make sense to set this to 0, allowing you to easily > > > + //get the maximum. However, that's asking for errors, so I'll just > > > + //use one less handle. Darn, only 4,294,967,294 possible handles > > > + > > > + #define HANDLE_SIZE (0xFFFFFFFF) > > > + > > > + #endif //CONFIG_LINUX_MIPS > > > > > > struct handlenode { > > > > > > > > > _______________________________________________ > > > Pgui-commits mailing list > > > [EMAIL PROTECTED] > > > https://lists.sourceforge.net/lists/listinfo/pgui-commits > > > > _______________________________________________ Pgui-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/pgui-devel
