1 --- XFree86-3.3.3.1/xc/include/Xpoll.h.alpha-sockets Mon Jan 11 12:28:21 1999
2 +++ XFree86-3.3.3.1/xc/include/Xpoll.h Mon Jan 11 12:30:05 1999
7 -#if (defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE)
8 +#if (defined(SVR4) || defined(CRAY) || defined(AIXV3) || defined(linux)) && !defined(FD_SETSIZE)
9 #include <sys/select.h>
12 --- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/compiler.h.alpha-sockets Mon Oct 19 16:39:32 1998
13 +++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/compiler.h Mon Jan 11 12:28:22 1999
15 * from linux/include/asm-alpha/unaligned.h
18 -static __inline__ unsigned long ldq_u(unsigned long * r11)
21 + * This is a silly but good way to make sure that
22 + * the get/put functions are indeed always optimized,
23 + * and that we use the correct sizes.
25 +extern void bad_unaligned_access_length(void);
28 + * EGCS 1.1 knows about arbitrary unaligned loads. Define some
29 + * packed structures to talk about such things with.
32 +struct __una_u64 { unsigned long x __attribute__((packed)); };
33 +struct __una_u32 { unsigned int x __attribute__((packed)); };
34 +struct __una_u16 { unsigned short x __attribute__((packed)); };
37 + * Elemental unaligned loads
40 +extern __inline__ unsigned long ldq_u(const unsigned long * r11)
42 +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
43 + const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
47 __asm__("ldq_u %0,%3\n\t"
50 - "extqh %1,%2,%1\n\t"
53 :"=&r" (r1), "=&r" (r2)
56 - "m" (*(unsigned long *)(7+(char *) r11)));
58 + "m" (*(const unsigned long *)(7+(char *) r11)));
63 -static __inline__ unsigned long ldl_u(unsigned int * r11)
64 +extern __inline__ unsigned long ldl_u(const unsigned int * r11)
66 +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
67 + const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
71 __asm__("ldq_u %0,%3\n\t"
74 - "extlh %1,%2,%1\n\t"
77 :"=&r" (r1), "=&r" (r2)
80 - "m" (*(unsigned long *)(3+(char *) r11)));
82 + "m" (*(const unsigned long *)(3+(char *) r11)));
87 -static __inline__ unsigned long ldw_u(unsigned short * r11)
88 +extern __inline__ unsigned long ldw_u(const unsigned short * r11)
90 +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
91 + const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
95 __asm__("ldq_u %0,%3\n\t"
98 - "extwh %1,%2,%1\n\t"
101 :"=&r" (r1), "=&r" (r2)
104 - "m" (*(unsigned long *)(1+(char *) r11)));
106 + "m" (*(const unsigned long *)(1+(char *) r11)));
111 -static __inline__ void stq_u(unsigned long r5, unsigned long * r11)
114 + * Elemental unaligned stores
117 +extern __inline__ void stq_u(unsigned long r5, unsigned long * r11)
119 +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
120 + struct __una_u64 *ptr = (struct __una_u64 *) r11;
123 unsigned long r1,r2,r3,r4;
125 __asm__("ldq_u %3,%1\n\t"
126 @@ -224,10 +264,15 @@
127 "=m" (*(unsigned long *)(7+(char *) r11)),
128 "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
129 :"r" (r5), "r" (r11));
133 -static __inline__ void stl_u(unsigned long r5, unsigned int * r11)
134 +extern __inline__ void stl_u(unsigned long r5, unsigned int * r11)
136 +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
137 + struct __una_u32 *ptr = (struct __una_u32 *) r11;
140 unsigned long r1,r2,r3,r4;
142 __asm__("ldq_u %3,%1\n\t"
143 @@ -244,10 +289,15 @@
144 "=m" (*(unsigned long *)(3+(char *) r11)),
145 "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
146 :"r" (r5), "r" (r11));
150 -static __inline__ void stw_u(unsigned long r5, unsigned short * r11)
151 +extern __inline__ void stw_u(unsigned long r5, unsigned short * r11)
153 +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
154 + struct __una_u16 *ptr = (struct __una_u16 *) r11;
157 unsigned long r1,r2,r3,r4;
159 __asm__("ldq_u %3,%1\n\t"
161 "=m" (*(unsigned long *)(1+(char *) r11)),
162 "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
163 :"r" (r5), "r" (r11));
167 #define mem_barrier() __asm__ __volatile__("mb" : : : "memory")
168 --- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86Summa.c.alpha-sockets Mon Jan 11 12:28:16 1999
169 +++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86Summa.c Mon Jan 11 12:28:22 1999
172 timeout.tv_usec = 200000;
174 - SYSCALL(err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout));
175 + SYSCALL(err = select(fd+1, &readfds, NULL, NULL, &timeout));
177 Error("SummaSketch select");
179 --- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86Wacom.c.alpha-sockets Mon Jan 11 12:28:16 1999
180 +++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86Wacom.c Mon Jan 11 12:28:23 1999
185 - SYSCALL(err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout));
186 + SYSCALL(err = select(fd+1, &readfds, NULL, NULL, &timeout));
190 --- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86_Mouse.c.alpha-sockets Mon Jan 11 12:28:16 1999
191 +++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86_Mouse.c Mon Jan 11 12:28:23 1999
193 write(mouse->mseFd, s, 1);
195 FD_SET(mouse->mseFd, &fds);
196 - if (select(FD_SETSIZE, &fds, NULL, NULL, NULL) <= 0)
197 + if (select(mouse->mseFd+1, &fds, NULL, NULL, NULL) <= 0)
199 read(mouse->mseFd, &c, 1);
201 --- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86_PnPMouse.c.alpha-sockets Mon Mar 2 05:23:21 1998
202 +++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/common/xf86_PnPMouse.c Mon Jan 11 12:28:23 1999
204 FD_SET(mouse->mseFd, &fds);
206 timeout.tv_usec = 200000;
207 - if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0) {
208 + if (select(mouse->mseFd+1, &fds, NULL, NULL, &timeout) <= 0) {
210 /* port setup, 2nd phase (2.1.5) */
211 i = TIOCM_DTR | TIOCM_RTS; /* DTR = 0, RTS = 0 */
213 FD_SET(mouse->mseFd, &fds);
215 timeout.tv_usec = 200000;
216 - if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0)
217 + if (select(mouse->mseFd+1, &fds, NULL, NULL, &timeout) <= 0)
222 FD_SET(mouse->mseFd, &fds);
224 timeout.tv_usec = 200000;
225 - if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0)
226 + if (select(mouse->mseFd+1, &fds, NULL, NULL, &timeout) <= 0)
231 FD_SET(mouse->mseFd, &fds);
233 timeout.tv_usec = 200000;
234 - if (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) <= 0)
235 + if (select(mouse->mseFd+1, &fds, NULL, NULL, &timeout) <= 0)
238 read(mouse->mseFd, &buf[i], 1);
239 --- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/mga/mga_driver.c.alpha-sockets Mon Jan 11 12:28:17 1999
240 +++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/vga256/drivers/mga/mga_driver.c Mon Jan 11 12:28:23 1999
241 @@ -1256,6 +1256,16 @@
245 +#if NeedFunctionPrototypes
246 + extern void *MGA3026Save(void*);
247 + extern void *MGA1064Save(void*);
248 + extern void *MGA200Save(void*);
250 + extern void *MGA3026Save();
251 + extern void *MGA1064Save();
252 + extern void *MGA200Save();
257 case PCI_CHIP_MGA2064:
258 --- XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/xaa/xf86bench.c.alpha-sockets Mon Jan 11 12:28:19 1999
259 +++ XFree86-3.3.3.1/xc/programs/Xserver/hw/xfree86/xaa/xf86bench.c Mon Jan 11 12:28:23 1999
263 unsigned long data64;
264 - data64 = data | (data << 32);
265 + data64 = (unsigned long)data | ((unsigned long)data << 32);
268 while (dest <= end - 128) {
269 --- XFree86-3.3.3.1/xc/programs/Xserver/include/os.h.alpha-sockets Thu Jan 22 05:47:13 1998
270 +++ XFree86-3.3.3.1/xc/programs/Xserver/include/os.h Mon Jan 11 12:28:23 1999
272 /* stuff for FlushCallback */
273 extern CallbackListPtr FlushCallback;
277 +/* Systems with 64-bit 'long' have their own quirks, like
278 + select()'s fd_mask components are 64-bit long, but the
279 + ffs() function works only on 'int', which at least at
280 + an Alpha are 32-bit wide... */
285 +#if NeedFunctionPrototypes
292 --- XFree86-3.3.3.1/xc/programs/Xserver/os/WaitFor.c.alpha-sockets Sat Oct 24 03:56:28 1998
293 +++ XFree86-3.3.3.1/xc/programs/Xserver/os/WaitFor.c Mon Jan 11 12:28:23 1999
295 #include "dixstruct.h"
298 -/* modifications by raphael */
300 -int mffs(fd_mask mask) {
301 +/* modifications by raphael, and [mea];
302 + system uses this if LONG64 is defined.
303 + See at the end of the "os.h" */
304 +int mffs(unsigned long mask) {
306 if ( ! mask ) return 0;
308 @@ -423,17 +424,18 @@
309 if (XFD_ANYSET (&clientsReadable))
312 - for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
314 + i < (sizeof(clientsReadable)/sizeof(clientsReadable.fds_bits[0]));
317 int highest_priority;
319 while (clientsReadable.fds_bits[i])
321 int client_priority, client_index;
323 curclient = ffs (clientsReadable.fds_bits[i]) - 1;
324 - client_index = /* raphael: modified */
325 - ConnectionTranslation[curclient + (i * (sizeof(fd_mask) * 8))];
326 + curclient += i * (8 * sizeof(fd_mask));
327 + client_index = ConnectionTranslation[curclient];
329 int highest_priority;
330 fd_set savedClientsReadable;
331 @@ -476,11 +478,10 @@
333 pClientsReady[nready++] = client_index;
336 + FD_CLR(curclient, &clientsReadable);
338 - clientsReadable.fds_bits[i] &= ~(((fd_mask)1) << curclient);
341 - FD_CLR(curclient, &clientsReadable);
345 @@ -541,12 +542,13 @@
346 COPYBITS(ClientsWithInput, clientsReadable);
347 dbprintf(("WaitFor: "));
349 - for (i=0; i < mskcnt; i++) {
350 + for (i=0; i < mskcnt;i++) {
351 while (clientsReadable[i]) {
352 int client_priority, curclient, client_index;
354 curclient = ffs (clientsReadable[i]) - 1;
355 - client_index = ConnectionTranslation[curclient + (i << 5)];
356 + curclient += i * (8 * sizeof(clientsReadable[i]));
357 + client_index = ConnectionTranslation[curclient];
358 dbprintf(("%d has input\n", curclient));
360 client_priority = clients[client_index]->priority;
365 - while (timer = timers)
366 + while ((timer = timers))
368 timers = timer->next;
370 --- XFree86-3.3.3.1/xc/programs/Xserver/os/connection.c.alpha-sockets Mon Jan 11 12:28:20 1999
371 +++ XFree86-3.3.3.1/xc/programs/Xserver/os/connection.c Mon Jan 11 12:28:23 1999
373 #include <netdnet/dn.h>
374 #endif /* DNETCONN */
376 -/* added by raphael */
378 -extern int mffs(long);
380 extern char *display; /* The display number */
381 int lastfdesc; /* maximum file descriptor */
386 fd_mask readyconnections; /* mask of listeners that are ready */
387 + /* In UNIX environments we assume that all listeners fit into
388 + the first 32 file descriptor ids. */
390 fd_set readyconnections; /* set of listeners that are ready */
400 register int curclient, curoff;
402 @@ -994,23 +989,24 @@
407 - notime.tv_usec = 0;
410 - for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
411 + for (i=0; i < (sizeof(AllClients)/sizeof(fd_mask)); i++)
413 - mask = AllClients.fds_bits[i];
414 + fd_mask mask = AllClients.fds_bits[i];
417 curoff = ffs (mask) - 1;
418 - curclient = curoff + (i << 5);
419 + curclient = curoff + (i * 8 * sizeof(mask));
421 FD_SET(curclient, &tmask);
422 + /* there are operating systems which *do* alter the timeout
423 + variables -- it is good practice to initialize them always */
425 + notime.tv_usec = 0;
426 r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime);
428 CloseDownClient(clients[ConnectionTranslation[curclient]]);
429 - mask &= ~(1 << curoff);
430 + mask &= ~(((fd_mask)1) << curoff);
434 --- XFree86-3.3.3.1/xc/programs/Xserver/os/io.c.alpha-sockets Sat Oct 24 03:56:29 1998
435 +++ XFree86-3.3.3.1/xc/programs/Xserver/os/io.c Mon Jan 11 12:28:23 1999
437 #include "lbxserve.h"
440 -/* added by raphael */
442 -extern int mffs(long);
444 CallbackListPtr ReplyCallback;
445 CallbackListPtr FlushCallback;
448 NewOutputPending = FALSE;
451 - for (base = 0; base < howmany(XFD_SETSIZE, NFDBITS); base++)
452 + for (base = 0; base < (sizeof(OutputPending)/sizeof(fd_mask)); base++)
454 mask = OutputPending.fds_bits[ base ];
455 OutputPending.fds_bits[ base ] = 0;
458 index = ffs(mask) - 1;
459 mask &= ~lowbit(mask);
460 - if ((index = ConnectionTranslation[(base << 5) + index]) == 0)
461 + index = ConnectionTranslation[ base * (8 * sizeof(mask)) + index ];
464 client = clients[index];
465 if (client->clientGone)
466 --- XFree86-3.3.3.1/xc/programs/lbxproxy/include/os.h.alpha-sockets Sat Dec 21 23:16:36 1996
467 +++ XFree86-3.3.3.1/xc/programs/lbxproxy/include/os.h Mon Jan 11 12:28:23 1999
474 +/* Systems with 64-bit 'long' have their own quirks, like
475 + select()'s fd_mask components are 64-bit long, but the
476 + ffs() function works only on 'int', which at least at
477 + an Alpha are 32-bit wide... */
482 +#if NeedFunctionPrototypes
489 --- XFree86-3.3.3.1/xc/programs/lbxproxy/os/WaitFor.c.alpha-sockets Sat Dec 21 23:16:30 1996
490 +++ XFree86-3.3.3.1/xc/programs/lbxproxy/os/WaitFor.c Mon Jan 11 12:28:23 1999
495 +/* modifications by raphael, and [mea];
496 + system uses this if LONG64 is defined.
497 + See at the end of the "os.h" */
498 +int mffs(unsigned long mask) {
500 + if ( ! mask ) return 0;
502 + while (! (mask & 1)) {
509 extern fd_set AllSockets;
510 extern fd_set AllClients;
511 extern fd_set LastSelectMask;
512 @@ -192,17 +206,18 @@
514 if (XFD_ANYSET(&clientsReadable))
516 - for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
517 + for (i=0; i < (sizeof(clientsReadable)/sizeof(fd_mask)); i++)
519 while (clientsReadable.fds_bits[i])
523 curclient = ffs (clientsReadable.fds_bits[i]) - 1;
524 - client_index = ConnectionTranslation[curclient + (i << 5)];
526 - pClientsReady[nready++] = client_index;
528 + curclient += i * (8 * sizeof(fd_mask));
529 + client_index = ConnectionTranslation[curclient];
531 + pClientsReady[nready++] = client_index;
533 clientsReadable.fds_bits[i] &= ~(((fd_mask)1) << curclient);
536 --- XFree86-3.3.3.1/xc/programs/lbxproxy/os/connection.c.alpha-sockets Thu Nov 5 14:27:57 1998
537 +++ XFree86-3.3.3.1/xc/programs/lbxproxy/os/connection.c Mon Jan 11 12:28:23 1999
538 @@ -1746,7 +1746,7 @@
539 while (readyconnections)
541 curconn = ffs (readyconnections) - 1;
542 - readyconnections &= ~(1 << curconn);
543 + readyconnections &= ~(((fd_mask)1) << curconn);
544 if ((newconn = accept (curconn,
545 (struct sockaddr *) NULL,
547 @@ -1905,19 +1905,19 @@
551 - for (i=0; i<howmany(XFD_SETSIZE, NFDBITS); i++)
552 + for (i=0; i < (sizeof(AllClients)/sizeof(fd_mask)); i++)
554 mask = AllClients.fds_bits[i];
557 curoff = ffs (mask) - 1;
558 - curclient = curoff + (i << 5);
559 + curclient = curoff + i * (8 * sizeof(mask));
561 FD_SET(curclient, &tmask);
562 r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime);
564 CloseDownClient(clients[ConnectionTranslation[curclient]]);
565 - mask &= ~(1 << curoff);
566 + mask &= ~(((fd_mask)1) << curoff);
570 --- XFree86-3.3.3.1/xc/programs/lbxproxy/os/io.c.alpha-sockets Wed Jan 1 22:02:48 1997
571 +++ XFree86-3.3.3.1/xc/programs/lbxproxy/os/io.c Mon Jan 11 12:28:23 1999
576 - register int index, base, mask;
577 + register int index, base;
578 + register fd_mask mask;
580 register ClientPtr client;
584 NewOutputPending = FALSE;
586 - for (base = 0; base < howmany(XFD_SETSIZE, NFDBITS); base++)
587 + for (base = 0; base < (sizeof(OutputPending)/sizeof(mask)); base++)
589 mask = OutputPending.fds_bits[ base ];
590 OutputPending.fds_bits[ base ] = 0;
593 index = ffs(mask) - 1;
594 mask &= ~lowbit(mask);
595 - if ((index = ConnectionOutputTranslation[(base << 5) + index]) == 0)
596 + index += base * (8 * sizeof(mask));
597 + index = ConnectionOutputTranslation[index];
600 client = clients[index];
601 if (client->clientGone)
602 --- XFree86-3.3.3.1/xc/programs/xfs/include/os.h.alpha-sockets Fri Jan 5 08:21:30 1996
603 +++ XFree86-3.3.3.1/xc/programs/xfs/include/os.h Mon Jan 11 12:28:23 1999
605 extern int ListCatalogues();
606 extern int ListAlternateServers();
610 +/* Systems with 64-bit 'long' have their own quirks, like
611 + select()'s fd_mask components are 64-bit long, but the
612 + ffs() function works only on 'int', which at least at
613 + an Alpha are 32-bit wide... */
618 +#if NeedFunctionPrototypes
624 --- XFree86-3.3.3.1/xc/programs/xfs/os/connection.c.alpha-sockets Thu Nov 5 14:28:31 1998
625 +++ XFree86-3.3.3.1/xc/programs/xfs/os/connection.c Mon Jan 11 12:28:23 1999
629 * accepts new connections
631 + * This assumes that all sockets in *listen* mode are numbered
632 + * something below 32! (likely true..)
636 @@ -495,15 +498,15 @@
637 struct timeval notime;
641 - notime.tv_usec = 0;
643 XFD_COPYSET(&AllClients, &mask);
644 for (i = 0; i < howmany(XFD_SETSIZE, NFDBITS); i++) {
645 while (mask.fds_bits[i]) {
646 - curclient = ffs(mask.fds_bits[i]) - 1 + (i << 5);
647 + curclient = ffs(mask.fds_bits[i]) - 1;
648 + curclient += i * (8 * sizeof(mask.fds_bits[i]));
650 FD_SET(curclient, &tmask);
652 + notime.tv_usec = 0;
653 r = Select(curclient + 1, &tmask, NULL, NULL, ¬ime);
655 CloseDownClient(clients[ConnectionTranslation[curclient]]);
656 --- XFree86-3.3.3.1/xc/programs/xfs/os/io.c.alpha-sockets Thu May 29 10:01:08 1997
657 +++ XFree86-3.3.3.1/xc/programs/xfs/os/io.c Mon Jan 11 12:28:23 1999
659 #include "X11/Xpoll.h"
664 #ifdef X_NOT_STDC_ENV
666 @@ -530,13 +531,14 @@
668 NewOutputPending = FALSE;
670 - for (base = 0; base < howmany(XFD_SETSIZE, NFDBITS); base++) {
671 + for (base = 0; base < (sizeof(OutputPending)/sizeof(mask)); base++) {
672 mask = OutputPending.fds_bits[base];
673 OutputPending.fds_bits[base] = 0;
675 index = ffs(mask) - 1;
676 mask &= ~lowbit(mask);
677 - if ((index = ConnectionTranslation[(base << 5) + index]) == 0)
678 + index += base * (8 * sizeof(mask));
679 + if ((index = ConnectionTranslation[index]) == 0)
681 client = clients[index];
682 if (client->clientGone == CLIENT_GONE)
683 --- XFree86-3.3.3.1/xc/programs/xfs/os/waitfor.c.alpha-sockets Sat Jan 18 02:02:48 1997
684 +++ XFree86-3.3.3.1/xc/programs/xfs/os/waitfor.c Mon Jan 11 12:28:23 1999
687 #include "X11/Xpoll.h"
691 +/* modifications by raphael, and [mea];
692 + system uses this if LONG64 is defined.
693 + See at the end of the "os.h" */
694 +int mffs(unsigned long mask) {
696 + if ( ! mask ) return 0;
698 + while (! (mask & 1)) {
706 #include <sys/nbio.h>
707 @@ -208,10 +223,11 @@
709 if (current_time) /* may not have been set */
710 current_time = GetTimeInMillis();
711 - for (i = 0; i < howmany(XFD_SETSIZE, NFDBITS); i++) {
712 + for (i = 0; i < (sizeof(clientsReadable)/sizeof(fd_mask)); i++) {
713 while (clientsReadable.fds_bits[i]) {
714 curclient = ffs(clientsReadable.fds_bits[i]) - 1;
715 - conn = ConnectionTranslation[curclient + (i << 5)];
716 + curclient += i * (8 * sizeof(fd_mask));
717 + conn = ConnectionTranslation[curclient];
718 FD_CLR (curclient, &clientsReadable);
719 client = clients[conn];