[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mouse polling?



In article <9410301327.AA13720@axher3.desy.de> you write:
>Hallo everybody,
>
>  some users of mint111 might have noticed already that CoNnect does run
>very unstable in this environment. In fact if you use the mouse to select
>a certain text region the system will hang as soon as you release the
>left mouse button.
>[test program deleted, does someone want the gcc -lgem version?]

ok... try this (1.11h3):

Index: dosfile.c
@@ -1118,6 +1121,9 @@
 	int rsel;
 	long wait_cond;
 	short sr;
+#if 1
+	long oldgemtimer = 0, gemtimer = 0;
+#endif
 
 	if (rfdp) {
 		col_rfd = rfd = *rfdp;
@@ -1234,6 +1240,34 @@
 		mask = mask << 1L;
 	}
 
+#if 1
+/* GEM kludges part #xxx :(
+ *
+ * the `last' (1993) GEM AES apparently uses the same etv_timer counter
+ * for GEM processes evnt_timer/evnt_multi timeouts and sometimes for
+ * some other internal watchdog timer or whatever of always 0x2600 ticks
+ * when waking up console/mouse selects, and so sometimes turns your
+ * 50ms evnt_timer call into a >3 min one.
+ *
+ * *sigh* when will atari release source if they don't care about their
+ * GEM anymore...  this beast not only needs debugged, it also wants to
+ * see a profiler...
+ */
+	if (!strcmp (curproc->name, "AESSYS")) {
+	/* pointer to gems etv_timer handler */
+		char *foo = *(char **)(lineA0()-0x42), *memchr();
+		long *bar;
+	/* find that counter by looking for the first subql #1,xxxxxx
+	 * instruction (0x53b9), save address and old value
+	 */
+		if (foo && (foo = memchr (foo, 0x53, 0x40)) &&
+		    !(1 & (long)foo) && foo[1] == (char)0xb9 &&
+		    foo < (char *)(bar = *(long **)(foo+2))) {
+			gemtimer = (long)bar;
+			oldgemtimer = *bar;
+		}
+	}
+#endif
 	if (count == 0) {	/* no data is ready yet */
 		if (timeout && !t) {
 			t = addtimeout((long)timeout, unselectme);
@@ -1345,6 +1379,24 @@
 		mask = mask << 1L;
 	}
 
+#if 1
+/* GEM kludgery continued...
+ *
+ * if the counter was already in use and is somewhere at 3 minutes now
+ * then just restore the old value
+ */
+	if (oldgemtimer) {
+		long *bar = (long *)gemtimer;
+		short sr = spl7();
+		if ((gemtimer = *bar) <= 0x2600 && gemtimer > 0x2000 &&
+		    gemtimer > oldgemtimer) {
+			*bar = oldgemtimer;
+			spl(sr);
+			DEBUG(("select: restoring gem timer (%lx: %lx -> %lx)", bar, gemtimer, oldgemtimer));
+		}
+		spl(sr);
+	}
+#endif
 	/* wake other processes which got a collision */
 	if (rfd || wfd || xfd)
 		wake(SELECT_Q, (long)&select_coll);

>Together with the latest GEM.SYS which was sent to some developpers a long
>while ago, mint111 even crashes the system on the desktop when selecting
>a desktop region and releasing the mouse button.

 don't know about that one...  maybe you need to change the hack that
finds the counter also.
>
>Is this problem known and are there solutions (apart from installing
>linux 68k) ? ;-)

 do they have GEM source?  *sigh*

 i have a few more diffs for 1.11h3, including one for magic.i
(did not correspond to the patched proc.h for some reason...)

Index: pipefs.c
@@ -504,6 +504,7 @@
  * clear the flag when this happens.
  */
 	b->flags = ((attrib & FA_SYSTEM) ? O_TTY : 0) | O_HEAD;
+	b->lockpid = b->cursrate = 0;
 	b->inp = inp; b->outp = outp; b->tty = tty;
 
 	b->next = rootlist;
@@ -901,7 +902,8 @@
 	switch(mode) {
 	case FIONREAD:
 		p = (f->flags & O_HEAD) ? this->outp : this->inp;
-		assert(p != 0);
+		if (!p)
+			return EIHNDL;
 		r = p->len;
 		if (r == 0) {
 			if (p->writers <= 0 || p->writers == VIRGIN_PIPE) {
@@ -921,7 +923,8 @@
 		break;
 	case FIONWRITE:
 		p = (f->flags & O_HEAD) ? this->inp : this->outp;
-		assert(p != 0);
+		if (!p)
+			return EIHNDL;
 		if (p->readers <= 0) {
 	/* see compatibility comment under FIONREAD */
 			r = -1;
@@ -1052,7 +1055,8 @@
 	    }
 	case TIOCOUTQ:
 		p = (f->flags & O_HEAD) ? this->inp : this->outp;
-		assert(p != 0);
+		if (!p)
+			return EIHNDL;
 		if (p->readers <= 0) {
 			r = -1;
 		} else {
Index: procfs.c
@@ -757,16 +756,17 @@
 	UNUSED(f); UNUSED(pid);
 	return 0;
 }
 
 static long ARGS_ON_STACK 
 proc_readlabel(dir, name, namelen)
 	fcookie *dir;
 	char *name;
 	int namelen;
 {
 	UNUSED(dir);
 
 	strncpy(name, "Processes", namelen-1);
- 	return (strlen("Processes") < namelen) ? 0 : ENAMETOOLONG;
+	name[namelen-1] = 0;
+	return (sizeof "Processes" <= namelen) ? 0 : ENAMETOOLONG;
 }
 
Index: magic.i
@@ -14,8 +14,8 @@
 %define C_CRP 416
 %define C_TC 424
 %define P_CTXT0 4
-%define P_SYSTIME 1064
-%define P_USRTIME 1068
+%define P_SYSTIME 1068
+%define P_USRTIME 1072
 %define P_PTRACER 3586
 %define P_SYSCTXT 4
 %define P_EXCPC 3606

 now what do i get for hunting this silly bug so long without source? :)

 cheers
	Juergen