summaryrefslogtreecommitdiffstats
path: root/src/include/kernel/spte.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/spte.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/spte.H')
-rw-r--r--src/include/kernel/spte.H87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/include/kernel/spte.H b/src/include/kernel/spte.H
new file mode 100644
index 000000000..ec5c9f20c
--- /dev/null
+++ b/src/include/kernel/spte.H
@@ -0,0 +1,87 @@
+/** @file spte.H
+ * @brief Defines the structure of the Shadow Page Table Entry.
+ */
+#ifndef __KERNEL_SPTE_H
+#define __KERNEL_SPTE_H
+
+#include <stdint.h>
+#include <builtins.h>
+
+/** @class ShadowPTE
+ * @brief Stores information needed in a shadow page table for virtual to
+ * physical address mapping, such as physical page number and
+ * security permissions.
+ *
+ * @note This structure only allows addressing of 4GB of physical memory due
+ * to the page number being stored in a 20 bit field.
+ *
+ * The data within is stored in a way so that the union value is an address
+ * within the physical page who's number is stored and the low-order bits
+ * are used for storing misc information about the page, such as permissions.
+ */
+class ShadowPTE
+{
+ protected:
+ union
+ {
+ uint32_t word;
+ struct
+ {
+ /** Physical page number. */
+ uint32_t page:20;
+ /** Page is present (is PN valid?). */
+ uint32_t present:1;
+
+ /** May the page be written to. */
+ uint32_t writable:1;
+ /** May code be executed off page. */
+ uint32_t executable:1;
+
+ /** Should the dirty bit be maintained. */
+ uint32_t track_write:1;
+ /** Has page been written to. */
+ uint32_t dirty:1;
+
+ /** Reserved for future use. */
+ uint32_t reserved:7;
+ } PACKED;
+ };
+
+ public:
+ /** Initialize PTE */
+ ShadowPTE() : word(0) {};
+ /** Cast-construct from integer directly to the data union. */
+ explicit ShadowPTE(uint32_t i_data) : word(i_data) {};
+
+ /** Get physical page (as address). */
+ uint32_t getPageAddr() const { return (page << 12); };
+ /** Set physical page (as address). */
+ void setPageAddr(uint32_t i_page) { page = (i_page >> 12); };
+ /** Get physical page (as page number). */
+ uint32_t getPage() const { return page; }
+
+ /** Get present bit. */
+ bool isPresent() const { return present; };
+ /** Set present bit. */
+ void setPresent(bool i_present) { present = i_present; };
+
+ /** Get writable bit. */
+ bool isWritable() const { return writable; };
+ /** Set writable bit. */
+ void setWritable(bool i_write) { writable = i_write; };
+ /** Get executable bit. */
+ bool isExecutable() const { return executable; };
+ /** Set executable bit. */
+ void setExecutable(bool i_exec) { executable = i_exec; };
+
+ /** Get write-tracked bit. */
+ bool isWriteTracked() const { return track_write; };
+ /** Set write-tracked bit. */
+ void setWriteTracked(bool i_track) { track_write = i_track; };
+ /** Get dirty bit. */
+ bool isDirty() const { return dirty; };
+ /** Set dirty bit. */
+ void setDirty(bool i_dirty) { dirty = i_dirty; };
+};
+
+#endif
OpenPOWER on IntegriCloud