summaryrefslogtreecommitdiffstats
path: root/src/include/kernel/segmentmgr.H
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2011-07-08 19:33:40 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2011-07-20 14:58:43 -0500
commit471f09f1a9bcc46fc385fa8aca776cb682075c0b (patch)
treee0a4969825799dcc4c28a71975cb68439f507390 /src/include/kernel/segmentmgr.H
parent3ecf7085ccc55eb4f815a62f47ea09f55bb6688e (diff)
downloadblackbird-hostboot-471f09f1a9bcc46fc385fa8aca776cb682075c0b.tar.gz
blackbird-hostboot-471f09f1a9bcc46fc385fa8aca776cb682075c0b.zip
VMM Improvements.
- Segment Manager - Base / Device Segments - Block for Base image. Change-Id: Ic0c058e5c5b210ec1c48d30f6ed9f9837d74a3c8 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/193 Tested-by: Jenkins Server Reviewed-by: MATTHEW S. BARTH <msbarth@us.ibm.com>
Diffstat (limited to 'src/include/kernel/segmentmgr.H')
-rw-r--r--src/include/kernel/segmentmgr.H92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/include/kernel/segmentmgr.H b/src/include/kernel/segmentmgr.H
new file mode 100644
index 000000000..7048fa365
--- /dev/null
+++ b/src/include/kernel/segmentmgr.H
@@ -0,0 +1,92 @@
+/** @file segmentmgr.H
+ * Provides definition of the SegmentManager class.
+ */
+
+#ifndef __KERNEL_SEGMENTMGR_H
+#define __KERNEL_SEGMENTMGR_H
+
+#include <kernel/task.H>
+
+// Forward declaration.
+class Segment;
+
+/** @class SegmentManager
+ * @brief Container of Segments. Responsible for managing the SLB.
+ *
+ * @note This class is not thread-safe on its own. Expectation is that
+ * the virtual memory manager will serialize internal operations.
+ */
+class SegmentManager
+{
+ public:
+ /** Segment Identifiers */
+ enum SegmentIds
+ {
+ /** Base Segment (0-1TB). */
+ BASE_SEGMENT_ID = 0,
+ /** Task Stack Segment (1-2TB). */
+ STACK_SEGMENT_ID = 1,
+ /** MMIO Space Segment (2-3TB). */
+ MMIO_SEGMENT_ID = 2,
+
+ MAX_SEGMENTS = 4
+ };
+
+ /**
+ * Constructor. Initializes instance variables.
+ */
+ SegmentManager()
+ {
+ for(int i = 0; i < MAX_SEGMENTS; i++)
+ iv_segments[i] = NULL;
+ };
+ /**
+ * Destructor.
+ * No action necessary. Associated segments are owned externally,
+ * such as in Singletons.
+ */
+ ~SegmentManager() {};
+
+ /**
+ * @brief Responsible for directing page faults to the owning segment.
+ *
+ * @param[in] i_task - Task causing the page fault.
+ * @param[in] i_addr - Effective address accessed to cause fault.
+ *
+ * @return true - Page fault was successfully handled.
+ *
+ * If the page fault is not successfully handled the expectation is
+ * that the VMM will perform appropriate action, such as killing the
+ * task.
+ */
+ static bool handlePageFault(task_t* i_task, uint64_t i_addr);
+
+ /**
+ * @brief Adds a segment to the container.
+ *
+ * @param[in] i_segment - Segment object to associate to segment.
+ * @param[in] i_segId - Segment identifier (which TB) to associate.
+ *
+ * @note Ownership of the Segment object (for freeing memory) remains
+ * with the callee.
+ */
+ static void addSegment(Segment* i_segment, size_t i_segId);
+
+ /**
+ * @brief Update SLB on this hardware thread with associated segments.
+ */
+ static void initSLB();
+
+ private:
+ /** See handlePageFault. */
+ bool _handlePageFault(task_t* i_task, uint64_t i_addr);
+ /** See addSegment. */
+ void _addSegment(Segment* i_segment, size_t i_segId);
+ /** See initSLB. */
+ void _initSLB();
+
+ /** Array of segment objects to associated segment IDs. */
+ Segment* iv_segments[MAX_SEGMENTS];
+};
+
+#endif
OpenPOWER on IntegriCloud