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

Re: [MiNT] FreeMiNT 1.18 release coming up.



On 04/03/2013 11:00, Vincent Rivière wrote:
A compromise would be to set the workstation flag in FreeMiNT just before
running the GEM=ROM code. It would assume that if GEM=ROM, then the
workstation will already be opened when xaaes.km is loaded. This is similar
to Alan's first proposition. No the best, but it should work in all cases.

Here is a rough proposition (please don't commit).

Basically, it adds support for the following:

if (s_system(S_GEMROM, 0, 0))
{
	// GEM=ROM was executed
	...
}

The kernel stuff is clean, it was very simple.

Then in xaaes.km I don't know what to do precisely.
It seems that C.P_handle is the VDI handle used by the underlying AES, if the physical workstation was already opened. It was got from mt_appl_init() and mt_graf_handle(). Otherwise, it is retrieved from v_opnwk().

On the other side, v->handle is the handle of the VDI virtual workstation.

While detecting if GEM=ROM was called is enough to determine if the physical workstation needs to be opened or not, it is not enough to know the VDI handle of the physical workstation (used by the AES). If that handle is strictly required, then we will have no choice than retrieving it from user mode in xaloader.prg.

Anyway, the xaaes.km part of this patch will have to be properly fixed.

--
Vincent Rivière
diff -x CVS -aurN freemint-1.18.orig/sys/global.c freemint-1.18/sys/global.c
--- freemint-1.18.orig/sys/global.c	2013-02-08 00:18:13.062500000 +0100
+++ freemint-1.18/sys/global.c	2013-03-06 21:33:04.140625000 +0100
@@ -73,3 +73,6 @@
  * vectors from userspace accesses
  */
 short protect_page0 = 0;
+
+/* Flag to determine if GEM=ROM has been executed */
+short gem_rom = 0;
diff -x CVS -aurN freemint-1.18.orig/sys/global.h freemint-1.18/sys/global.h
--- freemint-1.18.orig/sys/global.h	2013-02-08 00:18:13.062500000 +0100
+++ freemint-1.18/sys/global.h	2013-03-06 21:45:01.328125000 +0100
@@ -88,6 +88,7 @@
 extern short FalconVideo;
 extern short ste_video;
 extern short protect_page0;
+extern short gem_rom;
 
 # endif
 
diff -x CVS -aurN freemint-1.18.orig/sys/init.c freemint-1.18/sys/init.c
--- freemint-1.18.orig/sys/init.c	2013-02-08 18:00:36.250000000 +0100
+++ freemint-1.18/sys/init.c	2013-03-06 21:33:50.796875000 +0100
@@ -1144,6 +1144,8 @@
 				bp = (BASEPAGE *) sys_pexec(7, (char *) GEM_memflags, (char *) "\0", _base->p_env);
 				bp->p_tbase = entry;
 
+				gem_rom = 1; /* XaAES will check that */
+
 				r = sys_pexec(106, (char *) "GEM", bp, 0L);
 				DEBUG(("%s(): exec ROM AES returned %ld", __FUNCTION__, r));
 	  	}
diff -x CVS -aurN freemint-1.18.orig/sys/mint/ssystem.h freemint-1.18/sys/mint/ssystem.h
--- freemint-1.18.orig/sys/mint/ssystem.h	2013-02-08 00:18:13.593750000 +0100
+++ freemint-1.18/sys/mint/ssystem.h	2013-03-06 21:28:25.234375000 +0100
@@ -49,6 +49,7 @@
 # define S_CVERSION	911	/* compiler version - arg1 pointer to a buffer of arg2 len */
 # define S_CDEFINES	912	/* compiler definitions - arg1 pointer to a buffer of arg2 len */
 # define S_COPTIM	913	/* compiler flags - arg1 pointer to a buffer of arg2 len */
+# define S_GEMROM	914	/* 1 if GEM=ROM has been executed, otherwise 0 */
 
 /* debug section
  * reserved 1000 - 1999
diff -x CVS -aurN freemint-1.18.orig/sys/ssystem.c freemint-1.18/sys/ssystem.c
--- freemint-1.18.orig/sys/ssystem.c	2013-02-08 00:18:15.015625000 +0100
+++ freemint-1.18/sys/ssystem.c	2013-03-06 21:34:05.671875000 +0100
@@ -630,6 +630,11 @@
 			strncpy_f ((char *) arg1, COMPILER_OPTS, arg2);
 			break;
 		}
+		case S_GEMROM:
+		{
+			r = gem_rom;
+			break;
+		}
 
 		/* debug section
 		 */
diff -x CVS -aurN freemint-1.18.orig/xaaes/src.km/k_main.c freemint-1.18/xaaes/src.km/k_main.c
--- freemint-1.18.orig/xaaes/src.km/k_main.c	2013-02-23 14:43:56.717875000 +0100
+++ freemint-1.18/xaaes/src.km/k_main.c	2013-03-06 22:03:55.828125000 +0100
@@ -1719,13 +1719,10 @@
 		}
 	}
 #endif
+	/* If GEM=ROM, intialize the underlying AES */
+	if (s_system(S_GEMROM, 0, 0))
 	{
-	short x;
-	if( mt_appl_init(my_global_aes) != -1 )
-	{
-		C.P_handle = mt_graf_handle( &x, &x, &x, &x, my_global_aes );
-	}
-	else mt_appl_exit(my_global_aes);
+		C.P_handle = 1;
 	}
 	BLOG((0,"apid=%d,P_handle=%d", my_global_aes[2], C.P_handle));
 
@@ -2106,11 +2103,6 @@
 // 		G.adi_mouse = NULL;
 	}
 
-	if( my_global_aes[2] != -1 )
-	{
-		mt_appl_exit(my_global_aes);
-	}
-
 	/*
 	 * close profile
 	 */