aboutsummaryrefslogtreecommitdiffstats
path: root/tools/ocaml
diff options
context:
space:
mode:
authorGianni Tedesco <gianni.tedesco@citrix.com>2010-09-16 17:12:21 +0100
committerGianni Tedesco <gianni.tedesco@citrix.com>2010-09-16 17:12:21 +0100
commit7c12b60534f8192967ede71f70d8ea52741f3270 (patch)
tree0ad2a9974a6e3e648bf0313015d81fc10f0d9a57 /tools/ocaml
parent8fa2c1212db29509d38076a9930c8f328a91fc01 (diff)
downloadxen-7c12b60534f8192967ede71f70d8ea52741f3270.tar.gz
xen-7c12b60534f8192967ede71f70d8ea52741f3270.tar.bz2
xen-7c12b60534f8192967ede71f70d8ea52741f3270.zip
libxl: change IDL to export a saner interface for upcoming language bindings
Firstly remove an anonymous union in libxl_device_pci structure which was making auto-generating language bindings more complicated than necessary and exporting random bits of low level ABI that libxl that would rather hide anyway. There is a corresponding (untested) change to the ocaml binding which maintains previous ml API. Secondly make the libxl_file_reference type a Builtin. This is a 'semantic correctness' issue in that libxl ABI/API won't change. But it makes it so that when the IDL is used to generate language bindings that a file_reference type is not exported. Also implement a Numeric type which all integers are derived from. Make sure a boolean signed/unsigned attribute is set accordingly. This is required to allow language bindings to correctly handle the sign bit in environments with arbitrarily long integers. Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/ocaml')
-rw-r--r--tools/ocaml/libs/xl/xl_stubs.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/tools/ocaml/libs/xl/xl_stubs.c b/tools/ocaml/libs/xl/xl_stubs.c
index eada565029..33302b7fd9 100644
--- a/tools/ocaml/libs/xl/xl_stubs.c
+++ b/tools/ocaml/libs/xl/xl_stubs.c
@@ -269,9 +269,28 @@ static int device_vfb_val(caml_gc *gc, libxl_device_vfb *c_val, value v)
static int device_pci_val(caml_gc *gc, libxl_device_pci *c_val, value v)
{
+ union {
+ unsigned int value;
+ struct {
+ unsigned int reserved1:2;
+ unsigned int reg:6;
+ unsigned int func:3;
+ unsigned int dev:5;
+ unsigned int bus:8;
+ unsigned int reserved2:7;
+ unsigned int enable:1;
+ }fields;
+ }u;
CAMLparam1(v);
- c_val->value = Int_val(Field(v, 0));
+ /* FIXME: propagate API change to ocaml */
+ u.value = Int_val(Field(v, 0));
+ c_val->reg = u.fields.reg;
+ c_val->func = u.fields.func;
+ c_val->dev = u.fields.dev;
+ c_val->bus = u.fields.bus;
+ c_val->enable = u.fields.enable;
+
c_val->domain = Int_val(Field(v, 1));
c_val->vdevfn = Int_val(Field(v, 2));
c_val->msitranslate = Bool_val(Field(v, 3));