[LLVMdev] LLVM JIT on a Baremetal x86 Machine !!!

James Molloy
Wed, 09 Nov 2011 13:42:15 -0000

Hi,

Glad you got it working! :)

The image contains the kiwi bootloader and any files it needs - that's it.
It was generated by building kiwi-os, which is a hobby operating system written
by Alex Smith (http://kiwi.alex-smith.me.uk/).

Cheers,

James

-----Original Message-----
From: Mian M. Hamayun [mailto:mian-muhammad.hamayun at imag.fr]
Sent: 09 November 2011 13:16
To: James Molloy
Cc: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] LLVM JIT on a Baremetal x86 Machine !!!

Hi James,

Thanks again for bearing with me, you have been very helpful.

I have got the problem fixed. In fact I needed to override the 'LSeek'
implementation of SpecialFile in SpecialModule class as well.
The log for the working example is attached, just as a reference.

Now one more thing, when the build system creates the ISO9660 CD-ROM
Image, it executes the following commands:

mkdir -p /tmp/hzn/boot
mkdir -p /tmp/hzn/kiwi/modules
cp
/altamaha/home3/hamayun/workspace/horizon/horizon/Baremetal/boot/cdboot.img
/tmp/hzn/boot
cp embedded /tmp/hzn/kiwi/kernel
cp
/altamaha/home3/hamayun/workspace/horizon/code-samples/hello_world.hbc
/tmp/hzn/kiwi/modules/hbc
mkisofs -quiet -J -R -l -b boot/cdboot.img -V Horizon\ CD-ROM
-boot-load-size 4 -boot-info-table -no-emul-boot -o cd.img /tmp/hzn

In the third line above, the file "cdboot.img" is being copied. Is
this
only a bootloader or does it also contain an OS Kernel ? (Like for
example the kernel of kiwi os)
And where can I find the sources to this "cdboot.img" file ? I mean if
I
need to modify/recreate this file, how can I do that.

Best Regards,
Hamayun


On 11/08/2011 04:59 PM, James Molloy wrote:
> Hi,
>
> First question: "/module" is mapped to a special file that reads
a kernel module passed in by the bootloader. Much like GRUB, kiwi's
bootloader loads a kernel and can load one or more extra files into memory.
These are passed to the kernel.
>
> The horizon kernel expects one file, which it makes accessible at
"/module". This should be set up to be whatever you set KERNEL_HBC to
be.
>
> Second question: The program is statically compiled on the host system
against the host C and C++ libraries. Then, it is patched slightly to change
linux syscall instructions to "int 0xff" instructions, which get
trapped at runtime.
>
> At build time it reads your linux kernel headers to find what syscall
numbers map to what syscalls, and emulates a subset of the linux kernel. This is
how the C standard library etc works.
>
> Cheers,
>
> James
>

-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended recipient,
please notify the sender immediately and do not disclose the contents to any
other person, use it for any purpose, or store or copy the information in any
medium.  Thank you.