diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-05-28 09:30:48 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-05-28 09:30:48 +0100 |
commit | f9b4231a673d75dd6404ac5df8a47adc04437e6b (patch) | |
tree | 67d37f19b98706274ec6af9245082f25622341a8 /stubdom/caml/main-caml.c | |
parent | 4151cc56f19b3fe8aabde12ddf532cd9502c637d (diff) | |
download | xen-f9b4231a673d75dd6404ac5df8a47adc04437e6b.tar.gz xen-f9b4231a673d75dd6404ac5df8a47adc04437e6b.tar.bz2 xen-f9b4231a673d75dd6404ac5df8a47adc04437e6b.zip |
stubdom: make the build more generic by moving as many stubdom parts
into stubdom/ as possible. That also permits to build all of
ioemu, c and caml stubdoms at the same time.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Diffstat (limited to 'stubdom/caml/main-caml.c')
-rw-r--r-- | stubdom/caml/main-caml.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/stubdom/caml/main-caml.c b/stubdom/caml/main-caml.c new file mode 100644 index 0000000000..dd55aca38f --- /dev/null +++ b/stubdom/caml/main-caml.c @@ -0,0 +1,42 @@ +/* + * Caml bootstrap + * + * Samuel Thibault <Samuel.Thibault@eu.citrix.net>, January 2008 + */ + +#include <stdio.h> +#include <errno.h> + +#include <caml/mlvalues.h> +#include <caml/callback.h> +#include <unistd.h> + +/* Ugly binary compatibility with Linux */ +FILE *_stderr asm("stderr"); +int *__errno_location; +/* Will probably break everything, probably need to fetch from glibc */ +void *__ctype_b_loc; + +int main(int argc, char *argv[], char *envp[]) +{ + value *val; + + /* Get current thread's value */ + _stderr = stderr; + __errno_location = &errno; + + printf("starting caml\n"); + + /* Wait before things might hang up */ + sleep(1); + + caml_startup(argv); + val = caml_named_value("main"); + if (!val) { + printf("Couldn't find Caml main"); + return 1; + } + caml_callback(*val, Val_int(0)); + printf("callback returned\n"); + return 0; +} |