Subject: Re: README: Please give this a try!
To: Scott Reynolds <scottr@og.org>
From: Colin Wood <cwood@ichips.intel.com>
List: port-mac68k
Date: 05/20/1998 00:21:59
Scott-

Just to let you know, I timed the reboot on my IIci and Q700 (just the
amount of time that the screen is dark before the happy mac pops up):

	w/o patch	w/ patch
q700	   30s		   4s
IIci	   45s		   8s

so it's definitely quite a speedup.  Very nice :-)  BTW, below is the diff
against 1.3 for pmap_bootstrap.c (locore.s and machdep.c apply cleanly),
just in case anyone wants it.

Later.

-- 
Colin Wood                                 cwood@ichips.intel.com
Component Design Engineer - PMD                 Intel Corporation
-----------------------------------------------------------------
I speak only on my own behalf, not for my employer.




*** pmap_bootstrap.c.orig	Mon May 18 23:25:38 1998
--- pmap_bootstrap.c	Mon May 18 23:38:48 1998
***************
*** 64,70 ****
  extern st_entry_t *Sysseg;
  extern pt_entry_t *Sysptmap, *Sysmap;
  
! extern int maxmem, physmem;
  extern int avail_remaining, avail_range, avail_end;
  extern vm_offset_t avail_start, avail_next;
  extern vm_offset_t virtual_avail, virtual_end;
--- 64,70 ----
  extern st_entry_t *Sysseg;
  extern pt_entry_t *Sysptmap, *Sysmap;
  
! extern int physmem;
  extern int avail_remaining, avail_range, avail_end;
  extern vm_offset_t avail_start, avail_next;
  extern vm_offset_t virtual_avail, virtual_end;
***************
*** 78,86 ****
  /*
   * These are used to map the RAM:
   */
! int		numranges; /* = 0 == don't use the ranges */
  u_long	low[8];
  u_long	high[8];
  extern int		nbnumranges;
  extern u_long	nbphys[];
  extern u_long	nblog[];
--- 78,87 ----
  /*
   * These are used to map the RAM:
   */
! int	numranges;	/* = 0 == don't use the ranges */
  u_long	low[8];
  u_long	high[8];
+ u_long	maxaddr;	/* PA of the last physical page */
  extern int		nbnumranges;
  extern u_long	nbphys[];
  extern u_long	nblog[];
***************
*** 318,326 ****
  		*pte = lkptpa | PG_RW | PG_CI | PG_V;
  	}
  	/*
! 	 * Invalidate all but the final entry in the last kernel PT page
! 	 * (u-area PTEs will be validated later).  The final entry maps
! 	 * the last page of physical memory.
  	 */
  	pte = PA2VA(lkptpa, u_int *);
  	epte = &pte[NPTEPG-1];
--- 319,326 ----
  		*pte = lkptpa | PG_RW | PG_CI | PG_V;
  	}
  	/*
! 	 * Invalidate all entries in the last kernel PT page
! 	 * (u-area PTEs will be validated later).
  	 */
  	pte = PA2VA(lkptpa, u_int *);
  	epte = &pte[NPTEPG-1];
***************
*** 451,456 ****
--- 451,465 ----
  	/*
  	 * VM data structures are now initialized, set up data for
  	 * the pmap module.
+ 	 *
+ 	 * Note about avail_end: msgbuf is initialized just after
+ 	 * avail_end in machdep.c.  Since the last page is used
+ 	 * for rebooting the system (code is copied there and
+ 	 * excution continues from copied code before the MMU
+ 	 * is disabled), the msgbuf will get trounced between
+ 	 * reboots if it's placed in the last physical page.
+ 	 * To work around this, we move avail_end back one more
+ 	 * page so the msgbuf can be preserved.
  	 */
  	avail_next = avail_start = m68k_round_page(nextpa);
  	avail_remaining = 0;
***************
*** 464,471 ****
  		}
  	}
  	physmem = m68k_btop(avail_remaining + nextpa - firstpa);
! 	avail_remaining -= m68k_round_page(MSGBUFSIZE);
! 	high[numranges - 1] -= m68k_round_page(MSGBUFSIZE);
  
  	/* XXX -- this doesn't look correct to me. */
  	while (high[numranges - 1] < low[numranges - 1]) {
--- 473,481 ----
  		}
  	}
  	physmem = m68k_btop(avail_remaining + nextpa - firstpa);
! 	maxaddr = high[numranges - 1] - m68k_ptob(1);
! 	avail_remaining -= (m68k_round_page(MSGBUFSIZE) + m68k_ptob(1));
! 	high[numranges - 1] -= (m68k_round_page(MSGBUFSIZE) + m68k_ptob(1));
  
  	/* XXX -- this doesn't look correct to me. */
  	while (high[numranges - 1] < low[numranges - 1]) {