More than 1G of loader-visible RAM?

Lytochkin Boris lytboris at gmail.com
Sat Jul 11 21:32:21 UTC 2020


Hi.

I am trying to make a patch that gives loader ability to bring whole
partitions as preload md(4) items. While this could sound a bit crazy, it
allows making an easy to get "diskless" routers: root partition is 2Gb
stored on HDD and I have 4Gb of RAM loader can get root partition into
memory and kernel will use it as a root partition. Once OS is up and
running, HDD can be set to sleep mode (via /etc/rc.local or similar)

Currently I do the same thing via init_script that detects boot partition,
run mdconfig and dd. Delegating this job to loader will make this setup
much more straightforward.

Currently my patch for loader can copy partitions up to ~1G and it seems
this is a limitation in stand/i386/libi386/elf64_freebsd.c:
====
    /*
     * This is kinda brutal, but every single 1GB VM memory segment points
to
     * the same first 1GB of physical memory.  But it is more than adequate.
     */
    for (i = 0; i < 512; i++) {
...
====
Comment comes from 2003 which was quite adequate back then. I am not that
fluent in real memory programming thus I write this email seeking a hint if
this 1Gb RAM limitation can be altered allowing more memory to be used by
loader that will be functional.

-- 
Boris Lytochkin


More information about the freebsd-amd64 mailing list