diff options
author | Matthew Barth <msbarth@us.ibm.com> | 2011-08-10 11:22:49 -0500 |
---|---|---|
committer | MATTHEW S. BARTH <msbarth@us.ibm.com> | 2011-08-10 17:30:34 -0500 |
commit | b977bf9b78b1d7d57cefa3f8a2b7ebd0b7de4563 (patch) | |
tree | e15e50c0e9a80096c4a26db97d7c8686223a80d3 /src/include | |
parent | 2a7a99c1e088b8b87e4b019d24550c047fb86e0d (diff) | |
download | talos-hostboot-b977bf9b78b1d7d57cefa3f8a2b7ebd0b7de4563.tar.gz talos-hostboot-b977bf9b78b1d7d57cefa3f8a2b7ebd0b7de4563.zip |
Allocate block system call stub
Change-Id: Ief3476b5306bc231c9d3044b2736fcd195e840b1
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/243
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/kernel/basesegment.H | 12 | ||||
-rw-r--r-- | src/include/kernel/syscalls.H | 9 | ||||
-rw-r--r-- | src/include/kernel/vmmmgr.H | 12 | ||||
-rw-r--r-- | src/include/sys/mm.h | 27 |
4 files changed, 56 insertions, 4 deletions
diff --git a/src/include/kernel/basesegment.H b/src/include/kernel/basesegment.H index 7f1c78dfa..8086c08b5 100644 --- a/src/include/kernel/basesegment.H +++ b/src/include/kernel/basesegment.H @@ -6,6 +6,8 @@ #include <kernel/segment.H> +// Forward declaration. +class MessageQueue; class Block; /** @class BaseSegment @@ -41,6 +43,16 @@ class BaseSegment : public Segment */ bool handlePageFault(task_t* i_task, uint64_t i_addr); + /** + * @brief Allocates a block of virtual memory of the given size + * @param i_mq[in] - Message queue to be associated with the block + * @param i_va[in] - Base virtual address of the block to be allocated + * @param i_size[in] - Requested virtual memory size of the block + * @return int - 0 for successful block allocation, non-zero otherwise + */ + static int mmAllocBlock(MessageQueue* i_mq,void* i_va, + uint64_t i_size); + private: /** * @brief Internal implementation of init function. diff --git a/src/include/kernel/syscalls.H b/src/include/kernel/syscalls.H index a76bb82a9..dad90056c 100644 --- a/src/include/kernel/syscalls.H +++ b/src/include/kernel/syscalls.H @@ -56,17 +56,18 @@ namespace Systemcalls /** futex_wait() */ FUTEX_WAIT, - /** futex_wake() */ FUTEX_WAKE, /** shutdown() */ MISC_SHUTDOWN, - /** cpu_core_type() */ - MISC_CPUCORETYPE, + MISC_CPUCORETYPE, /** cpu_dd_level() */ - MISC_CPUDDLEVEL, + MISC_CPUDDLEVEL, + + /** mm_alloc_block() */ + MM_ALLOC_BLOCK, SYSCALL_MAX }; diff --git a/src/include/kernel/vmmmgr.H b/src/include/kernel/vmmmgr.H index feee7a731..7c8c63c22 100644 --- a/src/include/kernel/vmmmgr.H +++ b/src/include/kernel/vmmmgr.H @@ -6,6 +6,8 @@ #include <kernel/types.h> #include <kernel/spinlock.H> +class MessageQueue; + class VmmManager { public: @@ -68,6 +70,16 @@ class VmmManager */ static int devUnmap(void* ea); + /** + * @brief Allocates a block of virtual memory of the given size + * @param i_mq[in] - Message queue to be associated with the block + * @param i_va[in] - Base virtual address of the block to be allocated + * @param i_size[in] - Requested virtual memory size of the block + * @return int - 0 for successful block allocation, non-zero otherwise + */ + static int mmAllocBlock(MessageQueue* i_mq,void* i_va,uint64_t i_size); + + protected: VmmManager(); ~VmmManager() {}; diff --git a/src/include/sys/mm.h b/src/include/sys/mm.h new file mode 100644 index 000000000..4719ff7df --- /dev/null +++ b/src/include/sys/mm.h @@ -0,0 +1,27 @@ +#ifndef __SYS_MM_H +#define __SYS_MM_H + +#include <stdint.h> +#include <sys/msg.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** @fn mm_alloc_block() + * @brief System call to allocate virtual memory block in the base segment + * + * @param[in] mq - Message queue to be associated with the block + * @param[in] va - Base virtual address of the block to be allocated + * @param[in] size - Requested virtual memory size of the block + * + * @return int - 0 for successful block allocation, non-zero otherwise + */ +int mm_alloc_block(msg_q_t mq,void* va,uint64_t size); + +#ifdef __cplusplus +} +#endif + +#endif |