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

Re: [MiNT] FreeMiNT for ColdFire



On 20/03/2011 21:55, Vincent Rivière wrote:
Finally, I have reviewed some ColdFire patches for FreeMiNT which have been
sleeping on my hard disk for a few months.

And 10 months later, the last patch (almost).

This time I have totally removed the COLDFIRE define.
mintv4e.prg now behaves exactly like the other kernels (except MMU support).

I have removed Bconmap() support, as both EmuTOS (all machines) and FireTOS have trouble with it. Support will come later, after the release. Currently, this is quite useless, anyway.

I still have to add FPU support in context switch, that will be easy and come very soon.

Please commit!

coldfire.patch
Removed the COLDFIRE define. Contributed by Vincent Riviere.

--
Vincent Rivière
diff -x CVS -aurN freemint.orig/sys/KERNELDEFS freemint/sys/KERNELDEFS
--- freemint.orig/sys/KERNELDEFS	2012-03-11 22:02:09.890625000 +0100
+++ freemint/sys/KERNELDEFS	2013-01-29 00:15:53.187500000 +0100
@@ -18,7 +18,6 @@
 # -DM68060		build for 68060
 # -DMILAN		build Milan kernel
 # -DARANYM		build Aranym kernel
-# -DCOLDFIRE		build coldfire kernel
 
 #
 # debug flags
@@ -99,7 +98,7 @@
 ifeq ($(kernel),col)
 MINT = mintv4e.prg
 CPU  = v4e
-KERNELDEFS = -DM68040 -DNO_FAKE_SUPER -DCOLDFIRE -DC_ONLY
+KERNELDEFS = -DM68040 -DNO_FAKE_SUPER -DC_ONLY
 kernel_nocflags = -DWITH_MMU_SUPPORT
 endif
 
diff -x CVS -aurN freemint.orig/sys/arch/cpu.S freemint/sys/arch/cpu.S
--- freemint.orig/sys/arch/cpu.S	2012-09-26 22:17:13.421875000 +0200
+++ freemint/sys/arch/cpu.S	2013-01-29 00:13:44.984375000 +0100
@@ -703,7 +703,7 @@
 _cache060:
 	move.l	d0,d1			// If no bytes to push, exit
 	beq.s	_c060rts
-#ifndef COLDFIRE
+#ifndef __mcoldfire__
 	addq.l	#1,d1			// If was -1
 	beq.s	abc040			// then fulsh everything
 	move.l	a0,d1			// extract the position within the cacheline
@@ -775,7 +775,7 @@
 _cache060_i:
 	move.l	d0,d1			// If no bytes to push, exit
 	beq.s	_c060rtsi
-#ifndef COLDFIRE
+#ifndef __mcoldfire__
 	addq.l	#1,d1			// If was -1
 	beq.s	abc040i			// then fulsh everything
 	move.l	a0,d1			// extract the position within the cacheline
@@ -827,7 +827,7 @@
 	cmpi.l	#4,d0		// flushed all the ways?
 	bne.s	setloop
 	rts
-#endif /* COLDFIRE */
+#endif
 
 // ---------------------------------------------------
 
diff -x CVS -aurN freemint.orig/sys/biosfs.c freemint/sys/biosfs.c
--- freemint.orig/sys/biosfs.c	2012-04-11 22:58:19.593750000 +0200
+++ freemint/sys/biosfs.c	2013-01-25 00:22:16.125000000 +0100
@@ -175,7 +175,6 @@
 	 * are present on all machines (except for modem1, which does however
 	 * have a different device number on TTs and STs)
 	 */
-#ifndef COLDFIRE
 	{ "modem1",	&bios_tdevice,	 6,       O_TTY, &aux_tty, NULL},
 #ifndef MILAN/* these do not really work on Milan, so it is best to use the UART
 	   XDD instead of this // rincewind */
@@ -183,7 +182,6 @@
 	{ "serial1",	&bios_tdevice,	 8,       O_TTY, &ttmfp_tty, NULL},
 	{ "serial2",	&bios_tdevice,	 9,       O_TTY, &scca_tty, NULL},
 #endif
-#endif
 	{"", 0, 0, 0, 0, 0}
 };
 
diff -x CVS -aurN freemint.orig/sys/init.c freemint/sys/init.c
--- freemint.orig/sys/init.c	2013-01-13 21:33:56.718750000 +0100
+++ freemint/sys/init.c	2013-01-29 00:35:09.781250000 +0100
@@ -383,6 +383,8 @@
 			falcontos ? " (FalconTOS)" : "", (long)kbshft);
 # endif
 
+#ifndef __mcoldfire__
+	/* Currently, ColdFire machines have trouble with Bconmap() */
 	if (falcontos)
 	{
 		bconmap2 = (BCONMAP2_T *) TRAP_Bconmap (-2);
@@ -413,6 +415,7 @@
 		if (has_bconmap)
 			bconmap2 = (BCONMAP2_T *) TRAP_Bconmap (-2);
 	}
+#endif
 
 # ifdef VERBOSE_BOOT
 	boot_printf(MSG_init_bconmap, has_bconmap ? MSG_init_present : MSG_init_not_present);
@@ -553,7 +556,6 @@
 			f->links++;
 		}
 	}
-#ifndef COLDFIRE
 
 	r = FP_ALLOC(rootproc, &f);
 	if (r) FATAL("Can't allocate fp!");
@@ -607,8 +609,6 @@
 		f->pos = 1;	/* flag for close to --aux_cnt */
 	}
 
-#endif
-
 # ifdef BOOTSTRAPABLE
 	/* Bootstrapped kernel (executed directly by some loader) does
 	 * not have any drive access until the init_filesys() is called.
@@ -1212,7 +1212,6 @@
 	if (pid > 0)
 	{
 		do {
-# if !defined(COLDFIRE)
 			r = sys_pwaitpid(-1, 1, NULL);
 			if (r == 0)
 			{
@@ -1223,10 +1222,6 @@
 				 * else */
 					cpu_stop();	/* stop and wait for an interrupt */
 			}
-# else
-			r = sys_pwaitpid(-1, 0, NULL);
-			TRACE(("%s(): sys_pwaitpid() done -> %li (%li)", __FUNCTION__, r, ((r & 0xffff0000L) >> 16)));
-# endif
 		}
 		while (pid != ((r & 0xffff0000L) >> 16));
 	}
diff -x CVS -aurN freemint.orig/sys/mint/arch/asm_spl.h freemint/sys/mint/arch/asm_spl.h
--- freemint.orig/sys/mint/arch/asm_spl.h	2011-03-22 10:42:16.000000000 +0100
+++ freemint/sys/mint/arch/asm_spl.h	2013-01-29 00:22:57.218750000 +0100
@@ -34,17 +34,25 @@
 # ifndef _mint_m68k_asm_spl_h
 # define _mint_m68k_asm_spl_h
 
+# include "global.h"
+
 /* Called inside init.c */
 
 static inline void
 cpu_stop (void)
 {
-#ifndef COLDFIRE /* Currently buggy with FireTOS */
+#ifdef __mcoldfire__
+	if (coldfire_68k_emulation)
+	{
+		/* The stop instruction is currently buggy with FireTOS */
+		return;
+	}
+#endif
+
 	__asm__ volatile
 	(
 		"stop  #0x2000"
 	);
-#endif
 }
 
 static inline void
diff -x CVS -aurN freemint.orig/sys/time.c freemint/sys/time.c
--- freemint.orig/sys/time.c	2007-03-19 21:59:51.000000000 +0100
+++ freemint/sys/time.c	2013-01-28 23:56:24.500000000 +0100
@@ -366,11 +366,7 @@
 void
 init_time (void)
 {
-# ifdef COLDFIRE
-	long value = 0;
-# else
 	long value = _mfpregs->tbdr;
-# endif
 
 # if 0
 	/* See, a piece of code is a function, not just a long integer */
@@ -457,11 +453,7 @@
 			 * to care to much about overflows.
 			 */
 
-# ifdef COLDFIRE
-	timerc = 0;
-# else
 	timerc = _mfpregs->tbdr;
-# endif
 	current_ticks = *hz_200;
 
 	/* Make sure that the clock runs monotonic.  */