consolidate common 32/64-bit code
PATCH 5/5 consolidate common 32/64-bit code
Long patch, short summary: removes more than 700 LOC by pushing common code in commonly used files. Specifically, there is now only arch/x86/ipipe.c again.
Jan
--- arch/x86/kernel/Makefile_32 | 2 arch/x86/kernel/Makefile_64 | 2 arch/x86/kernel/entry_64.S | 30 - arch/x86/kernel/ipipe.c | 1003 ++++++++++++++++++++++++++++++++++++++++ arch/x86/kernel/ipipe_32.c | 838 --------------------------------- arch/x86/kernel/ipipe_64.c | 803 -------------------------------- include/asm-x86/ipipe.h | 116 ++++ include/asm-x86/ipipe_32.h | 85 --- include/asm-x86/ipipe_64.h | 85 --- include/asm-x86/ipipe_base.h | 93 +++ include/asm-x86/ipipe_base_32.h | 63 -- include/asm-x86/ipipe_base_64.h | 63 -- include/asm-x86/unistd_64.h | 2 13 files changed, 1229 insertions(+), 1956 deletions(-)
include/asm-x86/ipipe_base.h +93 -0
@@ -1,5 +1,98 @@ +/* -*- linux-c -*- +* include/asm-x86/ipipe_base.h +* +* Copyright (C) 2007 Philippe Gerum. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139, +* USA; either version 2 of the License, or (at your option) any later +* version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef __X86_IPIPE_BASE_H +#define __X86_IPIPE_BASE_H +#ifdef CONFIG_X86_32 # include "ipipe_base_32.h" #else # include "ipipe_base_64.h" #endif + +#define ex_do_divide_error 0 +#define ex_do_debug 1 +/* NMI not pipelined. */ +#define ex_do_int3 3 +#define ex_do_overflow 4 +#define ex_do_bounds 5 +#define ex_do_invalid_op 6 +#define ex_device_not_available 7/* x86_32 */ +#define ex_math_state_restore 7/* x86_64 */ +/* Double fault not pipelined. */ +#define ex_do_coprocessor_segment_overrun 9 +#define ex_do_invalid_TSS 10 +#define ex_do_segment_not_present 11 +#define ex_do_stack_segment 12 +#define ex_do_general_protection 13 +#define ex_do_page_fault 14 +#define ex_do_spurious_interrupt_bug 15 +#define ex_do_coprocessor_error 16 +#define ex_do_alignment_check 17 +#define ex_machine_check_vector 18 +#define ex_reserved ex_machine_check_vector +#define ex_do_simd_coprocessor_error 19 +#define ex_do_iret_error 32 + +#if !defined(__ASSEMBLY__) && !defined(CONFIG_SMP ) + +#if __GNUC__ >=4 +/* Alias to ipipe_root_cpudom_var(status) */ +extern unsigned long __ipipe_root_status; +#else +extern unsigned long *const __ipipe_root_status_addr; +#define __ipipe_root_status (*__ipipe_root_status_addr) +#endif + +static inline void __ipipe_stall_root (void ) +{ +volatile unsigned long *p = &__ipipe_root_status; + __asm__ __volatile__("btsl $0,%0;" + :"+m" (*p) : :"memory" ); +} + +static inline unsigned long __ipipe_test_and_stall_root (void ) +{ +volatile unsigned long *p = &__ipipe_root_status; +int oldbit; + + __asm__ __volatile__("btsl $0,%1;" +"sbbl %0,%0;" + :"=r" (oldbit),"+m" (*p) + : :"memory" ); +return oldbit; +} + +static inline unsigned long __ipipe_test_root (void ) +{ +volatile unsigned long *p = &__ipipe_root_status; +int oldbit; + + __asm__ __volatile__("btl $0,%1;" +"sbbl %0,%0;" + :"=r" (oldbit) + :"m" (*p)); +return oldbit; +} + +#endif /* !__ASSEMBLY__ && !CONFIG_SMP */ + +#endif /* !__X86_IPIPE_BASE_H */
include/asm-x86/ipipe_base_32.h +0 -63
75 lines not on this page · raw message
include/asm-x86/ipipe_base_64.h +0 -63
75 lines not on this page · raw message
arch/x86/kernel/Makefile_32 +1 -1
@@ -34,7 +34,7 @@ obj-$(CONFIG_X86_SUMMIT_NUMA) += summit_ obj-$(CONFIG_KPROBES) += kprobes_32.o obj-$(CONFIG_MODULES) += module_32.o obj-y += sysenter_32.o vsyscall_32.o -obj-$(CONFIG_IPIPE) += ipipe_32.o +obj-$(CONFIG_IPIPE) += ipipe.o obj-$(CONFIG_IPIPE_TRACE_MCOUNT) += mcount_32.o obj-$(CONFIG_ACPI_SRAT) += srat_32.o obj-$(CONFIG_EFI) += efi_32.o efi_stub_32.o
arch/x86/kernel/Makefile_64 +1 -1
@@ -35,7 +35,7 @@ obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64 obj-$(CONFIG_X86_VSMP) += vsmp_64.o obj-$(CONFIG_K8_NB) += k8.o obj-$(CONFIG_AUDIT) += audit_64.o -obj-$(CONFIG_IPIPE) += ipipe_64.o +obj-$(CONFIG_IPIPE) += ipipe.o obj-$(CONFIG_IPIPE_TRACE_MCOUNT) += mcount_64.o obj-$(CONFIG_MODULES) += module_64.o
arch/x86/kernel/ipipe.c new file +1003 -0
1,003 lines not on this page · raw message
arch/x86/kernel/ipipe_32.c deleted +0 -838
838 lines not on this page · raw message
arch/x86/kernel/ipipe_64.c deleted +0 -803
803 lines not on this page · raw message
include/asm-x86/ipipe.h +115 -1
92 lines not on this page · raw message
include/asm-x86/ipipe_32.h +0 -85
85 lines not on this page · raw message
include/asm-x86/ipipe_64.h +0 -85
85 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Quoted 4 lines · Jan Kiszka
Long patch, short summary: removes more than 700 LOC by pushing common code in commonly used files. Specifically, there is now only
arch/x86/ipipe.cagain.
Given that much code is moved around, this needs to be merged asap before we attempt to bring more updates in. At first sight, this patch does not introduce the IRQ trampoline changes, so it's probably a no-brainer.
Signature · 1 line
Philippe.