Page MenuHomeFreeBSD

D32873.id98140.diff
No OneTemporary

D32873.id98140.diff

Index: sys/kern/subr_physmem.c
===================================================================
--- sys/kern/subr_physmem.c
+++ sys/kern/subr_physmem.c
@@ -63,9 +63,14 @@
#endif
#if defined(__arm__)
+/*
+ * arm's MAX_PHYS_ADDR is defined to be just below KERNBASE, which isn't quite
+ * what we want. What we really want isn't established until a little later in
+ * the boot process, so we fudge it here.
+ */
#define MAX_PHYS_ADDR 0xFFFFFFFFull
-#elif defined(__aarch64__) || defined(__riscv)
-#define MAX_PHYS_ADDR 0xFFFFFFFFFFFFFFFFull
+#else
+#define MAX_PHYS_ADDR VM_MAX_ADDRESS
#endif
struct region {
@@ -166,8 +171,9 @@
availsz = 0;
acnt = 0;
for (hwi = 0, hwp = hwregions; hwi < hwcnt; ++hwi, ++hwp) {
- start = hwp->addr;
- end = hwp->size + start;
+ /* Operate on page boundaries. Partial pages aren't usable. */
+ start = round_page(hwp->addr);
+ end = trunc_page(hwp->size + start);
totalmem += atop((vm_offset_t)(end - start));
for (exi = 0, exp = exregions; exi < excnt; ++exi, ++exp) {
/*
@@ -176,8 +182,9 @@
*/
if ((exp->flags & exflags) == 0)
continue;
- xstart = exp->addr;
- xend = exp->size + xstart;
+ /* Whole page is excluded. */
+ xstart = trunc_page(exp->addr);
+ xend = round_page(exp->size + xstart);
/*
* If the excluded region ends before this hw region,
* continue checking with the next excluded region.

File Metadata

Mime Type
text/plain
Expires
Mon, Apr 20, 2:34 PM (15 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31845718
Default Alt Text
D32873.id98140.diff (1 KB)

Event Timeline