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

Re: Bug report. MiNT 1.07.



>>>>> Stephen Usher <steve@earth.ox.ac.uk> writes:
|>  (2) When MiNT is rebooted after successfully exiting, system soft-crashes.

|>  When MiNT is restarted after it has exited the following happens:-

|>  In TT-Med or TT-Low resolution bottom couple of lines of screen are
|>  corrupted. Programs which are then run under MiNT die with access violations
|>  if they run in ST-RAM. Sometimes the whole machine freezes.

|>  In other resolutions (ie standard ST resolutions) the screen memory isn't
|>  corrupted but the system dies as above.

I had similar problems, and i tracked it down to the following:

When the screen is set up, it is moved to a 8K boundary, which is
usually less than the initial address. This must be undone when mint
exits, otherwise it overlaps with free memory.

--- orig/debug.c	Tue Aug 17 21:23:20 1993
+++ debug.c	Tue Aug 17 21:30:52 1993
@@ -564,6 +564,7 @@
 			close_filesys();
 			if (!no_mem_prot)
 				restr_mmu();
+			restr_screen ();
 			(void)Super((void *)tosssp);	/* gratuitous (void *) for Lattice */
 #ifdef PROFILING
 			_exit(0);
--- orig/main.c	Fri Aug  6 17:58:20 1993
+++ main.c	Fri Aug 13 21:00:40 1993
@@ -916,6 +916,7 @@
 	close_filesys();
 	if (!no_mem_prot)
 		restr_mmu();
+	restr_screen ();
 
 	(void)Super((void *)tosssp);	/* gratuitous (void *) for Lattice */
 	Cconws("leaving MiNT\r\n");
--- orig/mem.c	Tue Aug 17 21:23:24 1993
+++ mem.c	Tue Aug 17 22:02:26 1993
@@ -111,6 +111,33 @@
 	}
 }
 
+void
+restr_screen ()
+{
+  long base = (long) Physbase ();
+  MEMREGION *r;
+
+  if (base != scrnplace)
+    {
+      for (r = *core; r; r = r->next)
+	{
+	  if (ISFREE (r) && r->len >= scrnsize)
+	    break;
+	}
+      if (r)
+	{
+	  quickmove ((char *) r->loc, (char *) base, scrnsize);
+	  Setscreen ((void *) r->loc, (void *) r->loc, -1);
+	  Vsync ();
+	  quickmove ((char *) scrnplace, (char *) r->loc, scrnsize);
+	}
+      else
+	quickmove ((char *) scrnplace, (char *) base, scrnsize);
+      Setscreen ((void *) scrnplace, (void *) scrnplace, -1);
+      Cconws ("\r\n"); 
+    }
+}
+
 /*
  * init_core(): initialize the core memory map (normal ST ram) and also
  * the alternate memory map (fast ram on the TT)