direct-io.hg

changeset 8383:8ebcbcda3d37

Add and use write_ldt_entry, as seen in later linux kernel versions.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author chris@ubuntu.eng.hq.xensource.com
date Thu Dec 15 16:17:13 2005 -0700 (2005-12-15)
parents 6b1d39a56c2b
children 47d947e07205
files linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c linux-2.6-xen-sparse/include/asm-xen/asm-i386/desc.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c	Thu Dec 15 21:50:12 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c	Thu Dec 15 16:17:13 2005 -0700
     1.3 @@ -186,8 +186,7 @@ static int read_default_ldt(void __user 
     1.4  static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode)
     1.5  {
     1.6  	struct mm_struct * mm = current->mm;
     1.7 -	__u32 entry_1, entry_2, *lp;
     1.8 -	maddr_t mach_lp;
     1.9 +	__u32 entry_1, entry_2;
    1.10  	int error;
    1.11  	struct user_desc ldt_info;
    1.12  
    1.13 @@ -215,9 +214,6 @@ static int write_ldt(void __user * ptr, 
    1.14  			goto out_unlock;
    1.15  	}
    1.16  
    1.17 -	lp = (__u32 *) ((ldt_info.entry_number << 3) + (char *) mm->context.ldt);
    1.18 -	mach_lp = arbitrary_virt_to_machine(lp);
    1.19 -
    1.20     	/* Allow LDTs to be cleared by the user. */
    1.21     	if (ldt_info.base_addr == 0 && ldt_info.limit == 0) {
    1.22  		if (oldmode || LDT_empty(&ldt_info)) {
    1.23 @@ -234,8 +230,8 @@ static int write_ldt(void __user * ptr, 
    1.24  
    1.25  	/* Install the new entry ...  */
    1.26  install:
    1.27 -	error = HYPERVISOR_update_descriptor(
    1.28 -		mach_lp, (u64)entry_1 | ((u64)entry_2<<32));
    1.29 +	error = write_ldt_entry(mm->context.ldt, ldt_info.entry_number,
    1.30 +				entry_1, entry_2);
    1.31  
    1.32  out_unlock:
    1.33  	up(&mm->context.sem);
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c	Thu Dec 15 21:50:12 2005 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c	Thu Dec 15 16:17:13 2005 -0700
     2.3 @@ -438,6 +438,16 @@ void xen_destroy_contiguous_region(unsig
     2.4  	balloon_unlock(flags);
     2.5  }
     2.6  
     2.7 +#ifdef __i386__
     2.8 +int write_ldt_entry(void *ldt, int entry, __u32 entry_a, __u32 entry_b)
     2.9 +{
    2.10 +	__u32 *lp = (__u32 *)((char *)ldt + entry * 8);
    2.11 +	maddr_t mach_lp = arbitrary_virt_to_machine(lp);
    2.12 +	return HYPERVISOR_update_descriptor(
    2.13 +		mach_lp, (u64)entry_a | ((u64)entry_b<<32));
    2.14 +}
    2.15 +#endif
    2.16 +
    2.17  /*
    2.18   * Local variables:
    2.19   *  c-file-style: "linux"
     3.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/desc.h	Thu Dec 15 21:50:12 2005 +0100
     3.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/desc.h	Thu Dec 15 16:17:13 2005 -0700
     3.3 @@ -87,6 +87,8 @@ static inline void set_ldt_desc(unsigned
     3.4  	(info)->seg_not_present	== 1	&& \
     3.5  	(info)->useable		== 0	)
     3.6  
     3.7 +extern int write_ldt_entry(void *ldt, int entry, __u32 entry_a, __u32 entry_b);
     3.8 +
     3.9  #if TLS_SIZE != 24
    3.10  # error update this code.
    3.11  #endif