diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2011-06-08 11:58:09 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2011-06-08 11:58:09 -0500 |
commit | 67bb3070032fcb944a63aabb4ecfff692840e7bf (patch) | |
tree | 104a8558a460aed6bc716f624bdd156b8f12f28d /src/mem/slicc | |
parent | 1f7a6274017821d58f3087120079477ac211ceaf (diff) | |
download | gem5-67bb3070032fcb944a63aabb4ecfff692840e7bf.tar.xz |
Ruby: Correctly set access permissions for directory entries
The access permissions for the directory entries are not being set correctly.
This is because pointers are not used for handling directory entries.
function. get and set functions for access permissions have been added to the
Controller state machine. The changePermission() function provided by the
AbstractEntry and AbstractCacheEntry classes has been exposed to SLICC
code once again. The set_permission() functionality has been removed.
NOTE: Each protocol will have to define these get and set functions in order
to compile successfully.
Diffstat (limited to 'src/mem/slicc')
-rw-r--r-- | src/mem/slicc/ast/MethodCallExprAST.py | 8 | ||||
-rw-r--r-- | src/mem/slicc/symbols/StateMachine.py | 17 |
2 files changed, 11 insertions, 14 deletions
diff --git a/src/mem/slicc/ast/MethodCallExprAST.py b/src/mem/slicc/ast/MethodCallExprAST.py index 6a2977533..cfee9b19d 100644 --- a/src/mem/slicc/ast/MethodCallExprAST.py +++ b/src/mem/slicc/ast/MethodCallExprAST.py @@ -160,7 +160,13 @@ class MemberMethodCallExprAST(MethodCallExprAST): if return_type.isInterface: prefix = "static_cast<%s &>" % return_type.c_ident - prefix = "%s((%s)." % (prefix, code) + + if str(obj_type) == "AbstractCacheEntry" or \ + ("interface" in obj_type and + obj_type["interface"] == "AbstractCacheEntry"): + prefix = "%s((*(%s))." % (prefix, code) + else: + prefix = "%s((%s)." % (prefix, code) return obj_type, methodId, prefix diff --git a/src/mem/slicc/symbols/StateMachine.py b/src/mem/slicc/symbols/StateMachine.py index 09e17aee9..a3a95002d 100644 --- a/src/mem/slicc/symbols/StateMachine.py +++ b/src/mem/slicc/symbols/StateMachine.py @@ -348,8 +348,6 @@ static int m_num_controllers; // Set and Reset for cache_entry variable void set_cache_entry(${{self.EntryType.c_ident}}*& m_cache_entry_ptr, AbstractCacheEntry* m_new_cache_entry); void unset_cache_entry(${{self.EntryType.c_ident}}*& m_cache_entry_ptr); -// Set permissions for the cache_entry -void set_permission(${{self.EntryType.c_ident}}*& m_cache_entry_ptr, AccessPermission perm); ''') if self.TBEType != None: @@ -864,15 +862,6 @@ $c_ident::unset_cache_entry(${{self.EntryType.c_ident}}*& m_cache_entry_ptr) { m_cache_entry_ptr = 0; } - -void -$c_ident::set_permission(${{self.EntryType.c_ident}}*& m_cache_entry_ptr, - AccessPermission perm) -{ - if (m_cache_entry_ptr != NULL) { - m_cache_entry_ptr->changePermission(perm); - } -} ''') if self.TBEType != None: @@ -1116,14 +1105,16 @@ ${ident}_Controller::doTransition(${ident}_Event event, ''') if self.TBEType != None and self.EntryType != None: code('setState(m_tbe_ptr, m_cache_entry_ptr, addr, next_state);') - code('set_permission(m_cache_entry_ptr, ${ident}_State_to_permission(next_state));') + code('setAccessPermission(m_cache_entry_ptr, addr, next_state);') elif self.TBEType != None: code('setState(m_tbe_ptr, addr, next_state);') + code('setAccessPermission(addr, next_state);') elif self.EntryType != None: code('setState(m_cache_entry_ptr, addr, next_state);') - code('set_permission(m_cache_entry_ptr, ${ident}_State_to_permission(next_state));') + code('setAccessPermission(m_cache_entry_ptr, addr, next_state);') else: code('setState(addr, next_state);') + code('setAccessPermission(addr, next_state);') code(''' } else if (result == TransitionResult_ResourceStall) { |