lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8aa4496d067c1f95c7bacb0849cacf50@pinky>
Date:	Wed, 07 Mar 2007 13:21:46 +0000
From:	Andy Whitcroft <apw@...dowen.org>
To:	Marc Dietrich <Marc.Dietrich@...physik.uni-giessen.de>
Cc:	Andrew Morton <akpm@...l.org>, Andy Whitcroft <apw@...dowen.org>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] i386 alternative_io implementation


Add an i386 implementation of alternative_io modelled on
the x86_64 version.

Signed-off-by: Andy Whitcroft <apw@...dowen.org>
---

	Ok, this seems to fix things up here.  I have only boot
	tested this on an SMP so I'd not call that 'heavily tested'
	in any real sense but it might get you going until akpm
	has a chance to comment.

	-apw

---
diff --git a/include/asm-i386/alternative.h b/include/asm-i386/alternative.h
index 4a77e93..8b6d9ed 100644
--- a/include/asm-i386/alternative.h
+++ b/include/asm-i386/alternative.h
@@ -100,6 +100,23 @@ static inline void alternatives_smp_switch(int smp) {}
 		      "663:\n\t" newinstr "\n664:\n"   /* replacement */\
 		      ".previous" :: "i" (feature), ##input)
 
+#define alternative_io(oldinstr, newinstr, feature, output, input...)	\
+	asm volatile ("661:\n\t" oldinstr "\n662:\n"			\
+		      ".section .altinstructions,\"a\"\n"		\
+		      "  .align 4\n"					\
+		      "  .long 661b\n"            /* label */		\
+		      "  .long 663f\n"		  /* new instruction */ \
+		      "  .long 0x00\n"					\
+		      "  .byte %c[feat]\n"        /* feature bit */	\
+		      "  .byte 0x00\n"					\
+		      "  .byte 662b-661b\n"       /* sourcelen */	\
+		      "  .byte 664f-663f\n"       /* replacementlen */ 	\
+		      "  .byte 0x00\n"					\
+		      ".previous\n"					\
+		      ".section .altinstr_replacement,\"ax\"\n"		\
+		      "663:\n\t" newinstr "\n664:\n"   /* replacement */\
+		      ".previous" : output : [feat] "i" (feature), ##input)
+
 /* Like alternative_io, but supports 2 possible alternatives */
 #define alternative_io_two(oldinstr, newinstr, feat, newinstr2, feat2,\
 		output, input...) \
diff --git a/include/asm-i386/tsc.h b/include/asm-i386/tsc.h
index 3469766..a031b56 100644
--- a/include/asm-i386/tsc.h
+++ b/include/asm-i386/tsc.h
@@ -6,6 +6,7 @@
 #ifndef _ASM_i386_TSC_H
 #define _ASM_i386_TSC_H
 
+#include <asm/alternative.h>
 #include <asm/processor.h>
 
 /*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ