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

[XenPPC] [xenppc-unstable] [TOOLS][POWERPC] use python "quad" encoding for 2 cell devtree values



# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID d18a0c0b77d7004631559d4e2f9d31744fe9b34a
# Parent  ece7037c72c6b7944ede2261ec1fe99c1489cff4
[TOOLS][POWERPC] use python "quad" encoding for 2 cell devtree values
When creating a 2G DomU pyhton chokes when it sees a long type.  If a
value is of type long, or promoted to long it should be "packed" as a
quad.

Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
 tools/python/xen/xend/FlatDeviceTree.py |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff -r ece7037c72c6 -r d18a0c0b77d7 tools/python/xen/xend/FlatDeviceTree.py
--- a/tools/python/xen/xend/FlatDeviceTree.py   Wed Oct 18 11:29:57 2006 -0400
+++ b/tools/python/xen/xend/FlatDeviceTree.py   Wed Oct 18 16:07:33 2006 -0400
@@ -37,8 +37,10 @@ def _bincat(seq, separator=''):
     '''Concatenate the contents of seq into a bytestream.'''
     strs = []
     for item in seq:
-        if type(item) == type(0):
+        if isinstance(item, int):
             strs.append(struct.pack(">I", item))
+        elif isinstance(item, long):
+            strs.append(struct.pack(">Q", item))
         else:
             try:
                 strs.append(item.to_bin())
@@ -287,9 +289,9 @@ def build(imghandler):
     root.addprop('compatible', 'Momentum,Maple\0')
 
     xen = root.addnode('xen')
-    xen.addprop('start-info', 0, 0x3ffc000, 0, 0x1000)
+    xen.addprop('start-info', long(0x3ffc000), long(0x1000))
     xen.addprop('version', 'Xen-3.0-unstable\0')
-    xen.addprop('reg', 0, imghandler.vm.domid, 0, 0)
+    xen.addprop('reg', long(imghandler.vm.domid), long(0))
     xen.addprop('domain-name', imghandler.vm.getName() + '\0')
     xencons = xen.addnode('console')
     xencons.addprop('interrupts', 1, 0)
@@ -301,14 +303,14 @@ def build(imghandler):
 
     # RMA node
     rma = root.addnode('memory@0')
-    rma.addprop('reg', 0, 0, 0, rma_bytes)
+    rma.addprop('reg', long(0), long(rma_bytes))
     rma.addprop('device_type', 'memory\0')
 
     # all the rest in a single node
     remaining = totalmem - rma_bytes
     if remaining > 0:
         mem = root.addnode('memory@1')
-        mem.addprop('reg', 0, rma_bytes, 0, remaining)
+        mem.addprop('reg', long(rma_bytes), long(remaining))
         mem.addprop('device_type', 'memory\0')
 
     # add CPU nodes
@@ -346,8 +348,8 @@ def build(imghandler):
     chosen.addprop('interrupt-controller', xen.get_phandle())
     chosen.addprop('bootargs', imghandler.cmdline + '\0')
     # xc_linux_load.c will overwrite these 64-bit properties later
-    chosen.addprop('linux,initrd-start', 0, 0)
-    chosen.addprop('linux,initrd-end', 0, 0)
+    chosen.addprop('linux,initrd-start', long(0))
+    chosen.addprop('linux,initrd-end', long(0))
 
     if 1:
         f = file('/tmp/domU.dtb', 'w')

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


 


Rackspace

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