From eaf684ba9df387471d3abe24b40209382311c29e Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Mon, 15 Aug 2005 07:51:58 +0000 Subject: The patch attached removes pda.h and asm_offset.c by deleting unused or unnecessary variables (that were used for old codes). Signed-off-by: Jun Nakajima --- linux-2.6-xen-sparse/arch/xen/x86_64/Makefile | 11 +-- .../arch/xen/x86_64/kernel/asm-offsets.c | 70 ------------------ .../arch/xen/x86_64/kernel/entry.S | 2 - .../arch/xen/x86_64/kernel/process.c | 1 - .../include/asm-xen/asm-x86_64/pda.h | 85 ---------------------- 5 files changed, 6 insertions(+), 163 deletions(-) delete mode 100644 linux-2.6-xen-sparse/arch/xen/x86_64/kernel/asm-offsets.c delete mode 100644 linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pda.h diff --git a/linux-2.6-xen-sparse/arch/xen/x86_64/Makefile b/linux-2.6-xen-sparse/arch/xen/x86_64/Makefile index 9f506b3203..3c25ae9a1c 100644 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/Makefile +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/Makefile @@ -79,14 +79,15 @@ xenflags-y += -Iinclude/asm-xen/asm-x86_64/mach-xen CFLAGS += $(xenflags-y) AFLAGS += $(xenflags-y) -prepare: include/asm-$(XENARCH)/asm_offset.h -CLEAN_FILES += include/asm-$(XENARCH)/asm_offset.h +prepare: include/asm-$(XENARCH)/asm_offsets.h +CLEAN_FILES += include/asm-$(XENARCH)/asm_offsets.h arch/$(XENARCH)/kernel/asm-offsets.s: include/asm include/.asm-ignore \ include/linux/version.h include/config/MARKER - -include/asm-$(XENARCH)/asm_offset.h: arch/xen/x86_64/kernel/asm-offsets.s +include/asm-$(XENARCH)/offset.h: arch/$(XENARCH)/kernel/asm-offsets.s $(call filechk,gen-asm-offsets) - ln -fsn asm_offset.h include/asm-$(XENARCH)/offset.h +include/asm-$(XENARCH)/asm_offsets.h: include/asm-$(XENARCH)/offset.h + ln -fsn offset.h include/asm-$(XENARCH)/asm_offsets.h + ln -fsn offset.h include/asm-$(XENARCH)/asm_offset.h diff --git a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/asm-offsets.c b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/asm-offsets.c deleted file mode 100644 index 83c8171d5f..0000000000 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/asm-offsets.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Generate definitions needed by assembly language modules. - * This code generates raw asm output which is post-processed to extract - * and format the required data. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DEFINE(sym, val) \ - asm volatile("\n->" #sym " %0 " #val : : "i" (val)) - -#define BLANK() asm volatile("\n->" : : ) - -int main(void) -{ -#define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry)) - ENTRY(state); - ENTRY(flags); - ENTRY(thread); - ENTRY(pid); - BLANK(); -#undef ENTRY -#define ENTRY(entry) DEFINE(threadinfo_ ## entry, offsetof(struct thread_info, entry)) - ENTRY(flags); - ENTRY(addr_limit); - ENTRY(preempt_count); - BLANK(); -#undef ENTRY -#define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry)) - ENTRY(kernelstack); - ENTRY(oldrsp); - ENTRY(pcurrent); - ENTRY(irqrsp); - ENTRY(irqcount); - ENTRY(cpunumber); - ENTRY(irqstackptr); - ENTRY(kernel_mode); - BLANK(); -#undef ENTRY -#ifdef CONFIG_IA32_EMULATION -#define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry)) - ENTRY(eax); - ENTRY(ebx); - ENTRY(ecx); - ENTRY(edx); - ENTRY(esi); - ENTRY(edi); - ENTRY(ebp); - ENTRY(esp); - ENTRY(eip); - BLANK(); -#undef ENTRY - DEFINE(IA32_RT_SIGFRAME_sigcontext, - offsetof (struct rt_sigframe32, uc.uc_mcontext)); - BLANK(); -#endif - DEFINE(pbe_address, offsetof(struct pbe, address)); - DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address)); - DEFINE(pbe_next, offsetof(struct pbe, next)); - return 0; -} diff --git a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S index ac950a2a3c..2898cef5d7 100644 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S @@ -128,7 +128,6 @@ * #define VGCF_IN_SYSCALL (1<<8) */ .macro SWITCH_TO_USER flag - movl $0,%gs:pda_kernel_mode # change to user mode subq $8*4,%rsp # reuse rip, cs, rflags, rsp, ss in the stack movq %rax,(%rsp) movq %r11,1*8(%rsp) @@ -139,7 +138,6 @@ .endm .macro SWITCH_TO_KERNEL ssoff,adjust=0 - btsq $0,%gs:pda_kernel_mode jc 1f orb $1,\ssoff-\adjust+4(%rsp) 1: diff --git a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/process.c b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/process.c index f19ff9b94b..d1a7acefaa 100644 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/process.c +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/process.c @@ -148,7 +148,6 @@ void cpu_idle (void) if (cpu_is_offline(cpu)) play_dead(); - __IRQ_STAT(cpu,idle_timestamp) = jiffies; xen_idle(); } diff --git a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pda.h b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pda.h deleted file mode 100644 index 76dac1c98b..0000000000 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pda.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef X86_64_PDA_H -#define X86_64_PDA_H - -#ifndef __ASSEMBLY__ -#include -#include -#include - -/* Per processor datastructure. %gs points to it while the kernel runs */ -struct x8664_pda { - struct task_struct *pcurrent; /* Current process */ - unsigned long data_offset; /* Per cpu data offset from linker address */ - struct x8664_pda *me; /* Pointer to itself */ - unsigned long kernelstack; /* top of kernel stack for current */ - unsigned long oldrsp; /* user rsp for system call */ - unsigned long irqrsp; /* Old rsp for interrupts. */ - int irqcount; /* Irq nesting counter. Starts with -1 */ - int cpunumber; /* Logical CPU number */ - char *irqstackptr; /* top of irqstack */ - unsigned int __softirq_pending; - unsigned int __nmi_count; /* number of NMI on this CPUs */ - unsigned long idle_timestamp; - struct mm_struct *active_mm; - int mmu_state; - unsigned apic_timer_irqs; - int kernel_mode; /* kernel or user mode */ -} ____cacheline_aligned; - - -#define IRQSTACK_ORDER 2 -#define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER) - -extern struct x8664_pda cpu_pda[]; - -/* - * There is no fast way to get the base address of the PDA, all the accesses - * have to mention %fs/%gs. So it needs to be done this Torvaldian way. - */ -#define sizeof_field(type,field) (sizeof(((type *)0)->field)) -#define typeof_field(type,field) typeof(((type *)0)->field) - -extern void __bad_pda_field(void); - -#define pda_offset(field) offsetof(struct x8664_pda, field) - -#define pda_to_op(op,field,val) do { \ - switch (sizeof_field(struct x8664_pda, field)) { \ -case 2: \ -asm volatile(op "w %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); break; \ -case 4: \ -asm volatile(op "l %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); break; \ -case 8: \ -asm volatile(op "q %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); break; \ - default: __bad_pda_field(); \ - } \ - } while (0) - -/* - * AK: PDA read accesses should be neither volatile nor have an memory clobber. - * Unfortunately removing them causes all hell to break lose currently. - */ -#define pda_from_op(op,field) ({ \ - typedef typeof_field(struct x8664_pda, field) T__; T__ ret__; \ - switch (sizeof_field(struct x8664_pda, field)) { \ -case 2: \ -asm volatile(op "w %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ -case 4: \ -asm volatile(op "l %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ -case 8: \ -asm volatile(op "q %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ - default: __bad_pda_field(); \ - } \ - ret__; }) - - -#define read_pda(field) pda_from_op("mov",field) -#define write_pda(field,val) pda_to_op("mov",field,val) -#define add_pda(field,val) pda_to_op("add",field,val) -#define sub_pda(field,val) pda_to_op("sub",field,val) - -#endif - -#define PDA_STACKOFFSET (5*8) - -#endif -- cgit v1.2.3