The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6c47abb63bd55db0f5234ed1c3c107a103e6fb85

commit 6c47abb63bd55db0f5234ed1c3c107a103e6fb85
Author:     Warner Losh <[email protected]>
AuthorDate: 2023-03-02 17:31:05 +0000
Commit:     Warner Losh <[email protected]>
CommitDate: 2023-03-02 18:12:09 +0000

    kboot: Hack for running on FreeBSD host
    
    When we're running on a FreeBSD host, we can't open /proc/iomem.  So,
    for now, just assume that we have 32GB of ram starting at 4GB.
    
    Sponsored by: Netflix
---
 stand/kboot/main.c | 5 +++++
 stand/kboot/seg.c  | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/stand/kboot/main.c b/stand/kboot/main.c
index f81d7b2cead4..1cc4c0531772 100644
--- a/stand/kboot/main.c
+++ b/stand/kboot/main.c
@@ -86,6 +86,11 @@ memory_limits(void)
                                committed_as <<= 10; /* Units are kB */
                        }
                }
+       } else {
+               /* Otherwise, on FreeBSD host, for testing 32GB host: */
+               mem_avail = 31ul << 30;                 /* 31GB free */
+               commit_limit = mem_avail * 9 / 10;      /* 90% comittable */
+               committed_as = 20ul << 20;              /* 20MB used */
        }
        printf("Commit limit: %lld Committed bytes %lld Available %lld\n",
            (long long)commit_limit, (long long)committed_as,
diff --git a/stand/kboot/seg.c b/stand/kboot/seg.c
index 947aa0a2a7a3..4da53e2bc75d 100644
--- a/stand/kboot/seg.c
+++ b/stand/kboot/seg.c
@@ -286,6 +286,9 @@ populate_avail_from_iomem(void)
        fd = open("host:/proc/iomem", O_RDONLY);
        if (fd == -1) {
                printf("Can't get memory map\n");
+               init_avail();
+               // Hack: 32G of RAM starting at 4G
+               add_avail(4ull << 30, 36ull << 30, system_ram);
                return false;
        }
 

Reply via email to