1 {-# LANGUAGE ForeignFunctionInterface #-}
8 foreign import ccall "dynamic"
9 code_void :: FunPtr (IO ()) -> (IO ())
13 entryPtr <- (mallocBytes 2)
14 poke entryPtr (0xc390 :: Word16) -- nop (0x90); ret(0xc3) (little endian order)
16 _ <- printf "entry point: 0x%08x\n" ((fromIntegral $ ptrToIntPtr entryPtr) :: Int)
17 code_void $ castPtrToFunPtr entryPtr
18 putStrLn "welcome back"