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:
28
src/kernel/sysconf.h.cog
Normal file
28
src/kernel/sysconf.h.cog
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
// vim: ft=cpp
|
||||
|
||||
/// \file sysconf.h
|
||||
/// Kernel-side implementation of sysconf struct
|
||||
|
||||
/*[[[cog code generation
|
||||
from os.path import join
|
||||
from sysconf import Sysconf
|
||||
sc = Sysconf(join(definitions_path, "sysconf.yaml"))
|
||||
|
||||
cog.outl(f"constexpr uintptr_t sysconf_user_address = {sc.address:#x};")
|
||||
]]]*/
|
||||
///[[[end]]]
|
||||
|
||||
struct system_config
|
||||
{
|
||||
/*[[[cog code generation
|
||||
for var in sc.vars:
|
||||
cog.outl(f"{var.type:10} {var.section}_{var.name};")
|
||||
]]]*/
|
||||
///[[[end]]]
|
||||
};
|
||||
|
||||
extern system_config *g_sysconf;
|
||||
extern uintptr_t g_sysconf_phys;
|
||||
|
||||
void sysconf_create();
|
||||
Reference in New Issue
Block a user