Version française
Home     About     Download     Resources     Contact us    
Browse thread
Multiboot problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David LONY <david.lony@p...>
Subject: Re: [Caml-list] Multiboot problem
Does anyone can explain to me how the function caml_startup works ? Does 
it relies on malloc or free function or any functions of the C library ?
I've tried to look for an explanation on the Ocaml manual but I found 
nothing...

Regards.
David LONY

David LONY a écrit :
> Hi all,
>
> I'm currently trying to make a multiboot sector with ocaml code. 
> Unfortunately, it doesn't work bu I don't know why...
> To do that, I made a small program in ocaml :
>
> let test_char a = a+1
> let _ = Callback.register "caml_test_char" test_char;;
>
> I also made a dummy libc  (all functions return 0 or NULL pointer) 
> because I have to provide all these functions if a wants to statically 
> link a C objects..
> This is my main file with the entry point of the kernel :
>
> /* Include definitions of the multiboot standard */
> #include <multiboot.h>
> #include <x86_videomem.h>
> #include <caml/mlvalues.h>
> #include <caml/callback.h>
>
> /* This is the entry point of the kernel */
> void sos_main(unsigned long magic, unsigned long addr)
> {
>  static char * argv[]={ "ocaml", NULL };
>
>  multiboot_info_t *mbi;
>
>  /* Retrieve grub information (memory...etc) */
>  mbi = (multiboot_info_t *) addr;
>
>  caml_startup(argv);
>
>  /* Clean the screen and put a 'A' on it */
>  sos_x86_videomem_setup();
>  sos_x86_videomem_cls(SOS_X86_VIDEO_BG_BLACK);
>  sos_x86_videomem_putchar(1, 0, SOS_X86_VIDEO_FG_WHITE | 
> SOS_X86_VIDEO_BG_BLACK,'A');
>
>  /* An operatig system never ends */
>  for (;;)
>    continue;
>
>  return;
> }
>
>
> But qemu freezes when I call the caml_startup function (If I removed 
> it, it works well...)...Perhaps the caml_startup function relies on C 
> function that I don't implements ?
> If someone have an idea.... Because I must call this function 
> (caml_startup) in order to call my ocaml function (test_char)...
>
>
> Thanks a lot.
> Regards,
> David LONY
>
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>