virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Glauber de Oliveira Costa <gcosta@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: ehabkost@redhat.com, ak@suse.de,
	virtualization@lists.linux-foundation.org, chrisw@sous-sol.org,
	tglx@linutronix.de, anthony@codemonkey.ws, hpa@zytor.com,
	akpm@linux-foundation.org,
	Glauber de Oliveira Costa <gcosta@redhat.com>,
	mingo@elte.hu
Subject: [PATCH 9/10] make fixups wordsize agnostic
Date: Tue,  4 Dec 2007 14:03:59 -0200	[thread overview]
Message-ID: <1196784287349-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <11967842821886-git-send-email-gcosta@redhat.com>

This patch uses the _ASM_ALIGN and _ASM_PTR macros
to make the fixups in native_read/write_msr_safe look the same
for x86_64 and i386. Besides using this macros, we also have to
take the explicit instruction suffixes out. It's okay
because all this instructions uses registers, and can be sized by
them.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
---
 include/asm-x86/msr.h |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/include/asm-x86/msr.h b/include/asm-x86/msr.h
index 9c695c7..f3a01ca 100644
--- a/include/asm-x86/msr.h
+++ b/include/asm-x86/msr.h
@@ -29,6 +29,7 @@ static inline unsigned long long native_read_tscp(int *aux)
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
 
+#include <asm/asm.h>
 #include <asm/errno.h>
 
 static inline unsigned long long native_read_msr(unsigned int msr)
@@ -44,14 +45,14 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr,
 {
 	unsigned long long val;
 
-	asm volatile("2: rdmsr ; xorl %0,%0\n"
+	asm volatile("2: rdmsr ; xor %0,%0\n"
 		     "1:\n\t"
 		     ".section .fixup,\"ax\"\n\t"
-		     "3:  movl %3,%0 ; jmp 1b\n\t"
+		     "3:  mov %3,%0 ; jmp 1b\n\t"
 		     ".previous\n\t"
 		     ".section __ex_table,\"a\"\n"
-		     "   .align 4\n\t"
-		     "   .long	2b,3b\n\t"
+		     _ASM_ALIGN "\n\t"
+		     _ASM_PTR " 2b,3b\n\t"
 		     ".previous"
 		     : "=r" (*err), "=A" (val)
 		     : "c" (msr), "i" (-EFAULT));
@@ -69,14 +70,14 @@ static inline int native_write_msr_safe(unsigned int msr,
 					unsigned low, unsigned high)
 {
 	int err;
-	asm volatile("2: wrmsr ; xorl %0,%0\n"
+	asm volatile("2: wrmsr ; xor %0,%0\n"
 		     "1:\n\t"
 		     ".section .fixup,\"ax\"\n\t"
-		     "3:  movl %4,%0 ; jmp 1b\n\t"
+		     "3:  mov %4,%0 ; jmp 1b\n\t"
 		     ".previous\n\t"
 		     ".section __ex_table,\"a\"\n"
-		     "   .align 4\n\t"
-		     "   .long	2b,3b\n\t"
+		     _ASM_ALIGN "\n\t"
+		     _ASM_PTR " 2b,3b\n\t"
 		     ".previous"
 		     : "=a" (err)
 		     : "c" (msr), "0" (low), "d" (high),
-- 
1.4.4.2

  reply	other threads:[~2007-12-04 16:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-04 16:03 [PATCH 0/10 - V2] msr.h integration - fixups Glauber de Oliveira Costa
2007-12-04 16:03 ` [PATCH 1/10] Wipe out traditional opt from x86_64 Makefile Glauber de Oliveira Costa
     [not found] ` <11967842482873-git-send-email-gcosta@redhat.com>
2007-12-04 16:03   ` [PATCH 2/10] unify msr smp funcs Glauber de Oliveira Costa
     [not found]   ` <11967842531735-git-send-email-gcosta@redhat.com>
2007-12-04 16:03     ` [PATCH 3/10] allow sched clock to be overridden by paravirt Glauber de Oliveira Costa
     [not found]     ` <11967842573035-git-send-email-gcosta@redhat.com>
2007-12-04 16:03       ` [PATCH 4/10] split get_cycles_sync Glauber de Oliveira Costa
2007-12-04 16:03         ` [PATCH 5/10] unify cpuid functions Glauber de Oliveira Costa
2007-12-04 16:03           ` [PATCH 6/10] introduce native_read_tscp Glauber de Oliveira Costa
2007-12-04 16:03             ` [PATCH 7/10] change rdpmc interface Glauber de Oliveira Costa
2007-12-04 16:03               ` [PATCH 8/10] change write msr functions interface Glauber de Oliveira Costa
2007-12-04 16:03                 ` Glauber de Oliveira Costa [this message]
2007-12-04 16:04                   ` [PATCH 10/10] integrate i386 and x86_64 code in msr.h Glauber de Oliveira Costa
2007-12-04 20:43 ` [PATCH 0/10 - V2] msr.h integration - fixups Ingo Molnar
     [not found] <11967666042130-git-send-email-gcosta@redhat.com>
2007-12-04 11:09 ` [PATCH 1/10] Wipe out traditional opt from x86_64 Makefile Glauber de Oliveira Costa
     [not found]   ` <11967666161585-git-send-email-gcosta@redhat.com>
     [not found]     ` <11967666212496-git-send-email-gcosta@redhat.com>
     [not found]       ` <11967666263502-git-send-email-gcosta@redhat.com>
2007-12-04 11:09         ` [PATCH 5/10] unify cpuid functions Glauber de Oliveira Costa
2007-12-04 11:10           ` [PATCH 6/10] introduce native_read_tscp Glauber de Oliveira Costa
2007-12-04 11:10             ` [PATCH 7/10] change rdpmc interface Glauber de Oliveira Costa
2007-12-04 11:10               ` [PATCH 8/10] change write msr functions interface Glauber de Oliveira Costa
2007-12-04 11:10                 ` [PATCH 9/10] make fixups wordsize agnostic Glauber de Oliveira Costa

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=1196784287349-git-send-email-gcosta@redhat.com \
    --to=gcosta@redhat.com \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=anthony@codemonkey.ws \
    --cc=chrisw@sous-sol.org \
    --cc=ehabkost@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=virtualization@lists.linux-foundation.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;
as well as URLs for NNTP newsgroup(s).