News for hackers. Stuff that matters.

Ask HN: How does an OS become aware of memory layout?

I have been learning about Operating Systems the past few months through MIT's XV6 book (RISC-V edition).

One thing that isn't made very clear is how computers in the real world "know" the memory layout for memory mapped i/o (like, which addresses map to which devices in the physical address space).

I have a couple of questions: 1. Whose responsibility is it to define the memory layout (is it the ISA's? The MMU's?) 2. Do kernels know beforehand the layout? Or is it more common for them to discover at runtime?

Thanks

( 2 comments | on HN )
Re:Ask HN: How does an OS become aware of memory layout? by PaulHoule on Wednesday January 25, 2023 @09:29AM (#34518624)
PCs enumerate hardware with

https://en.wikipedia.org/wiki/ACPI

In that process the OS figures out the attached hardware and how to access it.

Re:Ask HN: How does an OS become aware of memory layout? by snvzz on Wednesday January 25, 2023 @06:59PM (#34525984)
RISC-V does majorly use the Device Tree[0].

[0] https://en.wikipedia.org/wiki/Devicetree