Skip to content

Commit

Permalink
🍎: added MCOPY handler
Browse files Browse the repository at this point in the history
  • Loading branch information
degrigis committed Aug 6, 2024
1 parent 01b80bc commit 1c9ca67
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion greed/TAC/mem_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from greed.TAC.base import TAC_Statement
from greed.state import SymbolicEVMState

__all__ = ['TAC_Mstore', 'TAC_Mstore8', 'TAC_Mload', 'TAC_Sload', 'TAC_Sstore', 'TAC_Msize']
__all__ = ['TAC_Mstore', 'TAC_Mstore8', 'TAC_Mload', 'TAC_Sload', 'TAC_Sstore', 'TAC_Msize', 'TAC_Mcopy']


"""
Expand Down Expand Up @@ -101,3 +101,19 @@ def handle(self, state: SymbolicEVMState):

state.set_next_pc()
return [state]


class TAC_Mcopy(TAC_Statement):
__internal_name__ = "MCOPY"
__aliases__ = {
'destOffset_var': 'arg1_var', 'destOffset_val': 'arg1_val',
'offset_var': 'arg2_var', 'offset_val': 'arg2_val',
'size_var': 'arg3_var', 'size_val': 'arg3_val',
}

@TAC_Statement.handler_with_side_effects
def handle(self, state: SymbolicEVMState):
state.memory.memcopy(self.destOffset_val, state.memory.copy(state), self.offset_val, self.size_val)

state.set_next_pc()
return [state]

0 comments on commit 1c9ca67

Please sign in to comment.