diff --git a/bindings/haskell/src/Unicorn/Hook.hs b/bindings/haskell/src/Unicorn/Hook.hs index d716a9ba..2e13ebc4 100644 --- a/bindings/haskell/src/Unicorn/Hook.hs +++ b/bindings/haskell/src/Unicorn/Hook.hs @@ -44,7 +44,6 @@ import Foreign import Unicorn.Internal.Core import Unicorn.Internal.Hook -import Unicorn.Internal.Util import qualified Unicorn.CPU.X86 as X86 ------------------------------------------------------------------------------- diff --git a/bindings/haskell/src/Unicorn/Internal/Unicorn.chs b/bindings/haskell/src/Unicorn/Internal/Unicorn.chs index 3e80b7bd..f6a4f71d 100644 --- a/bindings/haskell/src/Unicorn/Internal/Unicorn.chs +++ b/bindings/haskell/src/Unicorn/Internal/Unicorn.chs @@ -78,9 +78,9 @@ import Unicorn.Internal.Util -- | Memory region mapped by 'memMap'. Retrieve the list of memory regions with -- 'memRegions'. data MemoryRegion = MemoryRegion { - begin :: Word64, -- ^ Begin address of the region (inclusive) - end :: Word64, -- ^ End address of the region (inclusive) - perms :: [MemoryPermission] -- ^ Memory permissions of the region + mrBegin :: Word64, -- ^ Begin address of the region (inclusive) + mrEnd :: Word64, -- ^ End address of the region (inclusive) + mrPerms :: [MemoryPermission] -- ^ Memory permissions of the region } instance Storable MemoryRegion where @@ -91,9 +91,9 @@ instance Storable MemoryRegion where <*> liftA fromIntegral ({# get uc_mem_region->end #} p) <*> liftA expandMemPerms ({# get uc_mem_region->perms #} p) poke p mr = do - {# set uc_mem_region.begin #} p (fromIntegral $ begin mr) - {# set uc_mem_region.end #} p (fromIntegral $ end mr) - {# set uc_mem_region.perms #} p (combineEnums $ perms mr) + {# set uc_mem_region.begin #} p (fromIntegral $ mrBegin mr) + {# set uc_mem_region.end #} p (fromIntegral $ mrEnd mr) + {# set uc_mem_region.perms #} p (combineEnums $ mrPerms mr) -- | A pointer to a memory region. {# pointer *uc_mem_region as MemoryRegionPtr -> MemoryRegion #} @@ -225,11 +225,11 @@ expandMemPerms perms = else checkRWE maskedPerms [ProtRead, ProtWrite, ProtExec] where - checkRWE perms (prot:prots) = - if perms .&. (fromEnum prot) /= 0 then - prot : checkRWE perms prots + checkRWE p (x:xs) = + if p .&. (fromEnum x) /= 0 then + x : checkRWE p xs else - checkRWE perms prots + checkRWE p xs checkRWE _ [] = []