diff options
author | Matthew Barth <msbarth@us.ibm.com> | 2011-08-12 10:54:52 -0500 |
---|---|---|
committer | MATTHEW S. BARTH <msbarth@us.ibm.com> | 2011-08-15 16:14:21 -0500 |
commit | 5b4ea4d127be9898ae1aada5df6b06e67ec47086 (patch) | |
tree | 2df7dd4825b8208492a536174f6f6bb4dc86d997 /src/kernel/block.C | |
parent | fa0113e4599fcca0c2d4c938c88d445d288a952a (diff) | |
download | talos-hostboot-5b4ea4d127be9898ae1aada5df6b06e67ec47086.tar.gz talos-hostboot-5b4ea4d127be9898ae1aada5df6b06e67ec47086.zip |
Support msgq and paging data for blocks in base segment
Change-Id: I4f1775b6a843140be97f3c328155aa1654086723
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/254
Tested-by: Jenkins Server
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/kernel/block.C')
-rw-r--r-- | src/kernel/block.C | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/src/kernel/block.C b/src/kernel/block.C index 25157dac5..d5cc685d8 100644 --- a/src/kernel/block.C +++ b/src/kernel/block.C @@ -1,11 +1,14 @@ #include <limits.h> #include <assert.h> +#include <sys/msg.h> + #include <kernel/block.H> #include <kernel/spte.H> #include <kernel/vmmmgr.H> #include <kernel/ptmgr.H> - +#include <kernel/pagemgr.H> +//#include <kernel/console.H> Block::~Block() { // Release shadow PTE array. @@ -18,10 +21,16 @@ Block::~Block() } } -void Block::init() +void Block::init(MessageQueue* i_msgQ) { // Create a shadow PTE for each page. iv_ptes = new ShadowPTE[iv_size / PAGESIZE]; + this->iv_msgHdlr = NULL; + if (i_msgQ != NULL) + { + //Create message handler attribute for this block with this msgq + this->iv_msgHdlr = new MessageHandler(VmmManager::getLock(),i_msgQ); + } } ShadowPTE* Block::getPTE(uint64_t i_addr) const @@ -42,13 +51,29 @@ bool Block::handlePageFault(task_t* i_task, uint64_t i_addr) if (!pte->isPresent()) { - // TODO. Needs swapping support. - return false; - } - - if (pte->getPage() == 0) - { - return false; + if (this->iv_msgHdlr != NULL) + { + void* l_page = reinterpret_cast<void*>(pte->getPageAddr()); + //If the page data is zero, create the page + if (pte->getPage() == 0) + { + l_page = PageManager::allocatePage(); + //Add to ShadowPTE + pte->setPageAddr(reinterpret_cast<uint64_t>(l_page)); + //TODO - Update to correct permissions requested + pte->setExecutable(true); + pte->setWritable(false); + } + //Send message to handler to read page + this->iv_msgHdlr->sendMessage(MSG_MM_RP_READ, + reinterpret_cast<void*>(i_addr),l_page,i_task); + //Done(waiting for response) + return true; + } + else + { + return false; //TODO - Swap kernel base block pages for user pages + } } // Add page table entry. |