[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[MiNT] patch:MiNT:single-task
This is the second (and probably last) patch for the kernel.
----------------------------------------------------
add support for single-task-mode for XaAES
----------------------------------------------------
--- dosfile.c 2010-01-13 18:13:49.000000000 +0100
+++ dosfile.c 2010-05-02 12:21:22.000000000 +0200
@@ -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 2010-01-13 18:13:49.000000000 +0100
+++ k_exec.c 2010-05-08 22:10:59.125000000 +0200
@@ -892,6 +894,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 +918,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 2010-05-31 23:49:36.830137000 +0200
+++ /home/hk/freemint/sys/keyboard.c 2010-05-31 23:46:48.986387000 +0200
@@ -397,6 +401,7 @@
}
}
+
# ifndef MILAN
static void put_key_into_buf(IOREC_T *iorec, uchar c0, uchar c1, uchar c2, uchar c3);
static void
@@ -915,7 +920,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);
}
@@ -1143,6 +1157,7 @@
kbdclick(scan);
}
+
continue;
}
}
--- mint/proc.h 2010-01-13 18:11:07.000000000 +0100
+++ /home/hk/freemint/sys/mint/proc.h 2010-05-02 12:21:23.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * $Id: proc.h,v 1.28 2010/01/13 17:11:07 alanh Exp $
+ * $Id: proc.h,v 1.27.2.2 2010/05/02 10:21:23 hek Exp $
*
* This file has been modified as part of the FreeMiNT project. See
* the file Changes.MH for details and dates.
@@ -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 0x00002 /* XaAES: if set do not stop when entering single-task-mode */
+ ushort modeflags;
+
short pri; /**< base process priority */
short wait_q; /**< current process queue */
--- mint/mem.h 2010-01-04 23:22:11.000000000 +0100
+++ mint/mem.h 2010-05-02 12:32:15.000000000 +0200
@@ -108,6 +110,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 */