* [PATCH] x86: BITS_PER_LONG is now always 64
@ 2013-03-19 17:15 Jan Beulich
2013-03-19 17:52 ` Keir Fraser
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2013-03-19 17:15 UTC (permalink / raw)
To: xen-devel; +Cc: Keir Fraser
[-- Attachment #1: Type: text/plain, Size: 3027 bytes --]
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- 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))
-#elif BITS_PER_LONG == 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
#include <xen/types.h>
-#if BITS_PER_LONG == 64
-
#define do_div(n,base) ({ \
uint32_t __base = (base); \
uint32_t __rem; \
@@ -13,37 +11,4 @@
__rem; \
})
-#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 = (base); \
- asm ( "" : "=a" (__low), "=d" (__high) : "A" (n) ); \
- __upper = __high; \
- if ( __high ) \
- { \
- __upper = __high % (__base); \
- __high = __high / (__base); \
- } \
- asm ( "divl %2" \
- : "=a" (__low), "=d" (__mod) \
- : "rm" (__base), "0" (__low), "1" (__upper) ); \
- asm ( "" : "=A" (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 == 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
/* VRAM dirty tracking support */
struct sh_dirty_vram {
[-- Attachment #2: x86-always-64-bits-per-long.patch --]
[-- Type: text/plain, Size: 3060 bytes --]
x86: BITS_PER_LONG is now always 64
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- 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))
-#elif BITS_PER_LONG == 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
#include <xen/types.h>
-#if BITS_PER_LONG == 64
-
#define do_div(n,base) ({ \
uint32_t __base = (base); \
uint32_t __rem; \
@@ -13,37 +11,4 @@
__rem; \
})
-#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 = (base); \
- asm ( "" : "=a" (__low), "=d" (__high) : "A" (n) ); \
- __upper = __high; \
- if ( __high ) \
- { \
- __upper = __high % (__base); \
- __high = __high / (__base); \
- } \
- asm ( "divl %2" \
- : "=a" (__low), "=d" (__mod) \
- : "rm" (__base), "0" (__low), "1" (__upper) ); \
- asm ( "" : "=A" (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 == 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
/* VRAM dirty tracking support */
struct sh_dirty_vram {
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] x86: BITS_PER_LONG is now always 64
2013-03-19 17:15 [PATCH] x86: BITS_PER_LONG is now always 64 Jan Beulich
@ 2013-03-19 17:52 ` Keir Fraser
0 siblings, 0 replies; 2+ messages in thread
From: Keir Fraser @ 2013-03-19 17:52 UTC (permalink / raw)
To: Jan Beulich, xen-devel
On 19/03/2013 17:15, "Jan Beulich" <JBeulich@suse.com> wrote:
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
> --- 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))
>
> -#elif BITS_PER_LONG == 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
>
> #include <xen/types.h>
>
> -#if BITS_PER_LONG == 64
> -
> #define do_div(n,base) ({ \
> uint32_t __base = (base); \
> uint32_t __rem; \
> @@ -13,37 +11,4 @@
> __rem; \
> })
>
> -#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 = (base); \
> - asm ( "" : "=a" (__low), "=d" (__high) : "A" (n) ); \
> - __upper = __high; \
> - if ( __high ) \
> - { \
> - __upper = __high % (__base); \
> - __high = __high / (__base); \
> - } \
> - asm ( "divl %2" \
> - : "=a" (__low), "=d" (__mod) \
> - : "rm" (__base), "0" (__low), "1" (__upper) ); \
> - asm ( "" : "=A" (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 == 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
>
> /* VRAM dirty tracking support */
> struct sh_dirty_vram {
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-19 17:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-19 17:15 [PATCH] x86: BITS_PER_LONG is now always 64 Jan Beulich
2013-03-19 17:52 ` Keir Fraser
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).