summaryrefslogtreecommitdiffstats
path: root/src/include/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/kernel')
-rw-r--r--src/include/kernel/basesegment.H28
-rw-r--r--src/include/kernel/syscalls.H5
-rw-r--r--src/include/kernel/vmmmgr.H16
3 files changed, 48 insertions, 1 deletions
diff --git a/src/include/kernel/basesegment.H b/src/include/kernel/basesegment.H
index 72869d535..da262c2a0 100644
--- a/src/include/kernel/basesegment.H
+++ b/src/include/kernel/basesegment.H
@@ -27,6 +27,7 @@
#define __KERNEL_BASESEGMENT_H
#include <kernel/segment.H>
+//#include <kernel/vmmmgr.H>
// Forward declaration.
class MessageQueue;
@@ -93,6 +94,19 @@ class BaseSegment : public Segment
*/
virtual uint64_t findPhysicalAddress(uint64_t i_vaddr) const;
+ /**
+ * @brief Sets the page permissions for a given virtual address and size.
+ * @param i_va[in] - virtual address of the page(s) to set permissions
+ * @param i_size[in] - range of memory that needs permissions updated...
+ * if i_size equals 0 then we only need to update an
+ * individual page.
+ * @param i_access_type[in] - type of permission to set
+ * @return int - 0 for successful block allocation, non-zero otherwise
+ */
+ static int mmSetPermission(void* i_va,
+ uint64_t i_size,
+ PAGE_PERMISSIONS i_access_type);
+
private:
/**
* @brief Internal implementation of init function.
@@ -114,6 +128,20 @@ class BaseSegment : public Segment
*/
int _mmAllocBlock(MessageQueue* i_mq,void* i_va,uint64_t i_size);
+ /**
+ * @brief Sets the page permissions for a given virtual address and size.
+ * @param i_va[in] - virtual address of the page(s) to set permissions
+ * @param i_size[in] - range of memory that needs permissions updated...
+ * if i_size equals 0 then we only need to update an individual
+ * page.
+ * @param i_access_type[in] - type of permission to set
+ * @return int - 0 for successful block allocation, non-zero otherwise
+ */
+ int _mmSetPermission(void* i_va,
+ uint64_t i_size,
+ PAGE_PERMISSIONS i_access_type);
+
+
};
#endif
diff --git a/src/include/kernel/syscalls.H b/src/include/kernel/syscalls.H
index bdffea120..70dd436be 100644
--- a/src/include/kernel/syscalls.H
+++ b/src/include/kernel/syscalls.H
@@ -97,7 +97,10 @@ namespace Systemcalls
/** mm_remove_pages() */
MM_REMOVE_PAGES,
- SYSCALL_MAX
+ /** mm_set_permission() */
+ MM_SET_PERMISSION,
+
+ SYSCALL_MAX
};
/** @enum SysCalls_FastPath
diff --git a/src/include/kernel/vmmmgr.H b/src/include/kernel/vmmmgr.H
index 2d0d0297d..ef8e6c362 100644
--- a/src/include/kernel/vmmmgr.H
+++ b/src/include/kernel/vmmmgr.H
@@ -118,6 +118,19 @@ class VmmManager
*/
static int mmRemovePages(PAGE_REMOVAL_OPS i_op, void* i_vaddr,
uint64_t i_size);
+ /**
+ * @brief Sets the permissions for a given page or range of pages
+ * @param i_va[in] - Virtual address of the page to update permission
+ * @param i_size[in] - range of memory that needs permissions updated...
+ * if i_size equals 0 then we only need to update an
+ * individual page.
+ * @return int - 0 for successful permission update, non-zero otherwise
+ *
+ * The given virtual address will be 'rounded' down to the nearest page
+ * boundary, along with the given size will be 'rounded' up to the
+ * nearest divisible page size.
+ */
+ static int mmSetPermission(void* i_va,uint64_t i_size, PAGE_PERMISSIONS i_access_type);
protected:
VmmManager();
@@ -141,6 +154,9 @@ class VmmManager
/** See findPhysicalAddress */
uint64_t _findPhysicalAddress(uint64_t i_vaddr);
+ /* See mmSetPermission */
+ int _mmSetPermission(void* i_va,uint64_t i_size, PAGE_PERMISSIONS i_access_type);
+
public:
friend class Block;
OpenPOWER on IntegriCloud