Skip to contentSkip to conversation

libxc x86-64 enablement addons (almost working)

PATCH In review Jerone Young 2 participants 2 messages Apr 29, 2005 – Apr 30, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxc x86-64 enablement addons (almost working)

These patches add code needed to allow x86-64 to launch 64bit domains.
You still cannot 100% boot a full domU domain just yet (but you can see it being created in xm list). There is still one more issue where when calling the last hypercall to set the domain up you get EINVAL. I believe this could be due to how I am initializing the page tables (which is probably wrong...if you see this is wrong don't hesitate to say so :-) ). I want to go ahead and get this code in the tree as it will not affect x86 xen building in anyway...and perhaps could resolve the problem with more folks giving input.

Signature · 4 lines
Jerone Young
IBM Linux Technology Center
[email protected]
512-838-1157 (T/L: 678-1157)
tools/libxc/Makefile renamed from tools/libxc/Makefile.orig +4 -0
@@ -21,7 +21,11 @@ SRCS     += xc_domain.c
 SRCS     += xc_evtchn.c
 SRCS     += xc_gnttab.c
 SRCS     += xc_io.c
+ifeq ($(XEN_TARGET_ARCH),x86_64)
+SRCS     += xc_linux_build_x64.c
+else
 SRCS     += xc_linux_build.c
+endif
 SRCS     += xc_plan9_build.c
 SRCS     += xc_linux_restore.c
 SRCS     += xc_linux_save.c
tools/libxc/xc_linux_build_x64.c +780 -0

780 lines not on this page · raw message

tools/libxc/xc_private.h +30 -2
@@ -29,12 +29,25 @@
 #define _PAGE_PSE       0x080
 #define _PAGE_GLOBAL    0x100
 
-
+#if defined(__i386__)
 #define L1_PAGETABLE_SHIFT       12
 #define L2_PAGETABLE_SHIFT       22
- 
+#elif defined(__x86_64__)
+#define L1_PAGETABLE_SHIFT      12
+#define L2_PAGETABLE_SHIFT      21
+#define L3_PAGETABLE_SHIFT      30
+#define L4_PAGETABLE_SHIFT      39
+#endif
+
+#if defined(__i386__) 
 #define ENTRIES_PER_L1_PAGETABLE 1024
 #define ENTRIES_PER_L2_PAGETABLE 1024
+#elif defined(__x86_64__)
+#define L1_PAGETABLE_ENTRIES    512
+#define L2_PAGETABLE_ENTRIES    512
+#define L3_PAGETABLE_ENTRIES    512
+#define L4_PAGETABLE_ENTRIES    512
+#endif
  
 #define PAGE_SHIFT              L1_PAGETABLE_SHIFT
 #define PAGE_SIZE               (1UL << PAGE_SHIFT)
@@ -42,11 +55,26 @@
 
 typedef unsigned long l1_pgentry_t;
 typedef unsigned long l2_pgentry_t;
+#if defined(__x86_64__)
+typedef unsigned long l3_pgentry_t;
+typedef unsigned long l4_pgentry_t;
+#endif
 
+#if defined(__i386__)
 #define l1_table_offset(_a) \
           (((_a) >> L1_PAGETABLE_SHIFT) & (ENTRIES_PER_L1_PAGETABLE - 1))
 #define l2_table_offset(_a) \
           ((_a) >> L2_PAGETABLE_SHIFT)
+#elif defined(__x86_64__)
+#define l1_table_offset(_a) \
+  (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1))
+#define l2_table_offset(_a) \
+  (((_a) >> L2_PAGETABLE_SHIFT) & (L2_PAGETABLE_ENTRIES - 1))
+#define l3_table_offset(_a) \
+	(((_a) >> L3_PAGETABLE_SHIFT) & (L3_PAGETABLE_ENTRIES - 1))
+#define l4_table_offset(_a) \
+	(((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1))
+#endif
 
 #define ERROR(_m, _a...)  \
     fprintf(stderr, "ERROR: " _m "\n" , ## _a )

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 9 lines

These patches add code needed to allow x86-64 to launch 64bit domains.
You still cannot 100% boot a full domU domain just yet (but you can see it being created in xm list). There is still one more issue where when calling the last hypercall to set the domain up you get EINVAL. I believe this could be due to how I am initializing the page tables (which is probably wrong...if you see this is wrong don't hesitate to say so :-) ). I want to go ahead and get this code in the tree as it will not affect x86 xen building in anyway...and perhaps could resolve the problem with more folks giving input.

Can x86_64 building be added to xc_linux_build.c rather than having a new file?

If you look at the dom0 builder (domain_builder.c) I was able to share code almost entirely, except for actually building the intial pagetables.

I'd like to see more merging in the builders rather than less as we risk having six builders with fair chunks of shared code between them (32- and 64-bit versions of linux/plan9/vmx builders).

-- Keir