> >> >
> >> > I'm trying to figure out the physical memory used by the kernel. This is
> >> > for riscv if it matters.
> >>

Starting from the ram region defined by the device tree, I recall the
following happens for RISC-V:
- Some memory is subtracted from the start for the SBI program which I
think is 2MiB for both RV32 and RV64. This might be where most of your
memory is being lost to.  There's an unmerged PR for making this value
configurable in the platform device tree:
https://github.com/seL4/seL4/pull/759
- memory used by the kernel is for code + data and should be just what
is reported by the ELF segment headers.
- During boot the kernel does allocate memory dynamically but this
should be only for the rootserver and should entirely happen in the
function create_rootserver_objects()
- The remaining memory is handed to the rootserver as untypeds.  The
kernel also frees code and data that was only required during startup
and releases that as untypeds too. These untypeds can be inspected in
the boot info.

What I've done in the past is to print out the untyped list and then
audited how it corresponds to the memory usage rules listed above.


> >
> > I don't suppose there's some kernel variable I can print that will help
> > answer my q?
> >

The untypeds handled to user level is the kernel's record of memory
available for allocation. During boot time,
calculate_rootserver_size() can be called to return the amount of
memory the kernel dynamically allocates for the root_server, and
during boot the range of memory used is kept in the global: region_t
rootserver_mem, but would be freed once the kernel jumps to user
level.  The kernel should already print the ranges of memory it is
given to use at the start of boot.
Kent.
_______________________________________________
Devel mailing list -- devel@sel4.systems
To unsubscribe send an email to devel-leave@sel4.systems

Reply via email to