diff options
author | Warner Losh <imp@FreeBSD.org> | 2023-03-02 17:31:05 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2023-03-02 18:12:09 +0000 |
commit | 6c47abb63bd55db0f5234ed1c3c107a103e6fb85 (patch) | |
tree | d2663750d6685da049352564e95dba1b197fc782 | |
parent | de1a17db89630f0e2b42739093d7c0f2463d6c09 (diff) | |
download | src-6c47abb63bd55db0f5234ed1c3c107a103e6fb85.tar.gz src-6c47abb63bd55db0f5234ed1c3c107a103e6fb85.zip |
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
-rw-r--r-- | stand/kboot/main.c | 5 | ||||
-rw-r--r-- | stand/kboot/seg.c | 3 |
2 files changed, 8 insertions, 0 deletions
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; } |