<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 19 June 2013 12:42, Dmitri Rubinstein <span dir="ltr"><<a href="mailto:dmitri.rubinstein@googlemail.com" target="_blank">dmitri.rubinstein@googlemail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Am 19.06.2013 18:01, schrieb JF Bastien:<div><div class="h5">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

     From the provided documentation I understood that in memory data<br>
    structures of a PNaCl program are incompatible to the host program<br>
    because ABIs are different (e.g. PNaCl pointers are always 32-bit<br>
    even when running on x86_64 platform).<br>
    So PNaCl program can't access any data structures of the host<br>
    program directly. The only communication way is by using syscalls,<br>
    but the document does not specify syscalls in detail.<br>
<br>
<br>
We should probably clarify in the final documentation, but the goal of<br>
PNaCl is to not only be portable and fast but also be safe for the user,<br>
and the way this is achieved is through NaCl's SFI. Specifically for<br>
syscalls:<br>
<a href="http://www.chromium.org/nativeclient/reference/anatomy-of-a-sys" target="_blank">http://www.chromium.org/<u></u>nativeclient/reference/<u></u>anatomy-of-a-sys</a><br>
In a way the syscalls offered are defined by the embedding sandbox: NaCl<br>
through Chrome and sel_ldr have documented interfaces, and the NaCl SDK<br>
offers POSIX-like interfaces built on top of these.<br>
</blockquote>
<br></div></div>
But this discussion is about stable bitcode format, or do you want to restrict the set of syscalls on the LLVM level ?<br>
I am interested for my project in having a stable portable bitcode format like the one you propose, but not as a part of a browser and I possibly need to have an extended set of syscalls. The documentation does not provide an example how the syscall is represented in the LLVM bitcode. Is this just a function call ?<br>
</blockquote><div><br></div><div>Yes, any calls to interact with the world outside the sandbox are just done via function calls.  The PNaCl program defines an entry point, _start(), which gets passed a data structure containing a pointer to an interface query function.  The user code can call this query function to get function pointers for further interfaces such as write(), mmap(), thread_create(), and others.  These interfaces are defined in <a href="https://src.chromium.org/viewvc/native_client/trunk/src/native_client/src/untrusted/irt/irt.h?revision=11525">https://src.chromium.org/viewvc/native_client/trunk/src/native_client/src/untrusted/irt/irt.h?revision=11525</a>.  This interface layer is already used by NaCl, so it's somewhat orthogonal to PNaCl's subset of LLVM IR.<br>
</div><br></div>Cheers,<br>Mark<br><br></div></div>