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

[MiNT] patch:MiNT:single-task



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

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


--- 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	*/