From 26b68c108664cb54089613bdbc54624ed66f7fda Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sun, 7 Dec 2014 11:24:06 +0100 Subject: Make L0 thread-safe (mostly). --- kernel/include/paging.h | 6 ++++++ kernel/include/region.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'kernel/include') diff --git a/kernel/include/paging.h b/kernel/include/paging.h index 720d6b3..44014a2 100644 --- a/kernel/include/paging.h +++ b/kernel/include/paging.h @@ -19,6 +19,12 @@ uint32_t pd_get_frame(void* vaddr); // get physical frame for virtual address int pd_map_page(void* vaddr, uint32_t frame_id, bool rw); // returns nonzero on error void pd_unmap_page(void* vaddr); // does nothing if page not mapped +// Note on concurrency : we expect that multiple threads will not try to map/unmap +// pages in the same region at the same time. It can nevertheless happen that +// several threads try to map pages that belong to the same 4M-section, and in that +// case both might require the allocation of a new PT at the same location. These +// cases are well-handled (the pagedir_t type contains a mutex used for this) + pagedir_t *create_pagedir(); // returns zero on error void delete_pagedir(pagedir_t *pd); diff --git a/kernel/include/region.h b/kernel/include/region.h index 5f44626..ac68047 100644 --- a/kernel/include/region.h +++ b/kernel/include/region.h @@ -2,6 +2,8 @@ // Kernel virtual memory region allocator +// This is entirely thread-safe + #include #include -- cgit v1.2.3