diff -Naru linux-hooks-fix_make/include/asm-generic/hook_private.h linux-hooks-resolve/include/asm-generic/hook_private.h
--- linux-hooks-fix_make/include/asm-generic/hook_private.h	1970-01-01 09:00:00.000000000 +0900
+++ linux-hooks-resolve/include/asm-generic/hook_private.h	2003-10-29 11:53:53.890176147 +0900
@@ -0,0 +1,25 @@
+#ifndef __ASM_GENERIC_HOOK_PRIVATE_H
+#define __ASM_GENERIC_HOOK_PRIVATE_H
+/*
+ * Kernel Hooks common code for many archs.
+ * 
+ * Authors: Vamsi Krishna S. <vamsi_krishna@in.ibm.com>
+ */
+#include <asm/cacheflush.h>
+
+static inline void deactivate_asm_hook(struct hook *hook)
+{
+	unsigned char *addr = (unsigned char *) (hook->hook_addr);
+	addr[2] = 0;
+	flush_icache_range(addr + 2, addr + 2);
+	return;
+}
+
+static inline void activate_asm_hook(struct hook *hook)
+{
+	unsigned char *addr = (unsigned char *) (hook->hook_addr);
+	addr[2] = 1;
+	flush_icache_range(addr + 2, addr + 2);
+	return;
+}
+#endif /* __ASM_GENERIC_HOOK_PRIVATE_H */
diff -Naru linux-hooks-fix_make/include/asm-i386/hook.h linux-hooks-resolve/include/asm-i386/hook.h
--- linux-hooks-fix_make/include/asm-i386/hook.h	2003-10-29 11:53:04.513262935 +0900
+++ linux-hooks-resolve/include/asm-i386/hook.h	2003-10-29 11:53:53.891175943 +0900
@@ -6,8 +6,6 @@
  * Authors: Richard J Moore <richardj_moore@uk.ibm.com>
  *	    Vamsi Krishna S. <vamsi_krishna@in.ibm.com>
  */
-#include <asm-generic/hook.h>
-
 #if defined(CONFIG_HOOK) || defined(CONFIG_HOOK_MODULE)
 
 #define IF_HOOK_ENABLED(h, hk) _IF_HOOK_ENABLED(h, #hk)
@@ -17,32 +15,4 @@
 	if (unlikely(tmp))
 
 #endif /* CONFIG_HOOK || CONFIG_HOOK_MODULE */
-
-/*
- * Sanity check the hook location for expected instructions at hook location.
- * movl $0, %reg, testl %reg, %reg
- * test doesn't have to follow movl, so don't test for that.
- */
-#define OPCODE_MOV1			0xb0
-#define OPCODE_MOV1_MASK		0xf0
-#define OPCODE_MOV2_1			0xc6 /* first byte */
-#define OPCODE_MOV2_2			0xc0 /* second byte */
-#define OPCODE_MOV2_1_MASK		0xfe
-#define OPCODE_MOV2_2_MASK		0xf8
-		
-static inline int is_asm_hook(unsigned char *addr)
-{
-	if (!addr)
-		return 0;
-	if((addr[0] & OPCODE_MOV1_MASK) == OPCODE_MOV1) {
-		if (*((unsigned long *)(addr+1)) == 0)
-			return 1;
-	} else if (((addr[0] & OPCODE_MOV2_1_MASK) == OPCODE_MOV2_1) && 
-		    ((addr[1] & OPCODE_MOV2_2_MASK) == OPCODE_MOV2_2)) {
-		if (*((unsigned long *)(addr+2)) == 0)
-			return 1;
-	}
-	return 0;
-}
-
 #endif /* __ASM_I386_HOOK_H */
diff -Naru linux-hooks-fix_make/include/asm-i386/hook_private.h linux-hooks-resolve/include/asm-i386/hook_private.h
--- linux-hooks-fix_make/include/asm-i386/hook_private.h	1970-01-01 09:00:00.000000000 +0900
+++ linux-hooks-resolve/include/asm-i386/hook_private.h	2003-10-29 11:53:53.891175943 +0900
@@ -0,0 +1,37 @@
+#ifndef __ASM_I386_HOOK_PRIVATE_H
+#define __ASM_I386_HOOK_PRIVATE_H
+/*
+ * Kernel Hooks optimized for ia32.
+ * 
+ * Authors: Richard J Moore <richardj_moore@uk.ibm.com>
+ *	    Vamsi Krishna S. <vamsi_krishna@in.ibm.com>
+ */
+#include <asm-generic/hook_private.h>
+/*
+ * Sanity check the hook location for expected instructions at hook location.
+ * movl $0, %reg, testl %reg, %reg
+ * test doesn't have to follow movl, so don't test for that.
+ */
+#define OPCODE_MOV1			0xb0
+#define OPCODE_MOV1_MASK		0xf0
+#define OPCODE_MOV2_1			0xc6 /* first byte */
+#define OPCODE_MOV2_2			0xc0 /* second byte */
+#define OPCODE_MOV2_1_MASK		0xfe
+#define OPCODE_MOV2_2_MASK		0xf8
+		
+static inline int is_asm_hook(unsigned char *addr)
+{
+	if (!addr)
+		return 0;
+	if((addr[0] & OPCODE_MOV1_MASK) == OPCODE_MOV1) {
+		if (*((unsigned long *)(addr+1)) == 0)
+			return 1;
+	} else if (((addr[0] & OPCODE_MOV2_1_MASK) == OPCODE_MOV2_1) && 
+		    ((addr[1] & OPCODE_MOV2_2_MASK) == OPCODE_MOV2_2)) {
+		if (*((unsigned long *)(addr+2)) == 0)
+			return 1;
+	}
+	return 0;
+}
+
+#endif /* __ASM_I386_HOOK_PRIVATE_H */
diff -Naru linux-hooks-fix_make/include/asm-ppc/hook.h linux-hooks-resolve/include/asm-ppc/hook.h
--- linux-hooks-fix_make/include/asm-ppc/hook.h	2003-10-29 11:53:04.513262935 +0900
+++ linux-hooks-resolve/include/asm-ppc/hook.h	2003-10-29 11:53:53.892175738 +0900
@@ -5,8 +5,6 @@
  * 
  * Authors: Mike Grundy <grundym@us.ibm.com> s390x
  */
-#include <asm-generic/hook.h>
-
 #if defined(CONFIG_HOOK) || defined(CONFIG_HOOK_MODULE)
 
 #define IF_HOOK_ENABLED(h, hk) _IF_HOOK_ENABLED(h, #hk)
@@ -16,32 +14,4 @@
 	if (unlikely(tmp))
 
 #endif /* CONFIG_HOOK || CONFIG_HOOK_MODULE */
-
-
-/*
- * Sanity check the hook location for valid instructions at hook location.
- * At hook location, we should find these instructions:
- *	38 00 00 00       	li    	r0,0
- *	2c 00 00 00            	cmpwi	r0,0
- *	
- * We can check for li and cmpwi instructions. As these instructions encode
- * the register name in the second byte and the register cannot be predicted, 
- * we mask out the bits corresponding to registers in the opcode before comparing.
- * PPC opcodes are six bits, hence mask of 0xFC
- */
-#define OPCODE_MOV1			0x38 /* LI (really an extended mnemonic for addi */   
-#define OPCODE_MOV1_MASK		0xFC
-/* Compiler generates 2c 00 00 00     cmpwi   r0,0 */
-		
-static inline int is_asm_hook(unsigned char * addr)
-{
-	if (!addr)
-		return 0;
-	
-	if((addr[0] & OPCODE_MOV1_MASK) == OPCODE_MOV1) {
-		if (*((unsigned short *)(addr+1)) == 0)
-			return 1;
-	}
-	return 0;
-}
 #endif /* __ASM_PPC_HOOK_H */
diff -Naru linux-hooks-fix_make/include/asm-ppc/hook_private.h linux-hooks-resolve/include/asm-ppc/hook_private.h
--- linux-hooks-fix_make/include/asm-ppc/hook_private.h	1970-01-01 09:00:00.000000000 +0900
+++ linux-hooks-resolve/include/asm-ppc/hook_private.h	2003-10-29 11:53:53.892175738 +0900
@@ -0,0 +1,35 @@
+#ifndef __ASM_PPC_HOOK_PRIVATE_H
+#define __ASM_PPC_HOOK_PRIVATE_H
+/*
+ * Kernel Hooks optimized for PPC.
+ * 
+ * Authors: Mike Grundy <grundym@us.ibm.com> s390x
+ */
+#include <asm-generic/hook_private.h>
+/*
+ * Sanity check the hook location for valid instructions at hook location.
+ * At hook location, we should find these instructions:
+ *	38 00 00 00       	li    	r0,0
+ *	2c 00 00 00            	cmpwi	r0,0
+ *	
+ * We can check for li and cmpwi instructions. As these instructions encode
+ * the register name in the second byte and the register cannot be predicted, 
+ * we mask out the bits corresponding to registers in the opcode before comparing.
+ * PPC opcodes are six bits, hence mask of 0xFC
+ */
+#define OPCODE_MOV1			0x38 /* LI (really an extended mnemonic for addi */   
+#define OPCODE_MOV1_MASK		0xFC
+/* Compiler generates 2c 00 00 00     cmpwi   r0,0 */
+		
+static inline int is_asm_hook(unsigned char * addr)
+{
+	if (!addr)
+		return 0;
+	
+	if((addr[0] & OPCODE_MOV1_MASK) == OPCODE_MOV1) {
+		if (*((unsigned short *)(addr+1)) == 0)
+			return 1;
+	}
+	return 0;
+}
+#endif /* __ASM_PPC_HOOK_PRIVATE_H */
diff -Naru linux-hooks-fix_make/include/asm-ppc64/hook.h linux-hooks-resolve/include/asm-ppc64/hook.h
--- linux-hooks-fix_make/include/asm-ppc64/hook.h	2003-10-29 11:53:04.514262731 +0900
+++ linux-hooks-resolve/include/asm-ppc64/hook.h	2003-10-29 11:53:53.892175738 +0900
@@ -5,8 +5,6 @@
  * 
  * Authors: Mike Grundy <grundym@us.ibm.com> PPC64
  */
-#include <asm-generic/hook.h>
-
 #if defined(CONFIG_HOOK) || defined(CONFIG_HOOK_MODULE)
 
 #define IF_HOOK_ENABLED(h, hk) _IF_HOOK_ENABLED(h, #hk)
@@ -16,32 +14,4 @@
 	if (unlikely(tmp))
 
 #endif /* CONFIG_HOOK || CONFIG_HOOK_MODULE */
-
-
-/*
- * Sanity check the hook location for valid instructions at hook location.
- * At hook location, we should find these instructions:
- *	38 00 00 00       	li    	r0,0
- *	2c 00 00 00            	cmpwi	r0,0
- *	
- * We can check for li and cmpwi instructions. As these instructions encode
- * the register name in the second byte and the register cannot be predicted, 
- * we mask out the bits corresponding to registers in the opcode before comparing.
- * PPC opcodes are six bits, hence mask of 0xFC
- */
-#define OPCODE_MOV1			0x38 /* LI (really an extended mnemonic for addi */   
-#define OPCODE_MOV1_MASK		0xFC
-/* Compiler generates 2c 00 00 00     cmpwi   r0,0 */
-		
-static inline int is_asm_hook(unsigned char * addr)
-{
-	if (!addr)
-		return 0;
-	
-	if((addr[0] & OPCODE_MOV1_MASK) == OPCODE_MOV1) {
-		if (*((unsigned short *)(addr+1)) == 0)
-			return 1;
-	}
-	return 0;
-}
 #endif /* __ASM_PPC_HOOK_H */
diff -Naru linux-hooks-fix_make/include/asm-ppc64/hook_private.h linux-hooks-resolve/include/asm-ppc64/hook_private.h
--- linux-hooks-fix_make/include/asm-ppc64/hook_private.h	1970-01-01 09:00:00.000000000 +0900
+++ linux-hooks-resolve/include/asm-ppc64/hook_private.h	2003-10-29 11:53:53.893175534 +0900
@@ -0,0 +1,35 @@
+#ifndef __ASM_PPC_HOOK_PRIVATE_H
+#define __ASM_PPC_HOOK_PRIVATE_H
+/*
+ * Kernel Hooks optimized for PPC64.
+ * 
+ * Authors: Mike Grundy <grundym@us.ibm.com> PPC64
+ */
+#include <asm-generic/hook_private.h>
+/*
+ * Sanity check the hook location for valid instructions at hook location.
+ * At hook location, we should find these instructions:
+ *	38 00 00 00       	li    	r0,0
+ *	2c 00 00 00            	cmpwi	r0,0
+ *	
+ * We can check for li and cmpwi instructions. As these instructions encode
+ * the register name in the second byte and the register cannot be predicted, 
+ * we mask out the bits corresponding to registers in the opcode before comparing.
+ * PPC opcodes are six bits, hence mask of 0xFC
+ */
+#define OPCODE_MOV1			0x38 /* LI (really an extended mnemonic for addi */   
+#define OPCODE_MOV1_MASK		0xFC
+/* Compiler generates 2c 00 00 00     cmpwi   r0,0 */
+		
+static inline int is_asm_hook(unsigned char * addr)
+{
+	if (!addr)
+		return 0;
+	
+	if((addr[0] & OPCODE_MOV1_MASK) == OPCODE_MOV1) {
+		if (*((unsigned short *)(addr+1)) == 0)
+			return 1;
+	}
+	return 0;
+}
+#endif /* __ASM_PPC_HOOK_PRIVATE_H */
diff -Naru linux-hooks-fix_make/include/asm-s390/hook.h linux-hooks-resolve/include/asm-s390/hook.h
--- linux-hooks-fix_make/include/asm-s390/hook.h	2003-10-29 11:53:04.514262731 +0900
+++ linux-hooks-resolve/include/asm-s390/hook.h	2003-10-29 11:53:53.893175534 +0900
@@ -5,8 +5,6 @@
  * 
  * Authors: Mike Grundy <grundym@us.ibm.com> s390
  */
-#include <asm-generic/hook.h>
-
 #if defined(CONFIG_HOOK) || defined(CONFIG_HOOK_MODULE)
 
 #define IF_HOOK_ENABLED(h, hk) _IF_HOOK_ENABLED(h, #hk)
@@ -16,34 +14,4 @@
 	if (unlikely(tmp))
 
 #endif /* CONFIG_HOOK || CONFIG_HOOK_MODULE */
-
-/*
- * Sanity check the hook location for valid instructions at hook location.
- * At hook location, we should find these instructions:
- *  a7 18 00 00             lhi     %r1,0
- *  12 11                   ltr     %r1,%r1
- * We can check for the lhi and ltr instructions. As the lhi instruction encodes
- * the register name in it, and we can't guarantee which register will be used,
- * we'll mask out the bits corresponding to the target register.
- */
-#define OPCODE_MOV2_1			0xa7 /* LHI first byte */
-#define OPCODE_MOV2_2			0x08 /* LHI second byte */
-#define OPCODE_MOV2_1_MASK		0xff
-#define OPCODE_MOV2_2_MASK		0x0f
-/* Compiler generates LTR opcode 12, but second op not tested */
-		
-static inline int is_asm_hook(unsigned char * addr)
-{
-	if (!addr){
-		return 0;
-	}
-	if (((addr[0] & OPCODE_MOV2_1_MASK) == OPCODE_MOV2_1) && 
-		    ((addr[1] & OPCODE_MOV2_2_MASK) == OPCODE_MOV2_2)) {
-		/* was checking a 32bit val, need to check 16, cheated with 8+8 */
-		if (addr[2]== 0 && addr[3]== 0){
-			return 1;
-		}
-	}
-	return 0;
-}
 #endif /* __ASM_S390_HOOK_H */
diff -Naru linux-hooks-fix_make/include/asm-s390/hook_private.h linux-hooks-resolve/include/asm-s390/hook_private.h
--- linux-hooks-fix_make/include/asm-s390/hook_private.h	1970-01-01 09:00:00.000000000 +0900
+++ linux-hooks-resolve/include/asm-s390/hook_private.h	2003-10-29 11:53:53.893175534 +0900
@@ -0,0 +1,38 @@
+#ifndef __ASM_S390_HOOK_PRIVATE_H
+#define __ASM_S390_HOOK_PRIVATE_H
+/*
+ * Kernel Hooks optimized for s390.
+ * 
+ * Authors: Mike Grundy <grundym@us.ibm.com> s390
+ */
+#include <asm-generic/hook_private.h>
+/*
+ * Sanity check the hook location for valid instructions at hook location.
+ * At hook location, we should find these instructions:
+ *  a7 18 00 00             lhi     %r1,0
+ *  12 11                   ltr     %r1,%r1
+ * We can check for the lhi and ltr instructions. As the lhi instruction encodes
+ * the register name in it, and we can't guarantee which register will be used,
+ * we'll mask out the bits corresponding to the target register.
+ */
+#define OPCODE_MOV2_1			0xa7 /* LHI first byte */
+#define OPCODE_MOV2_2			0x08 /* LHI second byte */
+#define OPCODE_MOV2_1_MASK		0xff
+#define OPCODE_MOV2_2_MASK		0x0f
+/* Compiler generates LTR opcode 12, but second op not tested */
+		
+static inline int is_asm_hook(unsigned char * addr)
+{
+	if (!addr){
+		return 0;
+	}
+	if (((addr[0] & OPCODE_MOV2_1_MASK) == OPCODE_MOV2_1) && 
+		    ((addr[1] & OPCODE_MOV2_2_MASK) == OPCODE_MOV2_2)) {
+		/* was checking a 32bit val, need to check 16, cheated with 8+8 */
+		if (addr[2]== 0 && addr[3]== 0){
+			return 1;
+		}
+	}
+	return 0;
+}
+#endif /* __ASM_S390_HOOK_PRIVATE_H */
diff -Naru linux-hooks-fix_make/include/asm-s390x/hook.h linux-hooks-resolve/include/asm-s390x/hook.h
--- linux-hooks-fix_make/include/asm-s390x/hook.h	2003-10-29 11:53:04.515262527 +0900
+++ linux-hooks-resolve/include/asm-s390x/hook.h	2003-10-29 11:53:53.894175330 +0900
@@ -5,8 +5,6 @@
  * 
  * Authors: Mike Grundy <grundym@us.ibm.com> s390x
  */
-#include <asm-generic/hook.h>
-
 #if defined(CONFIG_HOOK) || defined(CONFIG_HOOK_MODULE)
 
 #define IF_HOOK_ENABLED(h, hk) _IF_HOOK_ENABLED(h, #hk)
@@ -16,34 +14,4 @@
 	if (unlikely(tmp))
 
 #endif /* CONFIG_HOOK || CONFIG_HOOK_MODULE */
-
-/*
- * Sanity check the hook location for valid instructions at hook location.
- * At hook location, we should find these instructions:
- *  a7 18 00 00             lhi     %r1,0
- *  12 11                   ltr     %r1,%r1
- * We can check for the lhi and ltr instructions. As the lhi instruction encodes
- * the register name in it, and we can't guarantee which register will be used,
- * we'll mask out the bits corresponding to the target register.
- */
-#define OPCODE_MOV2_1			0xa7 /* LHI first byte */
-#define OPCODE_MOV2_2			0x08 /* LHI second byte */
-#define OPCODE_MOV2_1_MASK		0xff
-#define OPCODE_MOV2_2_MASK		0x0f
-/* Compiler generates LTR opcode 12, but second op not tested */
-		
-static inline int is_asm_hook(unsigned char * addr)
-{
-	if (!addr){
-		return 0;
-	}
-	if (((addr[0] & OPCODE_MOV2_1_MASK) == OPCODE_MOV2_1) && 
-		    ((addr[1] & OPCODE_MOV2_2_MASK) == OPCODE_MOV2_2)) {
-		/* was checking a 32bit val, need to check 16, cheated with 8+8 */
-		if (addr[2]== 0 && addr[3]== 0){
-			return 1;
-		}
-	}
-	return 0;
-}
 #endif /* __ASM_S390X_HOOK_H */
diff -Naru linux-hooks-fix_make/include/asm-s390x/hook_private.h linux-hooks-resolve/include/asm-s390x/hook_private.h
--- linux-hooks-fix_make/include/asm-s390x/hook_private.h	1970-01-01 09:00:00.000000000 +0900
+++ linux-hooks-resolve/include/asm-s390x/hook_private.h	2003-10-29 11:53:53.894175330 +0900
@@ -0,0 +1,39 @@
+#ifndef __ASM_S390X_HOOK_PRIVATE_H
+#define __ASM_S390X_HOOK_PRIVATE_H
+/*
+ * Kernel Hooks optimized for s390x(64bit).
+ * 
+ * Authors: Mike Grundy <grundym@us.ibm.com> s390x
+ */
+#include <asm-generic/hook_private.h>
+
+/*
+ * Sanity check the hook location for valid instructions at hook location.
+ * At hook location, we should find these instructions:
+ *  a7 18 00 00             lhi     %r1,0
+ *  12 11                   ltr     %r1,%r1
+ * We can check for the lhi and ltr instructions. As the lhi instruction encodes
+ * the register name in it, and we can't guarantee which register will be used,
+ * we'll mask out the bits corresponding to the target register.
+ */
+#define OPCODE_MOV2_1			0xa7 /* LHI first byte */
+#define OPCODE_MOV2_2			0x08 /* LHI second byte */
+#define OPCODE_MOV2_1_MASK		0xff
+#define OPCODE_MOV2_2_MASK		0x0f
+/* Compiler generates LTR opcode 12, but second op not tested */
+		
+static inline int is_asm_hook(unsigned char * addr)
+{
+	if (!addr){
+		return 0;
+	}
+	if (((addr[0] & OPCODE_MOV2_1_MASK) == OPCODE_MOV2_1) && 
+		    ((addr[1] & OPCODE_MOV2_2_MASK) == OPCODE_MOV2_2)) {
+		/* was checking a 32bit val, need to check 16, cheated with 8+8 */
+		if (addr[2]== 0 && addr[3]== 0){
+			return 1;
+		}
+	}
+	return 0;
+}
+#endif /* __ASM_S390X_HOOK_PRIVATE_H */
diff -Naru linux-hooks-fix_make/include/linux/hook.h linux-hooks-resolve/include/linux/hook.h
--- linux-hooks-fix_make/include/linux/hook.h	2003-10-29 11:53:04.515262527 +0900
+++ linux-hooks-resolve/include/linux/hook.h	2003-10-29 11:53:53.894175330 +0900
@@ -7,7 +7,6 @@
  *	    Vamsi Krishna S. <vamsi_krishna@in.ibm.com>
  */
 #include <linux/compiler.h>
-#include <linux/module.h>
 #include <linux/list.h>
 
 /* define the user (kernel module) hook structure */
@@ -31,7 +30,6 @@
 /* hook flags */
 #define HOOK_ARMED		0x00000001
 #define HOOK_REGISTERED		0x00000002
-#define HOOK_EXCLUSIVE		0x0000000c
 
 /*
  * Use the DECLARE_HOOK macro to define the hook structure in global 
@@ -83,10 +81,6 @@
 
 #ifdef CONFIG_ASM_HOOK
 #include <asm/hook.h>
-#else
-static inline int is_asm_hook(unsigned char *addr) {return 0;}
-static inline void activate_asm_hook(struct hook *hook) { }
-static inline void deactivate_asm_hook(struct hook *hook) { }
 #endif
 
 #ifndef IF_HOOK_ENABLED
diff -Naru linux-hooks-fix_make/kernel/hook.c linux-hooks-resolve/kernel/hook.c
--- linux-hooks-fix_make/kernel/hook.c	2003-10-29 11:53:04.516262322 +0900
+++ linux-hooks-resolve/kernel/hook.c	2003-10-29 11:53:53.923169407 +0900
@@ -14,6 +14,15 @@
 #include <asm/system.h>
 #include <asm/uaccess.h>
 
+/* for private inline functions.*/
+#ifdef CONFIG_ASM_HOOK
+#include <asm/hook_private.h>
+#else
+static inline int is_asm_hook(unsigned char *addr) {return 0;}
+static inline void activate_asm_hook(struct hook *hook) { }
+static inline void deactivate_asm_hook(struct hook *hook) { }
+#endif
+
 static spinlock_t hook_lock = SPIN_LOCK_UNLOCKED;
 
 static inline void deactivate_hook(struct hook *hook)
