From: "Jan Beulich" Subject: [PATCH] x86: BITS_PER_LONG is now always 64 Date: Tue, 19 Mar 2013 17:15:08 +0000 Message-ID: <5148AB2C02000078000C6E4D@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartE0D0F40C.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartE0D0F40C.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Signed-off-by: Jan Beulich --- a/xen/arch/x86/cpu/mcheck/mce.c +++ b/xen/arch/x86/cpu/mcheck/mce.c @@ -1204,11 +1204,6 @@ static void x86_mc_mceinject(void *data) #define ID2COOKIE(id) ((mctelem_cookie_t)(id)) #define COOKIE2ID(c) ((uint64_t)(c)) =20 -#elif BITS_PER_LONG =3D=3D 32 - -#define ID2COOKIE(id) ((mctelem_cookie_t)(uint32_t)((id) & 0xffffffffU)) -#define COOKIE2ID(c) ((uint64_t)(uint32_t)(c)) - #elif defined(BITS_PER_LONG) #error BITS_PER_LONG has unexpected value #else --- a/xen/include/asm-x86/div64.h +++ b/xen/include/asm-x86/div64.h @@ -1,10 +1,8 @@ -#ifndef __I386_DIV64 -#define __I386_DIV64 +#ifndef __X86_DIV64 +#define __X86_DIV64 =20 #include =20 -#if BITS_PER_LONG =3D=3D 64 - #define do_div(n,base) ({ \ uint32_t __base =3D (base); \ uint32_t __rem; \ @@ -13,37 +11,4 @@ __rem; \ }) =20 -#else - -/* - * do_div() is NOT a C function. It wants to return - * two values (the quotient and the remainder), but - * since that doesn't work very well in C, what it - * does is: - * - * - modifies the 64-bit dividend _in_place_ - * - returns the 32-bit remainder - * - * This ends up being the most efficient "calling - * convention" on x86. - */ -#define do_div(n,base) ({ \ - unsigned long __upper, __low, __high, __mod, __base; \ - __base =3D (base); \ - asm ( "" : "=3Da" (__low), "=3Dd" (__high) : "A" (n) ); \ - __upper =3D __high; \ - if ( __high ) \ - { \ - __upper =3D __high % (__base); \ - __high =3D __high / (__base); \ - } \ - asm ( "divl %2" \ - : "=3Da" (__low), "=3Dd" (__mod) \ - : "rm" (__base), "0" (__low), "1" (__upper) ); \ - asm ( "" : "=3DA" (n) : "a" (__low), "d" (__high) ); \ - __mod; \ -}) - -#endif - #endif --- a/xen/include/asm-x86/paging.h +++ b/xen/include/asm-x86/paging.h @@ -176,12 +176,8 @@ int paging_mfn_is_dirty(struct domain *d (LOGDIRTY_NODE_ENTRIES-1)) #define L3_LOGDIRTY_IDX(pfn) (((pfn) >> (PAGE_SHIFT+3+PAGETABLE_ORDER)) & = \ (LOGDIRTY_NODE_ENTRIES-1)) -#if BITS_PER_LONG =3D=3D 64 #define L4_LOGDIRTY_IDX(pfn) (((pfn) >> (PAGE_SHIFT+3+PAGETABLE_ORDER*2)) = & \ (LOGDIRTY_NODE_ENTRIES-1)) -#else -#define L4_LOGDIRTY_IDX(pfn) 0 -#endif =20 /* VRAM dirty tracking support */ struct sh_dirty_vram { --=__PartE0D0F40C.0__= Content-Type: text/plain; name="x86-always-64-bits-per-long.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-always-64-bits-per-long.patch" x86: BITS_PER_LONG is now always 64=0A=0ASigned-off-by: Jan Beulich = =0A=0A--- a/xen/arch/x86/cpu/mcheck/mce.c=0A+++ = b/xen/arch/x86/cpu/mcheck/mce.c=0A@@ -1204,11 +1204,6 @@ static void = x86_mc_mceinject(void *data)=0A #define ID2COOKIE(id) ((mctelem_cookie_t)(i= d))=0A #define COOKIE2ID(c) ((uint64_t)(c))=0A =0A-#elif BITS_PER_LONG = =3D=3D 32=0A-=0A-#define ID2COOKIE(id) ((mctelem_cookie_t)(uint32_t)((id) = & 0xffffffffU))=0A-#define COOKIE2ID(c) ((uint64_t)(uint32_t)(c))=0A-=0A = #elif defined(BITS_PER_LONG)=0A #error BITS_PER_LONG has unexpected = value=0A #else=0A--- a/xen/include/asm-x86/div64.h=0A+++ b/xen/include/asm-= x86/div64.h=0A@@ -1,10 +1,8 @@=0A-#ifndef __I386_DIV64=0A-#define = __I386_DIV64=0A+#ifndef __X86_DIV64=0A+#define __X86_DIV64=0A =0A #include = =0A =0A-#if BITS_PER_LONG =3D=3D 64=0A-=0A #define do_div(n,ba= se) ({ \=0A uint32_t __base =3D (base); = \=0A uint32_t __rem; \=0A@@ = -13,37 +11,4 @@=0A __rem; \=0A = })=0A =0A-#else=0A-=0A-/*=0A- * do_div() is NOT a C function. It wants to = return=0A- * two values (the quotient and the remainder), but=0A- * since = that doesn't work very well in C, what it=0A- * does is:=0A- *=0A- * - = modifies the 64-bit dividend _in_place_=0A- * - returns the 32-bit = remainder=0A- *=0A- * This ends up being the most efficient "calling=0A- * = convention" on x86.=0A- */=0A-#define do_div(n,base) ({ = \=0A- unsigned long __upper, __low, __high, __mod, = __base; \=0A- __base =3D (base); = \=0A- asm ( "" : "=3Da" (__low), "=3Dd" (__high) : "A" (n) = ); \=0A- __upper =3D __high; = \=0A- if ( __high ) = \=0A- { = \=0A- __upper =3D __high % (__base); = \=0A- __high =3D __high / (__base); = \=0A- } \=0A- = asm ( "divl %2" \=0A- = : "=3Da" (__low), "=3Dd" (__mod) \=0A- = : "rm" (__base), "0" (__low), "1" (__upper) ); \=0A- asm ( "" : = "=3DA" (n) : "a" (__low), "d" (__high) ); \=0A- __mod; = \=0A-})=0A-=0A-#endif=0A-=0A = #endif=0A--- a/xen/include/asm-x86/paging.h=0A+++ b/xen/include/asm-x86/pag= ing.h=0A@@ -176,12 +176,8 @@ int paging_mfn_is_dirty(struct domain *d=0A = (LOGDIRTY_NODE_ENTRIES-1))=0A #define = L3_LOGDIRTY_IDX(pfn) (((pfn) >> (PAGE_SHIFT+3+PAGETABLE_ORDER)) & \=0A = (LOGDIRTY_NODE_ENTRIES-1))=0A-#if BITS_PER_LONG = =3D=3D 64=0A #define L4_LOGDIRTY_IDX(pfn) (((pfn) >> (PAGE_SHIFT+3+PAGETABL= E_ORDER*2)) & \=0A (LOGDIRTY_NODE_ENTRIES-1))= =0A-#else=0A-#define L4_LOGDIRTY_IDX(pfn) 0=0A-#endif=0A =0A /* VRAM dirty = tracking support */=0A struct sh_dirty_vram {=0A --=__PartE0D0F40C.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__PartE0D0F40C.0__=--