modules
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
menu "Kernel Core options"
|
||||
|
||||
source "core/mem/Kconfig"
|
||||
|
||||
choice SCHED_ALG
|
||||
prompt "Scheduler algorithm"
|
||||
default SCHED_DUMB
|
||||
help
|
||||
The algorithm to use for scheduling.
|
||||
|
||||
config SCHED_DUMB
|
||||
bool "Dumb Scheduler"
|
||||
help
|
||||
Very basic scheduler, without any priorities.
|
||||
|
||||
endchoice
|
||||
|
||||
endmenu
|
||||
@@ -0,0 +1,8 @@
|
||||
menu "Memory Management options"
|
||||
|
||||
config HAVE_MMU
|
||||
bool
|
||||
config HAVE_MMU_GENERIC
|
||||
bool
|
||||
|
||||
endmenu
|
||||
@@ -1,7 +1,6 @@
|
||||
kernel_sources += files(
|
||||
'fault.c',
|
||||
'init.c',
|
||||
'pmap.c',
|
||||
'pmm.c',
|
||||
'slab.c',
|
||||
'usercopy.c',
|
||||
@@ -9,3 +8,9 @@ kernel_sources += files(
|
||||
'vma.c',
|
||||
'vmo.c',
|
||||
)
|
||||
|
||||
if kconfig.get('CONFIG_HAVE_MMU', 'n') == 'y'
|
||||
kernel_sources += files(
|
||||
'pmap.c',
|
||||
)
|
||||
endif
|
||||
|
||||
@@ -3,8 +3,12 @@
|
||||
#include <zinnia/pmap.h>
|
||||
#include <zinnia/spin.h>
|
||||
#include <zinnia/vma.h>
|
||||
#include <config.h>
|
||||
#include <string.h>
|
||||
|
||||
// TODO: For now, we assume that we can do generic PTE lookups on every arch that has a MMU.
|
||||
static_assert(CONFIG_HAVE_MMU_GENERIC);
|
||||
|
||||
errno_t pmap_new_kernel(struct pmap* pt, enum alloc_flags flags) {
|
||||
flags &= ~ALLOC_NOZERO;
|
||||
|
||||
|
||||
+12
-3
@@ -3,13 +3,22 @@
|
||||
#include <arch/usercopy.h>
|
||||
|
||||
bool usercopy_read(void* dst, const __user void* src, size_t len) {
|
||||
return arch_usercopy_read(dst, src, len, &percpu_get()->sched.current->usercopy_region);
|
||||
arch_usercopy_allow(true);
|
||||
bool success = arch_usercopy_read(dst, src, len, &percpu_get()->sched.current->usercopy_region);
|
||||
arch_usercopy_allow(false);
|
||||
return success;
|
||||
}
|
||||
|
||||
bool usercopy_write(__user void* dst, const void* src, size_t len) {
|
||||
return arch_usercopy_write(dst, src, len, &percpu_get()->sched.current->usercopy_region);
|
||||
arch_usercopy_allow(true);
|
||||
bool success = arch_usercopy_write(dst, src, len, &percpu_get()->sched.current->usercopy_region);
|
||||
arch_usercopy_allow(false);
|
||||
return success;
|
||||
}
|
||||
|
||||
bool usercopy_strlen(const __user char* str, size_t max, size_t* len) {
|
||||
return arch_usercopy_strlen(str, max, len, &percpu_get()->sched.current->usercopy_region);
|
||||
arch_usercopy_allow(true);
|
||||
bool success = arch_usercopy_strlen(str, max, len, &percpu_get()->sched.current->usercopy_region);
|
||||
arch_usercopy_allow(false);
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
kernel_sources += files(
|
||||
'core.c',
|
||||
'sched_dumb.c',
|
||||
)
|
||||
|
||||
if kconfig.get('CONFIG_SCHED_DUMB', 'n') == 'y'
|
||||
kernel_sources += files('sched_dumb.c')
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user