From: Andy Whitcroft <apw@shadowen.org>
To: Marc Dietrich <Marc.Dietrich@ap.physik.uni-giessen.de>
Cc: Andrew Morton <akpm@osdl.org>, Andy Whitcroft <apw@shadowen.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH] i386 alternative_io implementation
Date: Wed, 07 Mar 2007 13:21:46 +0000 [thread overview]
Message-ID: <8aa4496d067c1f95c7bacb0849cacf50@pinky> (raw)
In-Reply-To: <200703071254.03014.marc.dietrich@ap.physik.uni-giessen.de>
Add an i386 implementation of alternative_io modelled on
the x86_64 version.
Signed-off-by: Andy Whitcroft <apw@shadowen.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>
/*
prev parent reply other threads:[~2007-03-07 13:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-07 11:53 2.6.21-rc2-mm2 fails does not compile Marc Dietrich
2007-03-07 13:21 ` Andy Whitcroft [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8aa4496d067c1f95c7bacb0849cacf50@pinky \
--to=apw@shadowen.org \
--cc=Marc.Dietrich@ap.physik.uni-giessen.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®