[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Add and use write_ldt_entry, as seen in later linux kernel versions.



# HG changeset patch
# User chris@xxxxxxxxxxxxxxxxxxxxxxxxxxx
# Node ID 8ebcbcda3d373c851dff1fdfb4aaf5700ae95547
# Parent  6b1d39a56c2be5dbc2290f508d24eac750111cf4
Add and use write_ldt_entry, as seen in later linux kernel versions.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 6b1d39a56c2b -r 8ebcbcda3d37 
linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c   Thu Dec 15 20:50:12 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c   Thu Dec 15 23:17:13 2005
@@ -186,8 +186,7 @@
 static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode)
 {
        struct mm_struct * mm = current->mm;
-       __u32 entry_1, entry_2, *lp;
-       maddr_t mach_lp;
+       __u32 entry_1, entry_2;
        int error;
        struct user_desc ldt_info;
 
@@ -215,9 +214,6 @@
                        goto out_unlock;
        }
 
-       lp = (__u32 *) ((ldt_info.entry_number << 3) + (char *) 
mm->context.ldt);
-       mach_lp = arbitrary_virt_to_machine(lp);
-
        /* Allow LDTs to be cleared by the user. */
        if (ldt_info.base_addr == 0 && ldt_info.limit == 0) {
                if (oldmode || LDT_empty(&ldt_info)) {
@@ -234,8 +230,8 @@
 
        /* Install the new entry ...  */
 install:
-       error = HYPERVISOR_update_descriptor(
-               mach_lp, (u64)entry_1 | ((u64)entry_2<<32));
+       error = write_ldt_entry(mm->context.ldt, ldt_info.entry_number,
+                               entry_1, entry_2);
 
 out_unlock:
        up(&mm->context.sem);
diff -r 6b1d39a56c2b -r 8ebcbcda3d37 
linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c        Thu Dec 15 
20:50:12 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c        Thu Dec 15 
23:17:13 2005
@@ -438,6 +438,16 @@
        balloon_unlock(flags);
 }
 
+#ifdef __i386__
+int write_ldt_entry(void *ldt, int entry, __u32 entry_a, __u32 entry_b)
+{
+       __u32 *lp = (__u32 *)((char *)ldt + entry * 8);
+       maddr_t mach_lp = arbitrary_virt_to_machine(lp);
+       return HYPERVISOR_update_descriptor(
+               mach_lp, (u64)entry_a | ((u64)entry_b<<32));
+}
+#endif
+
 /*
  * Local variables:
  *  c-file-style: "linux"
diff -r 6b1d39a56c2b -r 8ebcbcda3d37 
linux-2.6-xen-sparse/include/asm-xen/asm-i386/desc.h
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/desc.h      Thu Dec 15 
20:50:12 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/desc.h      Thu Dec 15 
23:17:13 2005
@@ -87,6 +87,8 @@
        (info)->seg_not_present == 1    && \
        (info)->useable         == 0    )
 
+extern int write_ldt_entry(void *ldt, int entry, __u32 entry_a, __u32 entry_b);
+
 #if TLS_SIZE != 24
 # error update this code.
 #endif

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.