[haskell] Added testI386ContextSave function

Based on test_i386_context_save function in samples/sample_x86.c
This commit is contained in:
Adrian Herrera
2016-10-31 11:57:13 +01:00
parent e1a2cb5fe8
commit eccef31651
2 changed files with 73 additions and 4 deletions

View File

@ -38,7 +38,7 @@ module Unicorn
-- * Context operations
, Context
, contextAlloc
, contextAllocate
, contextSave
, contextRestore
@ -273,9 +273,9 @@ memRegions uc = do
-- CPU context, which includes registers and some internal metadata. Contexts
-- may not be shared across engine instances with differing architectures or
-- modes.
contextAlloc :: Engine -- ^ 'Unicon' engine handle
-> Emulator Context -- ^ A CPU context
contextAlloc uc = do
contextAllocate :: Engine -- ^ 'Unicon' engine handle
-> Emulator Context -- ^ A CPU context
contextAllocate uc = do
(err, contextPtr) <- lift $ ucContextAlloc uc
if err == ErrOk then
-- Return a CPU context if ucContextAlloc completed successfully