summaryrefslogtreecommitdiffstats
path: root/src/kernel/basesegment.C
diff options
context:
space:
mode:
authorMissy Connell <missyc@us.ibm.com>2011-09-19 15:13:28 -0500
committerMelissa J. Connell <missyc@us.ibm.com>2011-10-06 11:41:57 -0500
commitfdbe0a754e64fb8c4c7cb9aa98184ca87a867e22 (patch)
treefe4b3b6dc6b84c0e494dd6ab305e1e60635dd7d7 /src/kernel/basesegment.C
parent336f6ac6abc1d5ee4efc1229be06a66baf06643b (diff)
downloadtalos-hostboot-fdbe0a754e64fb8c4c7cb9aa98184ca87a867e22.tar.gz
talos-hostboot-fdbe0a754e64fb8c4c7cb9aa98184ca87a867e22.zip
pge permission functionality..
Add code that applies the permissions requested. Add merge conflicts Change-Id: I5911406ba4670714faaf4880399da71692559397 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/353 Tested-by: Jenkins Server Reviewed-by: Melissa J. Connell <missyc@us.ibm.com>
Diffstat (limited to 'src/kernel/basesegment.C')
-rw-r--r--src/kernel/basesegment.C46
1 files changed, 44 insertions, 2 deletions
diff --git a/src/kernel/basesegment.C b/src/kernel/basesegment.C
index eab00accc..8eb7e5484 100644
--- a/src/kernel/basesegment.C
+++ b/src/kernel/basesegment.C
@@ -142,11 +142,53 @@ void BaseSegment::updateRefCount( uint64_t i_vaddr,
}
/**
+ * STATIC
* Sets the Page Permissions for a given page via virtual address
*/
-int BaseSegment::mmSetPermission(void* i_va, uint64_t i_size,PAGE_PERMISSIONS i_access_type)
+int BaseSegment::mmSetPermission(void* i_va, uint64_t i_size, uint64_t i_access_type)
{
- return 0;
+ return Singleton<BaseSegment>::instance()._mmSetPermission(i_va,i_size,i_access_type);
+}
+
+
+/**
+ * Sets the Page Permissions for a given page via virtual address
+ */
+int BaseSegment::_mmSetPermission(void* i_va, uint64_t i_size, uint64_t i_access_type)
+{
+ int l_rc = 0;
+ Block *l_block = iv_block;
+ uint64_t l_va = reinterpret_cast<uint64_t>(i_va);
+
+
+ do
+ {
+ // If the va is not part of this block
+ if (!(l_block->isContained(l_va)))
+ {
+ // Check to see if there is a next block
+ if (l_block->iv_nextBlock)
+ {
+ // set local block to the next block
+ l_block = l_block->iv_nextBlock;
+ }
+ else
+ {
+ // address passed in does not fall into a block
+ return -EINVAL;
+ }
+ }
+ // The virtual address falls within this block
+ else
+ {
+ // Set the permission on the the current block.
+ return(l_block->mmSetPermission(l_va, i_size, i_access_type));
+
+ }
+ } while (l_block->iv_nextBlock);
+
+ return l_rc;
+
}
void BaseSegment::castOutPages(uint64_t i_type)
OpenPOWER on IntegriCloud