Update Runtime
This commit is contained in:
parent
6f5f405327
commit
386e4a19eb
@ -1,6 +1,5 @@
|
|||||||
# Specify Installation Paths
|
# Specify Installation Paths
|
||||||
set(MCPI_INSTALL_DIR "lib/${MCPI_APP_NAME}")
|
set(MCPI_INSTALL_DIR "lib/${MCPI_APP_NAME}")
|
||||||
set(MCPI_BIN_DIR "${MCPI_INSTALL_DIR}/bin")
|
|
||||||
set(MCPI_LEGAL_DIR "${MCPI_INSTALL_DIR}/legal") # For Software Licenses
|
set(MCPI_LEGAL_DIR "${MCPI_INSTALL_DIR}/legal") # For Software Licenses
|
||||||
set(MCPI_SDK_DIR "${MCPI_INSTALL_DIR}/sdk")
|
set(MCPI_SDK_DIR "${MCPI_INSTALL_DIR}/sdk")
|
||||||
set(MCPI_SDK_LIB_DIR "${MCPI_SDK_DIR}/lib")
|
set(MCPI_SDK_LIB_DIR "${MCPI_SDK_DIR}/lib")
|
||||||
|
8
dependencies/runtime/CMakeLists.txt
vendored
8
dependencies/runtime/CMakeLists.txt
vendored
@ -3,10 +3,4 @@ project(runtime)
|
|||||||
## Extra Runtime
|
## Extra Runtime
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
# RPath
|
|
||||||
if(TARGET runtime)
|
|
||||||
set_target_properties(runtime PROPERTIES INSTALL_RPATH "$ORIGIN/../lib/native")
|
|
||||||
target_link_options(runtime PRIVATE "LINKER:--disable-new-dtags")
|
|
||||||
endif()
|
|
2
dependencies/runtime/src
vendored
2
dependencies/runtime/src
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 84e37b572b55afb1eaa2ada1e37bc36de1584cfd
|
Subproject commit 5d400a2b7790f3d99284acb9d44b29012b628943
|
@ -63,7 +63,7 @@ void bootstrap(const options_t &options) {
|
|||||||
// Arguments
|
// Arguments
|
||||||
const std::vector<std::string> args {
|
const std::vector<std::string> args {
|
||||||
#ifdef MCPI_BUILD_RUNTIME
|
#ifdef MCPI_BUILD_RUNTIME
|
||||||
"runtime",
|
binary_directory + "/lib/native/runtime",
|
||||||
#endif
|
#endif
|
||||||
new_mcpi_exe_path
|
new_mcpi_exe_path
|
||||||
};
|
};
|
||||||
|
@ -28,9 +28,6 @@ static void setup_environment(const options_t &options) {
|
|||||||
bind_to_env(_MCPI_FORCE_HEADLESS_ENV, options.force_headless);
|
bind_to_env(_MCPI_FORCE_HEADLESS_ENV, options.force_headless);
|
||||||
bind_to_env(_MCPI_FORCE_NON_HEADLESS_ENV, options.force_non_headless);
|
bind_to_env(_MCPI_FORCE_NON_HEADLESS_ENV, options.force_non_headless);
|
||||||
|
|
||||||
// Configure PATH
|
|
||||||
setup_path();
|
|
||||||
|
|
||||||
// Setup MCPI_HOME
|
// Setup MCPI_HOME
|
||||||
setup_home();
|
setup_home();
|
||||||
// Create If Needed
|
// Create If Needed
|
||||||
|
@ -6,20 +6,6 @@
|
|||||||
#include <libreborn/env/env.h>
|
#include <libreborn/env/env.h>
|
||||||
#include <libreborn/config.h>
|
#include <libreborn/config.h>
|
||||||
|
|
||||||
// $PATH
|
|
||||||
void setup_path() {
|
|
||||||
// Get Binary Directory
|
|
||||||
const std::string binary_directory = get_binary_directory();
|
|
||||||
std::string new_path = binary_directory + "/bin";
|
|
||||||
// Add Existing PATH
|
|
||||||
const char *value = getenv("PATH");
|
|
||||||
if (value != nullptr && strlen(value) > 0) {
|
|
||||||
new_path += std::string(":") + value;
|
|
||||||
}
|
|
||||||
// Set And Free
|
|
||||||
set_and_print_env("PATH", new_path.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Profile Directory
|
// Profile Directory
|
||||||
void setup_home() {
|
void setup_home() {
|
||||||
const char *custom_profile_directory = getenv(MCPI_PROFILE_DIRECTORY_ENV);
|
const char *custom_profile_directory = getenv(MCPI_PROFILE_DIRECTORY_ENV);
|
||||||
|
@ -9,7 +9,6 @@ std::string get_binary_directory();
|
|||||||
|
|
||||||
void copy_sdk(const std::string &binary_directory, bool force);
|
void copy_sdk(const std::string &binary_directory, bool force);
|
||||||
|
|
||||||
void setup_path();
|
|
||||||
void setup_home();
|
void setup_home();
|
||||||
|
|
||||||
bool read_directory(const std::string &path, const std::function<void(const struct dirent *)> &callback, bool allow_nonexistent_dir = false);
|
bool read_directory(const std::string &path, const std::function<void(const struct dirent *)> &callback, bool allow_nonexistent_dir = false);
|
@ -6,15 +6,15 @@ set(MEDIA_LAYER_TRAMPOLINE_SRC src/media-layer-core.cpp src/GLESv1_CM.cpp)
|
|||||||
# Build
|
# Build
|
||||||
if(BUILD_NATIVE_COMPONENTS)
|
if(BUILD_NATIVE_COMPONENTS)
|
||||||
# Host Component
|
# Host Component
|
||||||
add_library(media-layer-trampoline src/host/host.cpp ${MEDIA_LAYER_TRAMPOLINE_SRC})
|
add_library("${TRAMPOLINE_LIBRARY_NAME}" src/host/host.cpp ${MEDIA_LAYER_TRAMPOLINE_SRC})
|
||||||
target_link_libraries(media-layer-trampoline
|
target_link_libraries("${TRAMPOLINE_LIBRARY_NAME}"
|
||||||
reborn-util
|
reborn-util
|
||||||
media-layer-core
|
media-layer-core
|
||||||
trampoline-headers
|
trampoline-headers
|
||||||
)
|
)
|
||||||
target_compile_definitions(media-layer-trampoline PRIVATE MEDIA_LAYER_TRAMPOLINE_HOST)
|
target_compile_definitions("${TRAMPOLINE_LIBRARY_NAME}" PRIVATE MEDIA_LAYER_TRAMPOLINE_HOST)
|
||||||
# Install
|
# Install
|
||||||
setup_library(media-layer-trampoline TRUE TRUE)
|
setup_library("${TRAMPOLINE_LIBRARY_NAME}" TRUE TRUE)
|
||||||
elseif(BUILD_ARM_COMPONENTS)
|
elseif(BUILD_ARM_COMPONENTS)
|
||||||
# Guest Component
|
# Guest Component
|
||||||
add_library(media-layer-core SHARED ${MEDIA_LAYER_TRAMPOLINE_SRC})
|
add_library(media-layer-core SHARED ${MEDIA_LAYER_TRAMPOLINE_SRC})
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include <libreborn/log.h>
|
||||||
|
|
||||||
#include "../common/common.h"
|
#include "../common/common.h"
|
||||||
|
|
||||||
@ -36,7 +39,7 @@ inline void _handle_trampoline_arg<copy_array>(unsigned char *&out, const copy_a
|
|||||||
_handle_trampoline_arg(out, arg.size);
|
_handle_trampoline_arg(out, arg.size);
|
||||||
// Send Data
|
// Send Data
|
||||||
if (arg.size > 0) {
|
if (arg.size > 0) {
|
||||||
static bool just_send_pointer = getenv(MCPI_USE_PIPE_TRAMPOLINE_ENV) == nullptr;
|
static bool just_send_pointer = !is_trampoline_pipe_based();
|
||||||
if (just_send_pointer) {
|
if (just_send_pointer) {
|
||||||
_handle_trampoline_arg(out, uint32_t(arg.data));
|
_handle_trampoline_arg(out, uint32_t(arg.data));
|
||||||
} else {
|
} else {
|
||||||
@ -49,19 +52,26 @@ inline void _handle_trampoline_arg<copy_array>(unsigned char *&out, const copy_a
|
|||||||
__attribute__((unused)) static void _add_to_trampoline_args(__attribute__((unused)) unsigned char *&out) {
|
__attribute__((unused)) static void _add_to_trampoline_args(__attribute__((unused)) unsigned char *&out) {
|
||||||
}
|
}
|
||||||
template <typename T, typename... Args>
|
template <typename T, typename... Args>
|
||||||
void _add_to_trampoline_args(unsigned char *&out, const T &first, const Args... args) {
|
void _add_to_trampoline_args(unsigned char *&out, const T &first, Args&&... args) {
|
||||||
_handle_trampoline_arg(out, first);
|
_handle_trampoline_arg(out, first);
|
||||||
_add_to_trampoline_args(out, args...);
|
_add_to_trampoline_args(out, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main Trampoline Function
|
// Main Trampoline Function
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
unsigned int _trampoline(const unsigned int id, const bool allow_early_return, Args... args) {
|
unsigned int _trampoline(const unsigned int id, const bool allow_early_return, Args&&... args) {
|
||||||
|
// Create Arguments
|
||||||
static unsigned char out[MAX_TRAMPOLINE_ARGS_SIZE];
|
static unsigned char out[MAX_TRAMPOLINE_ARGS_SIZE];
|
||||||
unsigned char *end = out;
|
unsigned char *end = out;
|
||||||
_add_to_trampoline_args(end, args...);
|
_add_to_trampoline_args(end, std::forward<Args>(args)...);
|
||||||
const uint32_t length = end - out;
|
const uint32_t length = end - out;
|
||||||
return raw_trampoline(id, allow_early_return, length, out);
|
// Call
|
||||||
|
uint32_t ret = 0;
|
||||||
|
const uint32_t err = raw_trampoline(id, allow_early_return ? nullptr : &ret, length, out);
|
||||||
|
if (err != 0) {
|
||||||
|
ERR("Trampoline Error: %u", err);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
#define trampoline(...) _trampoline(_id, ##__VA_ARGS__)
|
#define trampoline(...) _trampoline(_id, ##__VA_ARGS__)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user