diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-07-09 17:35:56 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-07-09 17:35:56 +0300 |
| commit | 298636079d912d0936f8156a609fe74b839c547b (patch) | |
| tree | e0c22ce0e7b7c8a29e3937616076e8fb327fde8b /src/uapi/conf.c | |
| parent | e134202611a50b358c147c92bfb8a7f443030b8b (diff) | |
| download | kmi-298636079d912d0936f8156a609fe74b839c547b.tar.gz kmi-298636079d912d0936f8156a609fe74b839c547b.zip | |
allow mapping null page
+ User has to 'free' the 0 page before it becomes accessible to mapping.
Probably worth noting that this is likely VERY niche and mainly
concerns stuff like certain kinds of emulators that I'm still
eons from implementing, but still.
Unbacked pages can also be useful for some kinds of notifications,
like 'if someone writes to this page, please report it to me with this
ID' or whatever, I remember seeing some discussion about it somewhere
but that's also not really relevant for the moment.
Most significantly, at least with the current design,
after the null page is freed it becomes available for use to regular req_mem()
calls, so users should probably using locks around memory requests.
That's probably a good idea anyway as internally the kernal has to
lock the virtual memory, and without a scheduler it might cause
threads to spin for a while in the kernel which is rather bad.
Diffstat (limited to 'src/uapi/conf.c')
| -rw-r--r-- | src/uapi/conf.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/uapi/conf.c b/src/uapi/conf.c index 3a45d30..c8ec964 100644 --- a/src/uapi/conf.c +++ b/src/uapi/conf.c @@ -42,9 +42,10 @@ size_t rpc_stack_size() * * @param t Current tcb. * @param param Parameter to read. + * @param d0 Optional data argument for parameter. * @return \ref OK and parameter value. */ -SYSCALL_DEFINE1(conf_get)(struct tcb *t, sys_arg_t param) +SYSCALL_DEFINE2(conf_get)(struct tcb *t, sys_arg_t param, sys_arg_t d0) { /* anyone can read any current parameter, I don't think they should be * hidden. */ @@ -66,6 +67,15 @@ SYSCALL_DEFINE1(conf_get)(struct tcb *t, sys_arg_t param) val = get_ram_size(); break; + case CONF_PAGE_SIZE: + if (d0 < 0 || d0 > max_order()) { + val = 0; + break; + } + + val = order_size(d0); + break; + default: return_args1(t, ERR_NF); } |
