mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user