svn commit: r334037 - head/sys/arm/arm

Andrew Turner andrew at FreeBSD.org
Tue May 22 13:21:45 UTC 2018


Author: andrew
Date: Tue May 22 13:21:44 2018
New Revision: 334037
URL: https://svnweb.freebsd.org/changeset/base/334037

Log:
  Only set realmem based on memory where the EXFLAG_NOALLOC is unset. This
  will allow us to query the maps at any time without disturbing this value.
  
  Obtained from:	ABT Systems Ltd
  Sponsored by:	Turing Robotic Industries

Modified:
  head/sys/arm/arm/physmem.c

Modified: head/sys/arm/arm/physmem.c
==============================================================================
--- head/sys/arm/arm/physmem.c	Tue May 22 11:57:10 2018	(r334036)
+++ head/sys/arm/arm/physmem.c	Tue May 22 13:21:44 2018	(r334037)
@@ -168,20 +168,21 @@ arm_physmem_print_tables(void)
  * Returns the number of pages of non-excluded memory added to the avail list.
  */
 static size_t
-regions_to_avail(vm_paddr_t *avail, uint32_t exflags, long *pavail)
+regions_to_avail(vm_paddr_t *avail, uint32_t exflags, long *pavail,
+    long *prealmem)
 {
 	size_t acnt, exi, hwi;
 	uint64_t end, start, xend, xstart;
-	long availmem;
+	long availmem, totalmem;
 	const struct region *exp, *hwp;
 
-	realmem = 0;
+	totalmem = 0;
 	availmem = 0;
 	acnt = 0;
 	for (hwi = 0, hwp = hwregions; hwi < hwcnt; ++hwi, ++hwp) {
 		start = hwp->addr;
 		end   = hwp->size + start;
-		realmem += pm_btop((vm_offset_t)(end - start));
+		totalmem += pm_btop((vm_offset_t)(end - start));
 		for (exi = 0, exp = exregions; exi < excnt; ++exi, ++exp) {
 			/*
 			 * If the excluded region does not match given flags,
@@ -261,8 +262,10 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, 
 			panic("Not enough space in the dump/phys_avail arrays");
 	}
 
-	if (pavail)
+	if (pavail != NULL)
 		*pavail = availmem;
+	if (prealmem != NULL)
+		*prealmem = realmem;
 	return (acnt);
 }
 
@@ -386,8 +389,9 @@ arm_physmem_init_kernel_globals(void)
 {
 	size_t nextidx;
 
-	regions_to_avail(dump_avail, EXFLAG_NODUMP, NULL);
-	nextidx = regions_to_avail(phys_avail, EXFLAG_NOALLOC, &physmem);
+	regions_to_avail(dump_avail, EXFLAG_NODUMP, NULL, NULL);
+	nextidx = regions_to_avail(phys_avail, EXFLAG_NOALLOC, &physmem,
+	    &realmem);
 	if (nextidx == 0)
 		panic("No memory entries in phys_avail");
 	Maxmem = atop(phys_avail[nextidx - 1]);


More information about the svn-src-all mailing list