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

[Xen-changelog] Fix address canonicalisation in do_set_segment_base().



ChangeSet 1.1279, 2005/04/06 23:35:02+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Fix address canonicalisation in do_set_segment_base().
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 arch/x86/x86_64/mm.c          |    3 +--
 include/asm-x86/x86_64/page.h |    9 +++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)


diff -Nru a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c  2005-04-07 05:03:09 -04:00
+++ b/xen/arch/x86/x86_64/mm.c  2005-04-07 05:03:09 -04:00
@@ -249,8 +249,7 @@
 {
     struct exec_domain *ed = current;
 
-    /* Canonicalise the base address. */
-    base |= ~VADDR_MASK;
+    base = canonicalise_virt_address(base);
 
     switch ( which )
     {
diff -Nru a/xen/include/asm-x86/x86_64/page.h 
b/xen/include/asm-x86/x86_64/page.h
--- a/xen/include/asm-x86/x86_64/page.h 2005-04-07 05:03:09 -04:00
+++ b/xen/include/asm-x86/x86_64/page.h 2005-04-07 05:03:09 -04:00
@@ -98,6 +98,15 @@
 #define L3_DISALLOW_MASK ((cpu_has_nx?0:(1UL<<63)) | (7UL << 7))
 #define L4_DISALLOW_MASK ((cpu_has_nx?0:(1UL<<63)) | (7UL << 7))
 
+#ifndef __ASSEMBLY__
+static inline unsigned long canonicalise_virt_address(unsigned long v)
+{
+    v &= VADDR_MASK;
+    if ( v & (1UL << (VADDR_BITS - 1)) )
+        v |= ~VADDR_MASK;
+}
+#endif /* !__ASSEMBLY__ */
+
 #endif /* __X86_64_PAGE_H__ */
 
 /*

_______________________________________________
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®.