From: BitKeeper B. <ri...@su...> - 2005-02-27 11:03:34
|
ChangeSet 1.1159.256.16, 2005/02/27 10:37:32+00:00, ka...@sc... Fix 2.4 build, and a small 2.6 bootstrap tweak. Signed-off-by: Keir Fraser <ke...@xe...> b/linux-2.4.29-xen-sparse/include/asm-xen/system.h | 16 +++ b/linux-2.4.29-xen-sparse/mkbuildtree | 1 b/linux-2.6.10-xen-sparse/arch/xen/i386/mm/init.c | 4 linux-2.4.29-xen-sparse/include/asm-xen/synch_bitops.h | 83 ----------------- 4 files changed, 18 insertions(+), 86 deletions(-) diff -Nru a/linux-2.4.29-xen-sparse/include/asm-xen/synch_bitops.h b/linux-2.4.29-xen-sparse/include/asm-xen/synch_bitops.h --- a/linux-2.4.29-xen-sparse/include/asm-xen/synch_bitops.h 2005-02-27 06:03:24 -05:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,83 +0,0 @@ -#ifndef __XEN_SYNCH_BITOPS_H__ -#define __XEN_SYNCH_BITOPS_H__ - -/* - * Copyright 1992, Linus Torvalds. - * Heavily modified to provide guaranteed strong synchronisation - * when communicating with Xen or other guest OSes running on other CPUs. - */ - -#include <linux/config.h> - -#define ADDR (*(volatile long *) addr) - -static __inline__ void synch_set_bit(int nr, volatile void * addr) -{ - __asm__ __volatile__ ( - "lock btsl %1,%0" - : "=m" (ADDR) : "Ir" (nr) : "memory" ); -} - -static __inline__ void synch_clear_bit(int nr, volatile void * addr) -{ - __asm__ __volatile__ ( - "lock btrl %1,%0" - : "=m" (ADDR) : "Ir" (nr) : "memory" ); -} - -static __inline__ void synch_change_bit(int nr, volatile void * addr) -{ - __asm__ __volatile__ ( - "lock btcl %1,%0" - : "=m" (ADDR) : "Ir" (nr) : "memory" ); -} - -static __inline__ int synch_test_and_set_bit(int nr, volatile void * addr) -{ - int oldbit; - __asm__ __volatile__ ( - "lock btsl %2,%1\n\tsbbl %0,%0" - : "=r" (oldbit), "=m" (ADDR) : "Ir" (nr) : "memory"); - return oldbit; -} - -static __inline__ int synch_test_and_clear_bit(int nr, volatile void * addr) -{ - int oldbit; - __asm__ __volatile__ ( - "lock btrl %2,%1\n\tsbbl %0,%0" - : "=r" (oldbit), "=m" (ADDR) : "Ir" (nr) : "memory"); - return oldbit; -} - -static __inline__ int synch_test_and_change_bit(int nr, volatile void * addr) -{ - int oldbit; - - __asm__ __volatile__ ( - "lock btcl %2,%1\n\tsbbl %0,%0" - : "=r" (oldbit), "=m" (ADDR) : "Ir" (nr) : "memory"); - return oldbit; -} - -static __inline__ int synch_const_test_bit(int nr, const volatile void * addr) -{ - return ((1UL << (nr & 31)) & - (((const volatile unsigned int *) addr)[nr >> 5])) != 0; -} - -static __inline__ int synch_var_test_bit(int nr, volatile void * addr) -{ - int oldbit; - __asm__ __volatile__ ( - "btl %2,%1\n\tsbbl %0,%0" - : "=r" (oldbit) : "m" (ADDR), "Ir" (nr) ); - return oldbit; -} - -#define synch_test_bit(nr,addr) \ -(__builtin_constant_p(nr) ? \ - synch_const_test_bit((nr),(addr)) : \ - synch_var_test_bit((nr),(addr))) - -#endif /* __XEN_SYNCH_BITOPS_H__ */ diff -Nru a/linux-2.4.29-xen-sparse/include/asm-xen/system.h b/linux-2.4.29-xen-sparse/include/asm-xen/system.h --- a/linux-2.4.29-xen-sparse/include/asm-xen/system.h 2005-02-27 06:03:24 -05:00 +++ b/linux-2.4.29-xen-sparse/include/asm-xen/system.h 2005-02-27 06:03:24 -05:00 @@ -113,6 +113,22 @@ #endif /* __KERNEL__ */ +/** + * __ffs - find first bit in word. + * @word: The word to search + * + * Undefined if no bit exists, so code should check against 0 first. + * + * Taken from 2.6 for Xen. + */ +static inline unsigned long __ffs(unsigned long word) +{ + __asm__("bsfl %1,%0" + :"=r" (word) + :"rm" (word)); + return word; +} + static inline unsigned long get_limit(unsigned long segment) { unsigned long __limit; diff -Nru a/linux-2.4.29-xen-sparse/mkbuildtree b/linux-2.4.29-xen-sparse/mkbuildtree --- a/linux-2.4.29-xen-sparse/mkbuildtree 2005-02-27 06:03:23 -05:00 +++ b/linux-2.4.29-xen-sparse/mkbuildtree 2005-02-27 06:03:23 -05:00 @@ -211,6 +211,7 @@ ln -sf ../../${LINUX_26}/include/asm-xen/hypervisor.h ln -sf ../../${LINUX_26}/include/asm-xen/multicall.h ln -sf ../../${LINUX_26}/include/asm-xen/xen_proc.h +ln -sf ../../${LINUX_26}/include/asm-xen/asm-i386/synch_bitops.h mkdir -p linux-public && cd linux-public ln -sf ../../../${LINUX_26}/include/asm-xen/linux-public/privcmd.h diff -Nru a/linux-2.6.10-xen-sparse/arch/xen/i386/mm/init.c b/linux-2.6.10-xen-sparse/arch/xen/i386/mm/init.c --- a/linux-2.6.10-xen-sparse/arch/xen/i386/mm/init.c 2005-02-27 06:03:23 -05:00 +++ b/linux-2.6.10-xen-sparse/arch/xen/i386/mm/init.c 2005-02-27 06:03:24 -05:00 @@ -179,9 +179,7 @@ pte += pte_ofs; for (; pte_ofs < PTRS_PER_PTE && pfn < max_low_pfn; pte++, pfn++, pte_ofs++) { /* XEN: Only map initial RAM allocation. */ - if (pfn >= max_ram_pfn) - break; - if (pte_present(*pte)) + if ((pfn >= max_ram_pfn) || pte_present(*pte)) continue; if (is_kernel_text(address)) set_pte(pte, pfn_pte(pfn, PAGE_KERNEL_EXEC)); |