summaryrefslogtreecommitdiffstats
path: root/src/kernel
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2011-08-19 11:31:43 -0500
committerMATTHEW S. BARTH <msbarth@us.ibm.com>2011-08-23 16:34:04 -0500
commitb755e532a742a9143946c7b5bd17c6a244d2316a (patch)
treefdbc0030154ad8a0f08d1c9e4a50f425c05a0b20 /src/kernel
parent213b45cd7d8b0367f85ee68b79941f6d548c1e9c (diff)
downloadtalos-hostboot-b755e532a742a9143946c7b5bd17c6a244d2316a.tar.gz
talos-hostboot-b755e532a742a9143946c7b5bd17c6a244d2316a.zip
Handle response from messages registered to a block within the base segment
Change-Id: I65be2258e5e6bd707797415a5376fd94c3bab68a Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/265 Tested-by: Jenkins Server Reviewed-by: MATTHEW S. BARTH <msbarth@us.ibm.com>
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/basesegment.C3
-rw-r--r--src/kernel/block.C27
-rw-r--r--src/kernel/blockmsghdlr.C22
-rw-r--r--src/kernel/makefile2
4 files changed, 49 insertions, 5 deletions
diff --git a/src/kernel/basesegment.C b/src/kernel/basesegment.C
index 35e6375a2..324a00bf9 100644
--- a/src/kernel/basesegment.C
+++ b/src/kernel/basesegment.C
@@ -7,6 +7,7 @@
#include <kernel/vmmmgr.H>
#include <kernel/cpuid.H>
//#include <kernel/console.H>
+
#define SLBE_s 40
BaseSegment::~BaseSegment()
@@ -88,7 +89,7 @@ int BaseSegment::mmAllocBlock(MessageQueue* i_mq,void* i_va,uint64_t i_size)
int BaseSegment::_mmAllocBlock(MessageQueue* i_mq,void* i_va,uint64_t i_size)
{
uint64_t l_vaddr = reinterpret_cast<uint64_t>(i_va);
- uint64_t l_blockSizeTotal = 0;//iv_block->iv_size;
+ uint64_t l_blockSizeTotal = 0;
iv_block->totalBlocksAlloc(l_blockSizeTotal);
//Verify input address and size falls within this segment's address range
if ((l_vaddr < this->getBaseAddress() ||
diff --git a/src/kernel/block.C b/src/kernel/block.C
index 5d9b8d1e3..17d6a1d5c 100644
--- a/src/kernel/block.C
+++ b/src/kernel/block.C
@@ -8,6 +8,7 @@
#include <kernel/vmmmgr.H>
#include <kernel/ptmgr.H>
#include <kernel/pagemgr.H>
+//#include <kernel/console.H>
Block::~Block()
{
@@ -29,7 +30,7 @@ void Block::init(MessageQueue* i_msgQ)
if (i_msgQ != NULL)
{
//Create message handler attribute for this block with this msgq
- this->iv_msgHdlr = new MessageHandler(VmmManager::getLock(),i_msgQ);
+ this->iv_msgHdlr = new BlockMsgHdlr(VmmManager::getLock(),i_msgQ,this);
}
}
@@ -61,8 +62,8 @@ bool Block::handlePageFault(task_t* i_task, uint64_t i_addr)
//Add to ShadowPTE
pte->setPageAddr(reinterpret_cast<uint64_t>(l_page));
//TODO - Update to correct permissions requested
- pte->setExecutable(true);
- pte->setWritable(false);
+ pte->setExecutable(false);
+ pte->setWritable(true);
}
//Send message to handler to read page
this->iv_msgHdlr->sendMessage(MSG_MM_RP_READ,
@@ -132,3 +133,23 @@ void Block::setPhysicalPage(uint64_t i_vAddr, uint64_t i_pAddr,
break;
}
}
+
+void Block::setIsPresent(void* i_vaddr)
+{
+ uint64_t l_vaddr = reinterpret_cast<uint64_t>(i_vaddr);
+ ShadowPTE* l_pte = getPTE(l_vaddr);
+ //Set present bit
+ l_pte->setPresent(true);
+}
+
+void Block::addPTE(void* i_vaddr)
+{
+ uint64_t l_vaddr = reinterpret_cast<uint64_t>(i_vaddr);
+ ShadowPTE* l_pte = getPTE(l_vaddr);
+ //Add page table entry
+ PageTableManager::addEntry((l_vaddr / PAGESIZE) * PAGESIZE,
+ l_pte->getPage(),
+ (l_pte->isExecutable() ? VmmManager::RO_EXE_ACCESS :
+ (l_pte->isWritable() ? VmmManager::NORMAL_ACCESS :
+ VmmManager::READ_O_ACCESS)));
+}
diff --git a/src/kernel/blockmsghdlr.C b/src/kernel/blockmsghdlr.C
new file mode 100644
index 000000000..639e8c3af
--- /dev/null
+++ b/src/kernel/blockmsghdlr.C
@@ -0,0 +1,22 @@
+#include <kernel/blockmsghdlr.H>
+#include <kernel/block.H>
+//#include <kernel/console.H>
+
+MessageHandler::HandleResult BlockMsgHdlr::handleResponse(
+ msg_sys_types_t i_type, void* i_key, task_t* i_task, int i_rc)
+{
+ if (i_rc != 0)
+ {
+ // Indicate nothing specific has been done for this response. Request
+ // default behavior of resume/kill task based on rc.
+ return UNHANDLED_RC;
+ }
+ else
+ {
+ //Set the present bit for the address associated with this block
+ iv_block->setIsPresent(i_key);
+ //Add the address into the page table associated with this block
+ iv_block->addPTE(i_key);
+ return SUCCESS;
+ }
+}
diff --git a/src/kernel/makefile b/src/kernel/makefile
index 5ccbf8da9..b4ef607ed 100644
--- a/src/kernel/makefile
+++ b/src/kernel/makefile
@@ -3,7 +3,7 @@ ROOTPATH = ../..
OBJS = start.o kernel.o console.o pagemgr.o heapmgr.o taskmgr.o cpumgr.o
OBJS += syscall.o scheduler.o spinlock.o exception.o vmmmgr.o timemgr.o
OBJS += futexmgr.o ptmgr.o segmentmgr.o devicesegment.o basesegment.o
-OBJS += block.o cpuid.o misc.o msghandler.o
+OBJS += block.o cpuid.o misc.o msghandler.o blockmsghdlr.o
include ${ROOTPATH}/config.mk
OpenPOWER on IntegriCloud