--- /dev/null
+/* 
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National 
+ * Science Foundation and the Department of Energy.  
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico.  You can find out more at 
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2011, Kyle C. Hale <kh@u.northwestern.edu> 
+ * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org> 
+ * All rights reserved.
+ *
+ * Author: Kyle C. Hale <kh@u.northwestern.edu>
+ *
+ * This is free software.  You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+#ifndef __SYSCALL_HIJACK_H__
+#define __SYSCALL_HIJACK_H__
+
+
+int v3_hook_syscall (struct guest_info * core,
+    uint_t syscall_nr,
+    int (*handler)(struct guest_info * core, uint_t syscall_nr, void * priv_data), 
+    void * priv_data);
+
+int v3_hook_passthrough_syscall (struct guest_info * core, uint_t syscall_nr);
+
+
+#endif
 
 #include <palacios/vmm_decoder.h>
 #include <palacios/vmm_string.h>
 #include <palacios/vmm_shadow_paging.h>
-#include <palacios/vmm_syscall_hijack.h>
-#include <palacios/vmm_linux_syscall_map.h>
-#include <palacios/vmm_process_environment.h>
-#include <palacios/vmm_execve_hook.h>
+#include <palacios/vmm_extensions.h>
 
+#include <interfaces/syscall_hijack.h>
+#include <interfaces/sw_intr.h>
 
-#ifndef CONFIG_DEBUG_SYSCALL_HIJACK
+#include "syscall_ref.h"
+
+#ifndef V3_CONFIG_DEBUG_EXT_SYSCALL_HIJACK
 #undef PrintDebug
 #define PrintDebug(fmt, args...)
 #endif
     #define max(a, b) ( ((a) > (b)) ? (a) : (b) )
 #endif
 
+#define SYSCALL_INT_VECTOR 0x80
+
+
+struct v3_syscall_hook {
+    int (*handler)(struct guest_info * core, uint_t syscall_nr, void * priv_data);
+    void * priv_data;
+};
+
+static struct v3_syscall_hook * syscall_hooks[512];
+
+
+static int v3_syscall_handler (struct guest_info * core, uint8_t vector, void * priv_data) {
+ 
+    uint_t syscall_nr = (uint_t) core->vm_regs.rax;
+    int err = 0;
+
+    struct v3_syscall_hook * hook = syscall_hooks[syscall_nr];
+    if (hook == NULL) {
+#ifdef V3_CONFIG_EXT_SYSCALL_PASSTHROUGH
+        if (v3_hook_passthrough_syscall(core, syscall_nr) == -1) {
+            PrintDebug("Error hooking passthrough syscall\n");
+            return -1;
+        }
+        hook = syscall_hooks[syscall_nr];
+#else
+        return v3_signal_swintr(core, vector);
+#endif
+    }
+    
+    err = hook->handler(core, syscall_nr, hook->priv_data);
+    if (err == -1) {
+        PrintDebug("V3 Syscall Handler: Error in syscall hook\n");
+        return -1;
+    }
+
+    return 0;
+}
+
+
+static int init_syscall_hijack (struct v3_vm_info * vm, v3_cfg_tree_t * cfg, void ** priv_data) {
+
+    return 0;
+}
+
+
+static int init_syscall_hijack_core (struct guest_info * core, void * priv_data) {
+
+    v3_hook_swintr(core, SYSCALL_INT_VECTOR, v3_syscall_handler, NULL);
+    return 0;
+}
 
 
 static void print_arg (struct  guest_info * core, v3_reg_t reg, uint8_t argnum) {
 }
 
 
-int v3_syscall_handler (struct guest_info * core, uint8_t vector, void * priv_data) {
- 
-    uint_t syscall_nr = (uint_t) core->vm_regs.rax;
-    int err = 0;
 
-    struct v3_syscall_hook * hook = core->sc_hook_map.syscall_hooks[syscall_nr];
-    if (hook == NULL) {
-#ifdef CONFIG_SYSCALL_PASSTHROUGH
-        if (v3_hook_passthrough_syscall(core, syscall_nr) == -1) {
-            PrintDebug("Error hooking passthrough syscall\n");
-            return -1;
-        }
-        hook = core->sc_hook_map.syscall_hooks[syscall_nr];
-#else
-        return v3_signal_swintr(core, vector);
-#endif
-    }
-    
-    err = hook->handler(core, syscall_nr, hook->priv_data);
-    if (err == -1) {
-        PrintDebug("V3 Syscall Handler: Error in syscall hook\n");
-        return -1;
-    }
 
-    return 0;
-}
+static struct v3_extension_impl syscall_impl = {
+    .name = "syscall_intercept",
+    .init = init_syscall_hijack,
+    .deinit = NULL,
+    .core_init = init_syscall_hijack_core,
+    .core_deinit = NULL,
+    .on_entry = NULL,
+    .on_exit = NULL
+};
+
+register_extension(&syscall_impl);
+
+
 
 
 static inline struct v3_syscall_hook * get_syscall_hook (struct guest_info * core, uint_t syscall_nr) {
-    return core->sc_hook_map.syscall_hooks[syscall_nr];
+    return syscall_hooks[syscall_nr];
 } 
 
 
     hook->handler = handler;
     hook->priv_data = priv_data;
 
-    core->sc_hook_map.syscall_hooks[syscall_nr] = hook;
+    syscall_hooks[syscall_nr] = hook;
 
     return 0;
 }
     return 0;
 }
 
-
+/*
 int v3_sysexecve_handler (struct guest_info * core, uint_t syscall_nr, void * priv_data) {
     addr_t hva, key;
     struct exec_hook * hook;
     return 0;
 }
 
+*/