From mint-bounce@lists.fishpool.fi  Wed Jun  2 08:21:48 2010
X-Authenticated: #48718759
X-Provags-ID: V01U2FsdGVkX19yRmF5i5Zy4ihFqVnhYhhHpocM9YfA2EhU/kz9bW
	mDmHBcci7lRTFD
Message-ID: <80267.1609885408-sendEmail@descaro>
From: "Helmut Karlowski" <hk10@gmx.de>
To: "alanh@fairlite.co.uk" <alanh@fairlite.co.uk>,
        "mint@lists.fishpool.fi" <mint@lists.fishpool.fi>
Cc: "hk10@gmx.de" <hk10@gmx.de>
Subject: [MiNT] patch:MiNT:single-task
Date: Wed, 2 Jun 2010 12:16:29 +0000
X-Mailer: sendEmail-1.55
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----MIME delimiter for sendEmail-654316.66800669"
X-Antivirus: avast! (VPS 100602-0, 02.06.2010), Outbound message
X-Antivirus-Status: Clean
X-Y-GMX-Trusted: 0
X-ecartis-version: Ecartis v1.0.0
Sender: mint-bounce@lists.fishpool.fi
Errors-to: mint-bounce@lists.fishpool.fi
X-original-sender: hk10@gmx.de
Precedence: bulk
List-help: <mailto:ecartis@lists.fishpool.fi?Subject=help>
List-unsubscribe: <mailto:mint-request@lists.fishpool.fi?Subject=unsubscribe>
List-Id: <mint.lists.fishpool.fi>
X-List-ID: <mint.lists.fishpool.fi>
List-subscribe: <mailto:mint-request@lists.fishpool.fi?Subject=subscribe>
List-owner: <mailto:tjhukkan@fishpool.fi>
List-post: <mailto:mint@lists.fishpool.fi>

This is a multi-part message in MIME format. To properly display this message you need a MIME-Version 1.0 compliant Email program.

------MIME delimiter for sendEmail-654316.66800669
Content-Type: text/plain;
  charset="iso-8859-1"
  Content-Transfer-Encoding: quoted-printable

Sorry: that was the wrong file - should have been this

----------------------------------------------------
add support for single-task-mode for XaAES
----------------------------------------------------



------MIME delimiter for sendEmail-654316.66800669
Content-Type: text/plain;
 name="single-task.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="single-task.patch"

--- dosfile.c	13 Jan 2010 17:13:49 -0000	1.35
+++ dosfile.c	2 Jun 2010 11:39:51 -0000
@@ -197,7 +197,17 @@
 	DIR **where, **_where;
 	long r;

-	TRACE (("Fclose: %d", fd));
+	DEBUG (("Fclose: %d", fd));
+
+	/* this is for pure-debugger:
+	 * some progs call Fclose(-1) when they exit which would
+	 * cause pd to lose keyboard
+	 */
+	if( fd < 0 && (p->modeflags & M_SINGLE_TASK) )
+	{
+		DEBUG(("Fclose:return 0 for negative fd in singletask-mode."));
+		return 0;
+	}

 	r = GETFILEPTR (&p, &fd, &f);
 	if (r) return r;
--- k_exec.c	13 Jan 2010 17:13:49 -0000	1.44
+++ k_exec.c	2 Jun 2010 11:39:52 -0000
@@ -892,6 +892,15 @@

 	b = (BASEPAGE *) base->loc;

+	DEBUG(("create_process: p_flags=%lx", b->p_flags));
+
+	if ((b->p_flags & F_SINGLE_TASK) && (rootproc->modeflags & M_SINGLE_TASK))
+	{
+		DEBUG(("create_process(single-task):already in single-task-mode."));
+		r = EPERM;
+		goto leave;
+	}
+
 	if (stack)
 	{
 		stack += 256 + b->p_tlen + b->p_dlen + b->p_blen;
@@ -907,6 +916,18 @@
 	if (!p)
 		goto leave;

+	if (b->p_flags & F_SINGLE_TASK)
+	{
+		DEBUG(("create_process: setting M_SINGLE_TASK for %s", filename));
+		p->modeflags |= M_SINGLE_TASK;
+	}
+	if (b->p_flags & F_DONT_STOP)
+	{
+		DEBUG(("create_process: setting M_DONT_STOP for %s", filename));
+		p->modeflags |= M_DONT_STOP;
+	}
+	b->p_flags &= ~(F_SINGLE_TASK | F_DONT_STOP);
+
 	/* jr: add Pexec information to PROC struct */
 	strncpy(p->cmdlin, b->p_cmdlin, 128);

--- keyboard.c	23 May 2010 19:16:24 -0000	1.100
+++ keyboard.c	2 Jun 2010 11:39:52 -0000
@@ -915,7 +916,16 @@
 		scanb[scanb_tail].scan = scancode;
 		scanb_tail = tail;
 	}
-	if (!ikbd_to)
+
+	if( curproc->modeflags & M_SINGLE_TASK )
+	{
+# ifdef DEBUG_INFO
+		extern short in_kernel;
+		DEBUG(("ikbd_scan directly for '%s' head=%d p_flags=%lx slices=%d in_kernel=%x", curproc->name, scanb_head, curproc->p_mem->base->p_flags, curproc->slices, in_kernel ));
+# endif
+		IkbdScan( curproc, 1);
+	}
+	else if (!ikbd_to)
 	{
 		ikbd_to = addroottimeout(0L, (void _cdecl(*)(PROC *))IkbdScan, 1);
 	}
--- mint/mem.h	4 Jan 2010 22:22:11 -0000	1.18
+++ mint/mem.h	2 Jun 2010 11:39:52 -0000
@@ -108,6 +108,9 @@

 # define F_OS_SPECIAL	0x8000		/* mark as a special process */

+# define F_SINGLE_TASK	0x0010000		/* XaAES: if set (in p_flags) it's "single-task-mode" */
+# define F_DONT_STOP	0x0020000		/* XaAES: if set do not stop when entering single-task-mode */
+
 /* flags for curproc->memflags (that is, PRGFLAGS) and also Mxalloc mode.  */
 /* (Actually, when users call Mxalloc, they add 0x10 to what you see here) */
 # define F_PROTMODE	0xf0		/* protection mode bits */
--- mint/proc.h	13 Jan 2010 17:11:07 -0000	1.28
+++ mint/proc.h	2 Jun 2010 11:39:54 -0000
@@ -132,7 +132,10 @@
 	short	_euid;			/* unused */
 	short	_egid;			/* unused */

-	ushort	_memflags;		/* unused */
+# define M_SINGLE_TASK	0x0001		/* XaAES: if set (in modeflags) it's "single-task-mode" */
+# define M_DONT_STOP	0x0002		/* XaAES: if set do not stop when entering single-task-mode */
+	ushort	modeflags;
+
 	short	pri;			/**< base process priority 	*/
 	short	wait_q;			/**< current process queue	*/


------MIME delimiter for sendEmail-654316.66800669--


