scratch/ffiTest: removed export
authorHarald Steinlechner <haraldsteinlechner@gmail.com>
Fri, 18 May 2012 20:00:05 +0000 (22:00 +0200)
committerHarald Steinlechner <haraldsteinlechner@gmail.com>
Fri, 18 May 2012 20:00:05 +0000 (22:00 +0200)
scratch/ffiTest/mate_support.c
scratch/ffiTest/prototypes.h
scratch/ffiTest/trapTest.hs

index 7ca89194e394e0ce37e2f626cba6259b723d0991..22cfdfcad8161b7e087f633c71ec11562f45e172 100644 (file)
@@ -28,31 +28,12 @@ void trap(int nSignal, siginfo_t *info, void *ctx)
        mcontext_t *mctx = &((ucontext_t *) ctx)->uc_mcontext;
        unsigned int from = (unsigned int) mctx->gregs[REG_EIP];
 
-       mateTrapHandler(nSignal, info, ctx, from);
+       //mateTrapHandler(nSignal, info, ctx, from);
 
        printf("from: 0x%08x\n", from);
        exit(0);
 }
 
-void registerSignalHandlers(void)
-{
-       printf("registering\n");
-       struct sigaction illaction;
-       illaction.sa_sigaction = trap;
-       sigemptyset(&illaction.sa_mask);
-       illaction.sa_flags = SA_SIGINFO | SA_RESTART | SA_NODEFER;
-       sigaction(SIGILL, &illaction, NULL);
-
-
-/*
-       struct sigaction segvaction;
-       segvaction.sa_sigaction = trap;
-       sigemptyset(&segvaction.sa_mask);
-       segvaction.sa_flags = SA_SIGINFO | SA_RESTART | SA_NODEFER;
-       sigaction(SIGSEGV, &segvaction, NULL);
-*/
-}
-
 
 void registerSignalHandlers2(void (*f)(int, siginfo_t*,void*))
 {
index 55b79031af8fe0126c82453040563d33b2d0ef29..d9ba80c40d31dfd37e9f98be7dfccbe924ad5396 100644 (file)
@@ -1,8 +1,8 @@
-extern void registerSignalHandlers(void);
-extern void mateTrapHandler(unsigned int signal,
+//extern void registerSignalHandlers(void);
+/*extern void mateTrapHandler(unsigned int signal,
                             siginfo_t *sigInfo,
                             void *ctx,
                             unsigned int eip);
-
+*/
 
 extern void registerSignalHandlers2(void (*f)(int, siginfo_t*,void*));
index 409c9a352938ee9e7cbd9af05ab377ed9cfbe82d..21e3719a55456488b0e3ccae90f1abc929f1fe21 100644 (file)
@@ -22,8 +22,6 @@ foreign import ccall "static sys/mman.h"
 foreign import ccall "static stdlib.h"
   memalign :: CUInt -> CUInt -> IO (Ptr a)
 
-foreign import ccall safe "prototypes.h"
-  registerSignalHandlers :: IO ()
 
 foreign import ccall "wrapper"
   wrap :: (CUInt -> Ptr SigInfo -> Ptr Context -> IO ()) -> IO (FunPtr (CUInt -> Ptr SigInfo -> Ptr Context -> IO ()))
@@ -31,9 +29,6 @@ foreign import ccall "wrapper"
 foreign import ccall "prototypes.h"
   registerSignalHandlers2 :: FunPtr (CUInt -> Ptr SigInfo -> Ptr Context -> IO ()) -> IO ()
 
-foreign export ccall
-    mateTrapHandler :: CUInt -> Ptr SigInfo -> Ptr Context -> CUInt -> IO ()
-
 type SigInfo = ()
 type Context = ()              
 
@@ -49,6 +44,7 @@ runMateKernel :: AppDomain -> IO ()
 runMateKernel _ = do    
   compileAndRun
 
+
 -- use FFI to unpack sigInfo and ctx....
 handler mateCtx signal sigInfo ctx = do 
   putStr "handler got me."
@@ -95,13 +91,3 @@ compileAndRun = do
 
 senseless :: IO Int
 senseless = getStdRandom (randomR (1,100))
-
-
-mateTrapHandler :: CUInt -> Ptr SigInfo -> Ptr Context -> CUInt -> IO ()
-mateTrapHandler signal sigInfo ctx eip = do
-  putStr "mateTrapHandler says: "
-  let eip' = (fromIntegral eip) :: Int
-  printf "source, eip: 0x%08x" eip'
-  print eip'
-
-