| Index: mojo/nacl/nonsfi/irt_mojo_nonsfi.cc
|
| diff --git a/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc b/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc
|
| index 4fed496dda4c831685e0759dcf5b0b5efc30f5ad..2c34e45c33d8306696415797b106585f68916309 100644
|
| --- a/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc
|
| +++ b/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc
|
| @@ -8,15 +8,12 @@
|
| #include "mojo/public/platform/nacl/mgl_irt.h"
|
| #include "mojo/public/platform/nacl/mojo_irt.h"
|
| #include "native_client/src/public/irt_core.h"
|
| +#include "native_client/src/untrusted/irt/irt_dev.h"
|
|
|
| namespace {
|
|
|
| MojoHandle g_mojo_handle = MOJO_HANDLE_INVALID;
|
| -
|
| -MojoResult _MojoGetInitialHandle(MojoHandle* handle) {
|
| - *handle = g_mojo_handle;
|
| - return MOJO_RESULT_OK;
|
| -}
|
| +bool g_running_translator = false;
|
|
|
| const struct nacl_irt_mojo kIrtMojo = {
|
| MojoCreateSharedBuffer,
|
| @@ -37,7 +34,7 @@ const struct nacl_irt_mojo kIrtMojo = {
|
| MojoCreateMessagePipe,
|
| MojoWriteMessage,
|
| MojoReadMessage,
|
| - _MojoGetInitialHandle,
|
| + nacl::MojoGetInitialHandle,
|
| };
|
|
|
| const struct nacl_irt_mgl kIrtMGL = {
|
| @@ -57,23 +54,65 @@ const struct nacl_irt_mgl_signal_sync_point kIrtMGLSignalSyncPoint = {
|
| MGLSignalSyncPoint,
|
| };
|
|
|
| +int NotPNaClFilter() {
|
| + return g_running_translator;
|
| +}
|
| +
|
| const struct nacl_irt_interface kIrtInterfaces[] = {
|
| - {NACL_IRT_MOJO_v0_1, &kIrtMojo, sizeof(kIrtMojo), nullptr},
|
| - {NACL_IRT_MGL_v0_1, &kIrtMGL, sizeof(kIrtMGL), nullptr},
|
| - {NACL_IRT_MGL_ONSCREEN_v0_1, &kIrtMGLOnScreen, sizeof(kIrtMGLOnScreen),
|
| - nullptr},
|
| - {NACL_IRT_MGL_SIGNAL_SYNC_POINT_v0_1, &kIrtMGLSignalSyncPoint,
|
| - sizeof(kIrtMGLSignalSyncPoint), nullptr},
|
| + // Interface to call Mojo functions
|
| + { NACL_IRT_MOJO_v0_1,
|
| + &kIrtMojo,
|
| + sizeof(kIrtMojo),
|
| + nullptr },
|
| + // Interface to call PNaCl translation
|
| + { NACL_IRT_PRIVATE_PNACL_TRANSLATOR_COMPILE_v0_1,
|
| + &nacl::nacl_irt_private_pnacl_translator_compile,
|
| + sizeof(nacl_irt_private_pnacl_translator_compile),
|
| + NotPNaClFilter },
|
| + // Interface to call PNaCl linking
|
| + { NACL_IRT_PRIVATE_PNACL_TRANSLATOR_LINK_v0_1,
|
| + &nacl::nacl_irt_private_pnacl_translator_link,
|
| + sizeof(nacl_irt_private_pnacl_translator_link),
|
| + NotPNaClFilter },
|
| + // Adds mechanism for opening object files, like crtbegin.o
|
| + { NACL_IRT_RESOURCE_OPEN_v0_1,
|
| + &nacl::nacl_irt_resource_open,
|
| + sizeof(nacl_irt_resource_open),
|
| + NotPNaClFilter },
|
| + // GPU functions which give control over MGL context
|
| + { NACL_IRT_MGL_v0_1,
|
| + &kIrtMGL,
|
| + sizeof(kIrtMGL),
|
| + nullptr },
|
| + // GPU functions which update framebuffer with respect to the display
|
| + { NACL_IRT_MGL_ONSCREEN_v0_1,
|
| + &kIrtMGLOnScreen,
|
| + sizeof(kIrtMGLOnScreen),
|
| + nullptr },
|
| + // GPU functions to synchronize CPU and GPU services
|
| + { NACL_IRT_MGL_SIGNAL_SYNC_POINT_v0_1,
|
| + &kIrtMGLSignalSyncPoint,
|
| + sizeof(kIrtMGLSignalSyncPoint),
|
| + nullptr },
|
| };
|
|
|
| } // namespace
|
|
|
| namespace nacl {
|
|
|
| +MojoResult MojoGetInitialHandle(MojoHandle* handle) {
|
| + *handle = g_mojo_handle;
|
| + return MOJO_RESULT_OK;
|
| +}
|
| +
|
| void MojoSetInitialHandle(MojoHandle handle) {
|
| g_mojo_handle = handle;
|
| }
|
|
|
| +void MojoPnaclTranslatorEnable() {
|
| + g_running_translator = true;
|
| +}
|
| +
|
| size_t MojoIrtNonsfiQuery(const char* interface_ident,
|
| void* table,
|
| size_t tablesize) {
|
|
|