ia64/xen-unstable

changeset 6183:60a8a5ca4291

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 <jun.nakajima@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Aug 15 07:51:58 2005 +0000 (2005-08-15)
parents d6e64adbff04
children 737433c5bb2e
files linux-2.6-xen-sparse/arch/xen/x86_64/Makefile linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S linux-2.6-xen-sparse/arch/xen/x86_64/kernel/process.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/Makefile	Mon Aug 15 07:45:42 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/Makefile	Mon Aug 15 07:51:58 2005 +0000
     1.3 @@ -79,14 +79,15 @@ xenflags-y += -Iinclude/asm-xen/asm-x86_
     1.4  CFLAGS += $(xenflags-y)
     1.5  AFLAGS += $(xenflags-y)
     1.6  
     1.7 -prepare: include/asm-$(XENARCH)/asm_offset.h
     1.8 -CLEAN_FILES += include/asm-$(XENARCH)/asm_offset.h
     1.9 +prepare: include/asm-$(XENARCH)/asm_offsets.h
    1.10 +CLEAN_FILES += include/asm-$(XENARCH)/asm_offsets.h
    1.11  
    1.12  arch/$(XENARCH)/kernel/asm-offsets.s: include/asm include/.asm-ignore \
    1.13  	include/linux/version.h include/config/MARKER
    1.14  
    1.15 +include/asm-$(XENARCH)/offset.h: arch/$(XENARCH)/kernel/asm-offsets.s
    1.16 +	$(call filechk,gen-asm-offsets)
    1.17  
    1.18 -include/asm-$(XENARCH)/asm_offset.h: arch/xen/x86_64/kernel/asm-offsets.s
    1.19 -	$(call filechk,gen-asm-offsets)
    1.20 -	ln -fsn asm_offset.h include/asm-$(XENARCH)/offset.h
    1.21 -
    1.22 +include/asm-$(XENARCH)/asm_offsets.h: include/asm-$(XENARCH)/offset.h
    1.23 +	ln -fsn offset.h include/asm-$(XENARCH)/asm_offsets.h
    1.24 +	ln -fsn offset.h include/asm-$(XENARCH)/asm_offset.h
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/asm-offsets.c	Mon Aug 15 07:45:42 2005 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,70 +0,0 @@
     2.4 -/*
     2.5 - * Generate definitions needed by assembly language modules.
     2.6 - * This code generates raw asm output which is post-processed to extract
     2.7 - * and format the required data.
     2.8 - */
     2.9 -
    2.10 -#include <linux/sched.h> 
    2.11 -#include <linux/stddef.h>
    2.12 -#include <linux/errno.h> 
    2.13 -#include <linux/hardirq.h>
    2.14 -#include <linux/suspend.h>
    2.15 -#include <asm/pda.h>
    2.16 -#include <asm/processor.h>
    2.17 -#include <asm/segment.h>
    2.18 -#include <asm/thread_info.h>
    2.19 -#include <asm/ia32.h>
    2.20 -
    2.21 -#define DEFINE(sym, val) \
    2.22 -        asm volatile("\n->" #sym " %0 " #val : : "i" (val))
    2.23 -
    2.24 -#define BLANK() asm volatile("\n->" : : )
    2.25 -
    2.26 -int main(void)
    2.27 -{
    2.28 -#define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry))
    2.29 -	ENTRY(state);
    2.30 -	ENTRY(flags); 
    2.31 -	ENTRY(thread); 
    2.32 -	ENTRY(pid);
    2.33 -	BLANK();
    2.34 -#undef ENTRY
    2.35 -#define ENTRY(entry) DEFINE(threadinfo_ ## entry, offsetof(struct thread_info, entry))
    2.36 -	ENTRY(flags);
    2.37 -	ENTRY(addr_limit);
    2.38 -	ENTRY(preempt_count);
    2.39 -	BLANK();
    2.40 -#undef ENTRY
    2.41 -#define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
    2.42 -	ENTRY(kernelstack); 
    2.43 -	ENTRY(oldrsp); 
    2.44 -	ENTRY(pcurrent); 
    2.45 -	ENTRY(irqrsp);
    2.46 -	ENTRY(irqcount);
    2.47 -	ENTRY(cpunumber);
    2.48 -	ENTRY(irqstackptr);
    2.49 -	ENTRY(kernel_mode);
    2.50 -	BLANK();
    2.51 -#undef ENTRY
    2.52 -#ifdef CONFIG_IA32_EMULATION
    2.53 -#define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
    2.54 -	ENTRY(eax);
    2.55 -	ENTRY(ebx);
    2.56 -	ENTRY(ecx);
    2.57 -	ENTRY(edx);
    2.58 -	ENTRY(esi);
    2.59 -	ENTRY(edi);
    2.60 -	ENTRY(ebp);
    2.61 -	ENTRY(esp);
    2.62 -	ENTRY(eip);
    2.63 -	BLANK();
    2.64 -#undef ENTRY
    2.65 -	DEFINE(IA32_RT_SIGFRAME_sigcontext,
    2.66 -	       offsetof (struct rt_sigframe32, uc.uc_mcontext));
    2.67 -	BLANK();
    2.68 -#endif
    2.69 -	DEFINE(pbe_address, offsetof(struct pbe, address));
    2.70 -	DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
    2.71 -	DEFINE(pbe_next, offsetof(struct pbe, next));
    2.72 -	return 0;
    2.73 -}
     3.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S	Mon Aug 15 07:45:42 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S	Mon Aug 15 07:51:58 2005 +0000
     3.3 @@ -128,7 +128,6 @@
     3.4           * #define VGCF_IN_SYSCALL (1<<8) 
     3.5           */
     3.6          .macro SWITCH_TO_USER flag
     3.7 -        movl $0,%gs:pda_kernel_mode     # change to user mode
     3.8          subq $8*4,%rsp                   # reuse rip, cs, rflags, rsp, ss in the stack
     3.9          movq %rax,(%rsp)
    3.10          movq %r11,1*8(%rsp)
    3.11 @@ -139,7 +138,6 @@
    3.12          .endm
    3.13  
    3.14          .macro SWITCH_TO_KERNEL ssoff,adjust=0
    3.15 -  	btsq $0,%gs:pda_kernel_mode
    3.16  	jc  1f
    3.17  	orb  $1,\ssoff-\adjust+4(%rsp)
    3.18  1:
     4.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/process.c	Mon Aug 15 07:45:42 2005 +0000
     4.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/process.c	Mon Aug 15 07:51:58 2005 +0000
     4.3 @@ -148,7 +148,6 @@ void cpu_idle (void)
     4.4  			if (cpu_is_offline(cpu))
     4.5  				play_dead();
     4.6  
     4.7 -                        __IRQ_STAT(cpu,idle_timestamp) = jiffies;
     4.8  			xen_idle();
     4.9  		}
    4.10  
     5.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pda.h	Mon Aug 15 07:45:42 2005 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,85 +0,0 @@
     5.4 -#ifndef X86_64_PDA_H
     5.5 -#define X86_64_PDA_H
     5.6 -
     5.7 -#ifndef __ASSEMBLY__
     5.8 -#include <linux/stddef.h>
     5.9 -#include <linux/types.h>
    5.10 -#include <linux/cache.h>
    5.11 -
    5.12 -/* Per processor datastructure. %gs points to it while the kernel runs */ 
    5.13 -struct x8664_pda {
    5.14 -	struct task_struct *pcurrent;	/* Current process */
    5.15 -	unsigned long data_offset;	/* Per cpu data offset from linker address */
    5.16 -	struct x8664_pda *me;	    /* Pointer to itself */  
    5.17 -	unsigned long kernelstack;  /* top of kernel stack for current */ 
    5.18 -	unsigned long oldrsp; 	    /* user rsp for system call */
    5.19 -	unsigned long irqrsp;	    /* Old rsp for interrupts. */ 
    5.20 -        int irqcount;		    /* Irq nesting counter. Starts with -1 */  	
    5.21 -	int cpunumber;		    /* Logical CPU number */
    5.22 -	char *irqstackptr;	/* top of irqstack */
    5.23 -	unsigned int __softirq_pending;
    5.24 -	unsigned int __nmi_count;	/* number of NMI on this CPUs */
    5.25 -        unsigned long idle_timestamp;
    5.26 -	struct mm_struct *active_mm;
    5.27 -	int mmu_state;     
    5.28 -	unsigned apic_timer_irqs;
    5.29 -        int kernel_mode;          /* kernel or user mode */
    5.30 -} ____cacheline_aligned;
    5.31 -
    5.32 -
    5.33 -#define IRQSTACK_ORDER 2
    5.34 -#define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER) 
    5.35 -
    5.36 -extern struct x8664_pda cpu_pda[];
    5.37 -
    5.38 -/* 
    5.39 - * There is no fast way to get the base address of the PDA, all the accesses
    5.40 - * have to mention %fs/%gs.  So it needs to be done this Torvaldian way.
    5.41 - */ 
    5.42 -#define sizeof_field(type,field)  (sizeof(((type *)0)->field))
    5.43 -#define typeof_field(type,field)  typeof(((type *)0)->field)
    5.44 -
    5.45 -extern void __bad_pda_field(void);
    5.46 -
    5.47 -#define pda_offset(field) offsetof(struct x8664_pda, field)
    5.48 -
    5.49 -#define pda_to_op(op,field,val) do { \
    5.50 -       switch (sizeof_field(struct x8664_pda, field)) { 		\
    5.51 -case 2: \
    5.52 -asm volatile(op "w %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); break; \
    5.53 -case 4: \
    5.54 -asm volatile(op "l %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); break; \
    5.55 -case 8: \
    5.56 -asm volatile(op "q %0,%%gs:%P1"::"r" (val),"i"(pda_offset(field)):"memory"); break; \
    5.57 -       default: __bad_pda_field(); 					\
    5.58 -       } \
    5.59 -       } while (0)
    5.60 -
    5.61 -/* 
    5.62 - * AK: PDA read accesses should be neither volatile nor have an memory clobber.
    5.63 - * Unfortunately removing them causes all hell to break lose currently.
    5.64 - */
    5.65 -#define pda_from_op(op,field) ({ \
    5.66 -       typedef typeof_field(struct x8664_pda, field) T__; T__ ret__; \
    5.67 -       switch (sizeof_field(struct x8664_pda, field)) { 		\
    5.68 -case 2: \
    5.69 -asm volatile(op "w %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\
    5.70 -case 4: \
    5.71 -asm volatile(op "l %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\
    5.72 -case 8: \
    5.73 -asm volatile(op "q %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\
    5.74 -       default: __bad_pda_field(); 					\
    5.75 -       } \
    5.76 -       ret__; })
    5.77 -
    5.78 -
    5.79 -#define read_pda(field) pda_from_op("mov",field)
    5.80 -#define write_pda(field,val) pda_to_op("mov",field,val)
    5.81 -#define add_pda(field,val) pda_to_op("add",field,val)
    5.82 -#define sub_pda(field,val) pda_to_op("sub",field,val)
    5.83 -
    5.84 -#endif
    5.85 -
    5.86 -#define PDA_STACKOFFSET (5*8)
    5.87 -
    5.88 -#endif