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

James Molloy James.Molloy at arm.com
Thu Nov 3 09:37:37 PDT 2011


Hi Mian,

Looking at the runlog, everything seems fine until LLVM attempts to use lseek() on a file.

You see the PANIC because Horizon hasn't implemented lseek yet.

Obviously the version of GlibC I was using does not use lseek in that circumstance, but yours does. You just need to implement lseek :)

Cheers,

James

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

Hello James,

I hope I will not be disturbing you too much. As I mentioned earlier, I
am interested in unhosted (baremetal) x86 environment for LLVM JIT.
Let me come to the point straight.

I have set the KERNEL_HBC as:
set(KERNEL_HBC
"/altamaha/home3/hamayun/workspace/horizon/code-samples/hello_world.hbc")

And Compiled the Horizon Sources. Compilation works fine and it creates
the cd.img as you described on:
http://www.quokforge.org/projects/horizon/wiki/Building

See the attached "Horizon_Build.Log" file for more details.

Now when I load this 'image' using qemu; It gives me the following error:
horizon: PANIC: syscall 0x8 (lseek) @ 0xc0f530

See the attached "Horizon_Qemu_Run.log" file for more details.

I guess I am not setting the KERNEL_HBC variable properly.
Could you give me an idea of whats going wrong here ?

Thanks a lot,
Hamayun


On 10/28/2011 02:46 PM, Mian M. Hamayun wrote:
> Hi James,
>
> Thanks A lot. I have downloaded the source code and I am currently
> looking into it.
> I will get back to you if I need some clarifications.
>
> Thanks Again,
> --
> Hamayun
>
> On 10/26/2011 03:20 PM, James Molloy wrote:
>> Hi Mian,
>>
>> I have actually done this. I wrote a safe bytecode which compiles down to
>> LLVM IR, and had baremetal applications running using it.
>>
>> Code here:
>> http://www.quokforge.org/projects/horizon/repository/revisions/master/show/h
>>
>> orizon/Baremetal
>>
>> My method was to compile for hosted linux, then modify the resulting
>> code to
>> run baremetal. For me, this involved rewriting "syscall" instructions to
>> "int $X" as everything was running in supervisor mode and "syscall" only
>> works from user mode.
>>
>> Apart from that there's just a load of stubs to implement. Pretty easy
>> really.
>>
>> Cheers,
>>
>> James
>>
>>
>> -----Original Message-----
>> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On
>> Behalf Of Mian M. Hamayun
>> Sent: 26 October 2011 14:12
>> To: llvmdev at cs.uiuc.edu
>> Subject: [LLVMdev] LLVM JIT on a Baremetal x86 Machine !!!
>>
>> Dear All,
>>
>> I have tested a few examples of LLVM-JIT Framework on Linux x86 Machine.
>> So generating functions on the fly and then executing them is OK on
>> linux i.e. i686-pc-linux-gnu
>>
>> My question is:
>>
>> Can we use the LLVM-JIT on a baremetal x86 machine ? Actually my target
>> is a virtual machine, and I need some dynamic code generation support. I
>> intend to use LLVM-JIT (if possible) for this purpose.
>>
>> Furthermore if it is possible, then how much effort would be required ?
>> And where should I start looking for doing this kind of port.
>>
>> Thanks for your help.
>>
>> --
>> Hamayun
>> Grenoble, France.
>>
>>
>>
>
>

-- 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.





More information about the llvm-dev mailing list