[kernel] Expose a sysconf page to userspace

A structure, system_config, which is dynamically defined by the
definitions/sysconf.yaml config, is now mapped into every user address
space. The kernel fills this with information about itself and the
running machine.

User programs access this through the new j6_sysconf fake syscall in
libj6.

See: Github bug #242
See: [frobozz blog post](https://jsix.dev/posts/frobozz/)

Tags:
This commit is contained in:
Justin C. Miller
2022-01-13 22:08:35 -08:00
parent 939022bb5e
commit b3aaddadc8
11 changed files with 250 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
#include "objects/process.h"
#include "objects/thread.h"
#include "objects/vm_area.h"
#include "sysconf.h"
#include "vm_space.h"
// The initial memory for the array of areas for the kernel space
@@ -46,6 +47,14 @@ vm_space::vm_space() :
memset(m_pml4, 0, mem::frame_size/2);
for (unsigned i = arch::kernel_root_index; i < arch::table_entries; ++i)
m_pml4->entries[i] = kpml4->entries[i];
// Every vm space has sysconf in it
vm_area *sysc = new vm_area_fixed(
g_sysconf_phys,
sizeof(system_config),
vm_flags::none);
add(sysconf_user_address, sysc);
}
vm_space::~vm_space()