 -- memory is thusly reduced, overall system performance may suffer. This is best
 -- used sparingly to allocate staging areas for data exchange.
 --
-mallocHost :: Int -> IO (Either String (HostPtr a))
-mallocHost bytes =
+mallocHost :: [AllocFlag] -> Int -> IO (Either String (HostPtr a))
+mallocHost flags bytes =
   newHostPtr >>= \hp -> withHostPtr hp $ \p ->
-  cuMemAllocHost p bytes >>= \rv ->
+  cuMemHostAlloc p bytes flags >>= \rv ->
   return $ case nothingIfOk rv of
     Nothing  -> Right hp
     Just err -> Left err
 
-{# fun unsafe cuMemAllocHost
+{# fun unsafe cuMemHostAlloc
   { with'* `Ptr a'
-  ,        `Int'         } -> `Status' cToEnum #}
+  ,        `Int'
+  , combineBitMasks `[AllocFlag]' } -> `Status' cToEnum #}
   where with' = with . castPtr
 
 

    _ -> return $ Just "can only memset 8-, 16-, and 32-bit values"

--
-- We use unsafe coerce below to reinterpret the bits of the value to memset
-- into the required integer type.
--
{# fun unsafe cuMemsetD8
  { useDevicePtr `DevicePtr a'


module Foreign.CUDA.Driver.Marshal
  (
    DevicePtr, HostPtr, AllocFlag(..), withHostPtr,
    malloc, free, mallocHost, freeHost,
    peekArray, peekArrayAsync, pokeArray, pokeArrayAsync, memset,
    getDevicePtr
  )
  where

