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

Patch for MiNT setting correct size of the cookie jar



Hello,

following a patch, which sets the size of the new cookie jar according to the size of the old jar.
This only valid if you have the memory protection disabled.

Dirk

--- Orig/main.c	Sun Jun 11 13:39:54 1995
+++ Source/main.c	Mon Feb 12 08:55:58 1996
@@ -1084,20 +1084,22 @@
 				rsvf = cookie->value;
 			cookie++; ncookies++;
 		}
+		ncsize = cookie->value;
 	}
-
+	else
+		ncsize = 32;
 	/*
 	 * We allocate the cookie jar in global memory so anybody can read
-	 * it or write it. This code allocates at least 8 more cookies, and
-	 * then rounds up to a QUANTUM boundary (that's what ROUND does). 
-	 * Probably, nobody will have to allocate another cookie jar :-)
+	 * it or write it. This code allocates at least the old number of cookies 
+	 * if a cookie jar exists and if not at least 32 cookie entrys, then rounds 
+	 * up to a QUANTUM boundary (that's what ROUND does). Probably, nobody will 
+	 * have to allocate another cookie jar :-)
 	 */
 
 	/* NOTE: obviously, we can do this only if init_intr is called
 	 * _after_ memory, processes, etc. have been initialized
 	 */
-	ncsize = (ncookies+8)*sizeof(COOKIE);
-	ncsize = ROUND(ncsize);
+	ncsize = ROUND(ncsize * sizeof(COOKIE));
 #if 0
 	newcookie = (COOKIE *)alloc_region(core, ncsize, PROT_G);
 #else