diff --git a/.gitignore b/.gitignore index 4ff8a5c..29ce42a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,8 @@ daemon.lock debug.log notify.txt src/notify_icon_asset.c +src/config_ini_example_asset.c +src/web_index_asset.c +src/shell_icon_param_asset.c refs/* docs/* diff --git a/Makefile b/Makefile index 9696123..7be9b83 100644 --- a/Makefile +++ b/Makefile @@ -17,10 +17,17 @@ CFLAGS += -DSHADOWMOUNT_VERSION=\"$(VERSION_TAG)\" LDFLAGS := -flto=thin -Wl,--gc-sections # Libraries -LIBS := -lSceNotification -lSceSystemService -lSceUserService -lSceAppInstUtil -lSceNet -lSceSsl -lSceHttp -lsqlite3 $(HOMEBREW_ROOT)/lib/libjson-c.a $(MHD_LIB) $(PNG_LIB) $(ZLIB_LIB) -lpthread -lm +LIBS := -lSceNotification -lSceSystemService -lSceUserService -lSceIpmi -lSceAppInstUtil -lSceNet -lSceSsl -lSceHttp -lsqlite3 $(HOMEBREW_ROOT)/lib/libjson-c.a $(MHD_LIB) $(PNG_LIB) $(ZLIB_LIB) -lpthread -lm PS5_SCE_STUBS_DIR ?= $(PS5_PAYLOAD_SDK)/src/sce_stubs +PS5_SCE_STUB_SOURCE ?= $(firstword \ + $(wildcard $(PS5_SCE_STUBS_DIR)/libkernel_sys.c) \ + $(wildcard $(PS5_PAYLOAD_SDK)/src/sce_stubs/libkernel_sys.c) \ + $(wildcard third_party/ps5-sdk/sce_stubs/libkernel_sys.c)) +ifeq ($(strip $(PS5_SCE_STUB_SOURCE)),) +$(error Missing libkernel_sys.c. Set PS5_SCE_STUB_SOURCE or PS5_SCE_STUBS_DIR, or provide the SDK source checkout) +endif KERNEL_SYS_STUB_SO := src/libkernel_sys_ext.so -KERNEL_SYS_STUB_SRCS := $(PS5_SCE_STUBS_DIR)/libkernel_sys.c src/libkernel_sys_ext.c +KERNEL_SYS_STUB_SRCS := $(PS5_SCE_STUB_SOURCE) src/libkernel_sys_ext.c ASSET_SRCS := src/notify_icon_asset.c src/config_ini_example_asset.c src/web_index_asset.c ASSET_SRCS += src/shell_icon_param_asset.c @@ -43,7 +50,7 @@ shadowmountplus.elf: $(OBJS) $(KERNEL_SYS_STUB_SO) $(PS5_PAYLOAD_SDK)/bin/prospero-strip --strip-all $@ $(KERNEL_SYS_STUB_SO): $(KERNEL_SYS_STUB_SRCS) - test -f "$(PS5_SCE_STUBS_DIR)/libkernel_sys.c" + test -f "$(PS5_SCE_STUB_SOURCE)" $(CC) -shared -Wl,-soname=libkernel_sys.sprx -o $@ $^ src/notify_icon_asset.c: smp_icon.png @@ -58,7 +65,7 @@ src/web_index_asset.c: web/index.html src/shell_icon_param_asset.c: assets/shell_icon_param.json xxd -i $< > $@ -src/sm_api_service.o src/sm_icon_thumb.o src/sm_gameinfo.o: CFLAGS += $(HOMEBREW_CFLAGS) +src/%.o: CFLAGS += $(HOMEBREW_CFLAGS) src/main.o src/sm_image_index.o: CFLAGS += -DSHADOWMOUNT_BUILD_TIME=\"$(BUILD_TIME)\" src/main.o src/sm_image_index.o: FORCE diff --git a/config.ini.example b/config.ini.example index 4f34899..825c726 100644 --- a/config.ini.example +++ b/config.ini.example @@ -61,6 +61,11 @@ # Default: 0 on FW below 12.00, forced to 1 on FW 12.00 and newer # app_install_all=0 +# Automatically install standalone regular .pkg files discovered below scan roots. +# Uses the native AppInstUtil installer and a console-local loopback source. +# Default: 0 +# pkg_install_enabled=0 + # Automatically remove games from the system library when their source # is no longer available: # 1/true/yes/on -> remove after the configured missing delay diff --git a/docs/api.md b/docs/api.md index 7ddcd41..36236ee 100644 --- a/docs/api.md +++ b/docs/api.md @@ -55,7 +55,7 @@ device. | `/api/v1/manual/add` | `{"path":"/mnt/usb0/games/PPSA12345"}` | Idempotently add one game source to `manual.lst` | | `/api/v1/manual/remove` | `{"path":"/mnt/usb0/games/PPSA12345"}` | Remove matching source lines from `manual.lst` | | `/api/v1/settings` | `{}` | Read web-managed runtime settings and scan paths | -| `/api/v1/settings/update` | `{"debug":true,"quiet_mode":false,"update_emulators":true,"fakelib_default_mode":"full","auto_update_ampr":false,"auto_remove_missing_games":false,"auto_remove_missing_delay_seconds":300,"allow_lan_access":true,"fan_target_temperature":0,"scan_paths":["/mnt/usb0/games"]}` | Atomically update the web-managed part of `config.ini` | +| `/api/v1/settings/update` | `{"debug":true,"quiet_mode":false,"update_emulators":true,"fakelib_default_mode":"full","auto_update_ampr":false,"auto_remove_missing_games":false,"pkg_install_enabled":false,"auto_remove_missing_delay_seconds":300,"allow_lan_access":true,"fan_target_temperature":0,"scan_paths":["/mnt/usb0/games"]}` | Atomically update the web-managed part of `config.ini` | | `/api/v1/debug-log` | `{"max_bytes":131072}` | Read a bounded tail of `debug.log` for the web log dialog | | `/api/v1/kernel-log` | `{"max_bytes":131072}` | Read a bounded tail of the SDK kernel-log stream used by crash detection | | `/api/v1/games` | `{"include_size":false}` | Detailed game snapshot; optional physical source-size calculation | @@ -283,7 +283,7 @@ included. A missing `manual.lst` is reported as an empty list. The settings update owns only `debug`, `quiet_mode`, `update_emulators`, `fakelib_default_mode`, `auto_update_ampr`, `auto_remove_missing_games`, -`auto_remove_missing_delay_seconds`, +`pkg_install_enabled`, `auto_remove_missing_delay_seconds`, `api_bind_address`, `fan_target_temperature`, and repeated `scanpath` keys. The `allow_lan_access` field maps to `0.0.0.0` when enabled and `127.0.0.1` when disabled. It atomically rewrites those keys while preserving every unrelated diff --git a/docs/openapi.yaml b/docs/openapi.yaml index f1af2c3..b502053 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -1349,6 +1349,9 @@ components: auto_remove_missing_games: type: boolean description: Remove app registrations whose source remains unavailable. Omission preserves the current value for compatibility with older web clients. + pkg_install_enabled: + type: boolean + description: Automatically install supported standalone PKG files discovered below scan roots. Omission preserves the current value for compatibility with older web clients. auto_remove_missing_delay_seconds: type: integer minimum: 1 diff --git a/include/sm_appinst.h b/include/sm_appinst.h new file mode 100644 index 0000000..4433bdb --- /dev/null +++ b/include/sm_appinst.h @@ -0,0 +1,11 @@ +#ifndef SM_APPINST_H +#define SM_APPINST_H + +#include + +int sm_appinst_initialize(void); +int sm_appinst_install_by_package(const char *uri, const char *title_name); +int sm_appinst_install_all(void *reserved); +int sm_appinst_uninstall(const char *title_id); + +#endif diff --git a/include/sm_config_mount.h b/include/sm_config_mount.h index 3987906..acab078 100644 --- a/include/sm_config_mount.h +++ b/include/sm_config_mount.h @@ -21,6 +21,7 @@ bool sm_config_write_web_settings(bool debug_enabled, bool quiet_mode, bool auto_remove_missing_games, uint32_t auto_remove_missing_delay_seconds, bool allow_lan_access, + bool pkg_install_enabled, uint32_t fan_target_temperature_c, const char *const *scan_paths, size_t scan_path_count, diff --git a/include/sm_pkg.h b/include/sm_pkg.h new file mode 100644 index 0000000..4e4cf21 --- /dev/null +++ b/include/sm_pkg.h @@ -0,0 +1,17 @@ +#ifndef SM_PKG_H +#define SM_PKG_H + +#include +#include + +#include "sm_types.h" + +bool sm_pkg_path_is_candidate(const char *path, const char *name); +bool sm_pkg_is_installed_content_path(const char *path); +bool sm_pkg_parse_file(const char *path, const struct stat *st, + scan_candidate_t *candidate); +const char *sm_pkg_kind_name(pkg_kind_t kind); +bool sm_pkg_kind_is_installable(pkg_kind_t kind); +int sm_pkg_compare_versions(const char *left, const char *right); + +#endif diff --git a/include/sm_pkg_install.h b/include/sm_pkg_install.h new file mode 100644 index 0000000..f6fab56 --- /dev/null +++ b/include/sm_pkg_install.h @@ -0,0 +1,16 @@ +#ifndef SM_PKG_INSTALL_H +#define SM_PKG_INSTALL_H + +#include +#include + +#include "sm_types.h" + +bool sm_pkg_install_queue_candidate(const scan_candidate_t *candidate); +uint64_t sm_pkg_install_next_wake_us(uint64_t now_us); +void sm_pkg_install_service(void); +bool sm_pkg_install_has_pending_work(void); +void sm_pkg_install_forget_path(const char *path); +void sm_pkg_install_shutdown(void); + +#endif diff --git a/include/sm_pkg_server.h b/include/sm_pkg_server.h new file mode 100644 index 0000000..de9adbd --- /dev/null +++ b/include/sm_pkg_server.h @@ -0,0 +1,18 @@ +#ifndef SM_PKG_SERVER_H +#define SM_PKG_SERVER_H + +#include +#include +#include + +typedef struct sm_pkg_server sm_pkg_server_t; + +int sm_pkg_server_start(sm_pkg_server_t **out, const char *pkg_path, + const char *attempt, uint16_t *port_out); +uint64_t sm_pkg_server_bytes_served(sm_pkg_server_t *server); +uint64_t sm_pkg_server_total(sm_pkg_server_t *server); +bool sm_pkg_server_complete(sm_pkg_server_t *server); +uint64_t sm_pkg_server_last_request_us(sm_pkg_server_t *server); +void sm_pkg_server_stop(sm_pkg_server_t *server); + +#endif diff --git a/include/sm_scan_tree.h b/include/sm_scan_tree.h index 443eb39..2997176 100644 --- a/include/sm_scan_tree.h +++ b/include/sm_scan_tree.h @@ -16,10 +16,15 @@ typedef bool (*sm_scan_tree_image_fn)(const char *image_path, const char *image_name, unsigned int depth_from_root, void *ctx); +typedef bool (*sm_scan_tree_pkg_fn)(const char *pkg_path, + const char *pkg_name, + unsigned int depth_from_root, + void *ctx); typedef struct { sm_scan_tree_dir_fn on_directory; sm_scan_tree_image_fn on_image_file; + sm_scan_tree_pkg_fn on_pkg_file; } sm_scan_tree_callbacks_t; // Walk a managed scan subtree using the shared scan-depth and path filtering rules. diff --git a/include/sm_types.h b/include/sm_types.h index 4842cf3..05efa24 100644 --- a/include/sm_types.h +++ b/include/sm_types.h @@ -3,6 +3,7 @@ #include #include +#include #include "sm_limits.h" @@ -91,11 +92,39 @@ struct AppDbTitleList { int capacity; }; +typedef enum { + SCAN_CANDIDATE_DIRECTORY = 0, + SCAN_CANDIDATE_PKG, +} scan_candidate_kind_t; + +typedef enum { + PKG_KIND_UNKNOWN = 0, + PKG_KIND_BASE, + PKG_KIND_PATCH, + PKG_KIND_DLC, +} pkg_kind_t; + typedef struct scan_candidate { char path[MAX_PATH]; char title_id[MAX_TITLE_ID]; char title_name[MAX_TITLE_NAME]; char manual_source_path[MAX_PATH]; + char content_id[MAX_CONTENT_ID]; + char category[16]; + char app_ver[MAX_GAME_VERSION]; + uint32_t content_type; + uint32_t content_flags; + uint32_t outer_content_type; + uint32_t outer_content_flags; + uint64_t source_size; + uint64_t source_device; + uint64_t source_inode; + uint64_t source_ctime; + uint64_t source_fingerprint; + time_t source_mtime; + pkg_kind_t pkg_kind; + bool pkg_classification_confident; + scan_candidate_kind_t kind; bool installed; bool in_app_db; bool manual; @@ -147,6 +176,7 @@ typedef struct runtime_config { bool force_mount; bool persistent_image_mounts; bool app_install_all_enabled; + bool pkg_install_enabled; bool auto_remove_missing_games; bool auto_remove_games_with_dlc; bool backport_fakelib_enabled; diff --git a/src/main.c b/src/main.c index bd96b00..33e15d6 100644 --- a/src/main.c +++ b/src/main.c @@ -27,6 +27,8 @@ #include "sm_scanner.h" #include "sm_time.h" #include "sm_install.h" +#include "sm_appinst.h" +#include "sm_pkg_install.h" #include "sm_appdb.h" #include "sm_kstuff.h" #include "sm_limits.h" @@ -559,7 +561,10 @@ int main(void) { pid_t existing_pid = 0; sceUserServiceInitialize(0); - sceAppInstUtilInitialize(); + int appinst_result = sm_appinst_initialize(); + if (appinst_result != 0) + log_debug(" [APPINST] initialization failed: 0x%08X", + (uint32_t)appinst_result); kernel_set_ucred_authid(-1, AUTHID_BASE); install_signal_handlers(); @@ -695,6 +700,7 @@ int main(void) { sm_shellcore_flags_stop(); sm_shellcore_hooks_stop(); stop_game_lifecycle_watcher(); + sm_pkg_install_shutdown(); sm_shellcore_service_stop(); sm_scanner_shutdown(); sm_mdbg_shutdown(); diff --git a/src/sm_api_service.c b/src/sm_api_service.c index c262de7..b72db6d 100644 --- a/src/sm_api_service.c +++ b/src/sm_api_service.c @@ -10,6 +10,7 @@ #include "sm_api_protocol.h" #include "sm_api_service.h" #include "sm_appdb.h" +#include "sm_appinst.h" #include "sm_config_mount.h" #include "sm_filesystem.h" #include "sm_game_cache.h" @@ -1913,6 +1914,8 @@ static void handle_settings(struct MHD_Connection *connection) { cfg.auto_update_ampr_enabled) || !add_json_bool(response, "auto_remove_missing_games", cfg.auto_remove_missing_games) || + !add_json_bool(response, "pkg_install_enabled", + cfg.pkg_install_enabled) || !add_json_int(response, "auto_remove_missing_delay_seconds", cfg.auto_remove_missing_delay_seconds) || !add_json_int(response, "fan_target_temperature", @@ -1934,6 +1937,7 @@ static void handle_settings_update(struct MHD_Connection *connection, bool update_emulators = false; bool auto_update_ampr = current_cfg.auto_update_ampr_enabled; bool auto_remove_missing_games = current_cfg.auto_remove_missing_games; + bool pkg_install_enabled = current_cfg.pkg_install_enabled; bool allow_lan_access = false; sm_fakelib_mode_t fakelib_default_mode = current_cfg.fakelib_default_mode; struct json_object *mode_value = NULL; @@ -1949,6 +1953,9 @@ static void handle_settings_update(struct MHD_Connection *connection, !get_optional_bool(request, "auto_remove_missing_games", current_cfg.auto_remove_missing_games, &auto_remove_missing_games) || + !get_optional_bool(request, "pkg_install_enabled", + current_cfg.pkg_install_enabled, + &pkg_install_enabled) || !get_required_bool(request, "allow_lan_access", &allow_lan_access) || !json_object_object_get_ex(request, "fan_target_temperature", &fan_value) || @@ -2024,6 +2031,7 @@ static void handle_settings_update(struct MHD_Connection *connection, auto_update_ampr, auto_remove_missing_games, (uint32_t)remove_delay_int, allow_lan_access, + pkg_install_enabled, (uint32_t)fan_value_int, paths, path_count, fakelib_default_mode)) { int status = valid && errno != 0 ? errno : EINVAL; @@ -2222,7 +2230,7 @@ static int request_game_uninstall(const char *title_id, source_missing = source_error && strcmp(source_error, "source_missing") == 0; } - int platform_status = sceAppInstUtilAppUnInstall(title_id); + int platform_status = sm_appinst_uninstall(title_id); if (platform_status != 0) { log_debug(" [API] uninstall request failed: title=%s code=0x%08X", title_id, (uint32_t)platform_status); diff --git a/src/sm_appinst.c b/src/sm_appinst.c new file mode 100644 index 0000000..1aeae29 --- /dev/null +++ b/src/sm_appinst.c @@ -0,0 +1,151 @@ +#include "sm_platform.h" + +#include + +#include "sm_appinst.h" +#include "sm_log.h" + +#define SM_APPINST_SHELLCORE_AUTHID UINT64_C(0x3800000000000010) +#define SM_APPINST_SYSTEM_AUTHID UINT64_C(0x4801000000000013) + +typedef char sm_playgo_scenario_id_t[3]; +typedef char sm_language_t[8]; +typedef char sm_content_id_t[0x30]; + +typedef struct { + sm_content_id_t content_id; + int content_type; + int content_platform; +} sm_app_install_pkg_info_t; + +typedef struct { + const char *uri; + const char *ex_uri; + const char *playgo_scenario_id; + const char *content_id; + const char *content_name; + const char *icon_url; + uint64_t unknown_30; + uint64_t reserved[7]; +} sm_appinst_meta_info_t; + +_Static_assert(sizeof(sm_appinst_meta_info_t) == 0x70, + "InstallByPackage MetaInfo layout mismatch"); + +typedef struct { + sm_language_t languages[30]; + sm_playgo_scenario_id_t playgo_scenario_ids[64]; + sm_content_id_t content_ids[64]; + unsigned char unknown[6480]; +} sm_playgo_info_t; + +extern int sceAppInstUtilInstallByPackage(sm_appinst_meta_info_t *meta, + sm_app_install_pkg_info_t *pkg_info, + sm_playgo_info_t *playgo); + +static pthread_mutex_t g_appinst_mutex = PTHREAD_MUTEX_INITIALIZER; +static bool g_appinst_initialized; + +static uint64_t acquire_authid(uint64_t target, bool *changed) { + uint64_t saved = kernel_get_ucred_authid(getpid()); + *changed = false; + if (saved == 0 || saved == target) + return saved; + if (kernel_set_ucred_authid(getpid(), target) == 0) + *changed = true; + return saved; +} + +static bool restore_authid(uint64_t saved, bool changed) { + if (!changed) + return true; + for (int attempt = 0; attempt < 3; attempt++) { + if (kernel_set_ucred_authid(getpid(), saved) == 0 && + kernel_get_ucred_authid(getpid()) == saved) + return true; + } + return false; +} + +int sm_appinst_initialize(void) { + int result; + pthread_mutex_lock(&g_appinst_mutex); + if (g_appinst_initialized) { + pthread_mutex_unlock(&g_appinst_mutex); + return 0; + } + bool changed = false; + uint64_t saved = acquire_authid(SM_APPINST_SYSTEM_AUTHID, &changed); + result = sceAppInstUtilInitialize(); + if (!restore_authid(saved, changed)) + log_debug(" [APPINST] failed to restore authid after initialize"); + if (result == 0) + g_appinst_initialized = true; + pthread_mutex_unlock(&g_appinst_mutex); + return result; +} + +int sm_appinst_install_by_package(const char *uri, const char *title_name) { + int result; + sm_appinst_meta_info_t meta; + sm_app_install_pkg_info_t pkg_info; + sm_playgo_info_t playgo; + bool changed = false; + uint64_t target = sm_firmware_major_version() < 11u + ? SM_APPINST_SHELLCORE_AUTHID + : SM_APPINST_SYSTEM_AUTHID; + uint64_t saved = 0; + if (!uri || uri[0] == '\0') + return EINVAL; + + pthread_mutex_lock(&g_appinst_mutex); + if (!g_appinst_initialized) { + bool init_changed = false; + uint64_t init_saved = acquire_authid(SM_APPINST_SYSTEM_AUTHID, + &init_changed); + int init_result = sceAppInstUtilInitialize(); + if (!restore_authid(init_saved, init_changed)) + log_debug(" [APPINST] failed to restore authid after initialize"); + if (init_result != 0) { + pthread_mutex_unlock(&g_appinst_mutex); + return init_result; + } + g_appinst_initialized = true; + } + + memset(&meta, 0, sizeof(meta)); + memset(&pkg_info, 0, sizeof(pkg_info)); + memset(&playgo, 0, sizeof(playgo)); + meta.uri = uri; + meta.ex_uri = ""; + meta.playgo_scenario_id = ""; + meta.content_id = ""; + meta.content_name = title_name ? title_name : ""; + meta.icon_url = ""; + + saved = acquire_authid(target, &changed); + result = sceAppInstUtilInstallByPackage(&meta, &pkg_info, &playgo); + if (!restore_authid(saved, changed)) + log_debug(" [APPINST] failed to restore authid after InstallByPackage"); + sceKernelUsleep(200000); + pthread_mutex_unlock(&g_appinst_mutex); + return result; +} + +int sm_appinst_install_all(void *reserved) { + int result; + pthread_mutex_lock(&g_appinst_mutex); + result = sceAppInstUtilAppInstallAll(reserved); + sceKernelUsleep(200000); + pthread_mutex_unlock(&g_appinst_mutex); + return result; +} + +int sm_appinst_uninstall(const char *title_id) { + int result; + pthread_mutex_lock(&g_appinst_mutex); + result = sceAppInstUtilAppUnInstall(title_id); + sceKernelUsleep(200000); + pthread_mutex_unlock(&g_appinst_mutex); + return result; +} diff --git a/src/sm_config_mount.c b/src/sm_config_mount.c index e744ea9..39fd0c4 100644 --- a/src/sm_config_mount.c +++ b/src/sm_config_mount.c @@ -99,6 +99,7 @@ static bool web_managed_config_key(const char *key) { strcasecmp(key, "fan_target_temperature") == 0 || strcasecmp(key, "api_bind_address") == 0 || strcasecmp(key, "api_bind_adress") == 0 || + strcasecmp(key, "pkg_install_enabled") == 0 || strcasecmp(key, "scanpath") == 0; } @@ -234,6 +235,7 @@ static void init_runtime_config_defaults(runtime_config_state_t *state) { state->cfg.force_mount = false; state->cfg.persistent_image_mounts = false; state->cfg.app_install_all_enabled = false; + state->cfg.pkg_install_enabled = false; state->cfg.auto_remove_missing_games = false; state->cfg.auto_remove_games_with_dlc = false; state->cfg.backport_fakelib_enabled = true; @@ -1164,6 +1166,15 @@ static config_load_status_t load_runtime_config_state(runtime_config_state_t *st continue; } + if (strcasecmp(key, "pkg_install_enabled") == 0) { + if (!parse_bool_ini(value, &bval)) { + log_debug(" [CFG] invalid bool at line %d: %s=%s", line_no, key, value); + continue; + } + state->cfg.pkg_install_enabled = bval; + continue; + } + if (strcasecmp(key, "auto_remove_missing_games") == 0) { if (!parse_bool_ini(value, &bval)) { log_debug(" [CFG] invalid bool at line %d: %s=%s", line_no, key, value); @@ -1511,7 +1522,7 @@ static config_load_status_t load_runtime_config_state(runtime_config_state_t *st log_debug(" [CFG] loaded: api_enabled=%d debug=%d quiet=%d language=%s " "ro=%d force=%d " - "persistent_image_mounts=%d app_install_all=%d " + "persistent_image_mounts=%d app_install_all=%d pkg_install_enabled=%d " "auto_remove_missing_games=%d " "auto_remove_games_with_dlc=%d auto_remove_missing_delay_s=%u " "api=%s:%u scan_depth=%u " @@ -1533,6 +1544,7 @@ static config_load_status_t load_runtime_config_state(runtime_config_state_t *st state->cfg.force_mount ? 1 : 0, state->cfg.persistent_image_mounts ? 1 : 0, state->cfg.app_install_all_enabled ? 1 : 0, + state->cfg.pkg_install_enabled ? 1 : 0, state->cfg.auto_remove_missing_games ? 1 : 0, state->cfg.auto_remove_games_with_dlc ? 1 : 0, state->cfg.auto_remove_missing_delay_seconds, @@ -1786,6 +1798,7 @@ bool sm_config_write_web_settings(bool debug_enabled, bool quiet_mode, bool auto_remove_missing_games, uint32_t auto_remove_missing_delay_seconds, bool allow_lan_access, + bool pkg_install_enabled, uint32_t fan_target_temperature_c, const char *const *scan_paths, size_t scan_path_count, @@ -1925,6 +1938,10 @@ bool sm_config_write_web_settings(bool debug_enabled, bool quiet_mode, allow_lan_access ? "0.0.0.0" : "127.0.0.1") < 0) { saved_errno = config_io_error(); } + if (saved_errno == 0 && + fprintf(out, "pkg_install_enabled=%u\n", pkg_install_enabled ? 1u : 0u) < 0) { + saved_errno = config_io_error(); + } if (saved_errno == 0) { if (fan_target_temperature_c == FAN_TARGET_TEMPERATURE_SYSTEM) { if (fputs("fan_target_temperature=system\n", out) == EOF) diff --git a/src/sm_game_cache.c b/src/sm_game_cache.c index e80153c..502a3af 100644 --- a/src/sm_game_cache.c +++ b/src/sm_game_cache.c @@ -3,6 +3,7 @@ #include #include "sm_game_cache.h" +#include "sm_appinst.h" #include "sm_appdb.h" #include "sm_config_mount.h" #include "sm_filesystem.h" @@ -371,7 +372,7 @@ void reconcile_missing_app_db_games(void) { cfg.auto_remove_games_with_dlc)) continue; - int res = sceAppInstUtilAppUnInstall(title_id); + int res = sm_appinst_uninstall(title_id); if (res == 0) { sm_install_forget_pending_title(title_id); invalidate_app_db_title_cache(); diff --git a/src/sm_install.c b/src/sm_install.c index d08910a..48ddb03 100644 --- a/src/sm_install.c +++ b/src/sm_install.c @@ -16,6 +16,7 @@ #include "sm_image_cache.h" #include "sm_paths.h" #include "sm_manual.h" +#include "sm_pkg_install.h" #include "sm_shellcore_hooks.h" #include @@ -406,6 +407,13 @@ void process_scan_candidates(const scan_candidate_t *candidates, const scan_candidate_t *c = &candidates[i]; if (sm_shellcore_title_is_protected(c->title_id)) continue; + + if (c->kind == SCAN_CANDIDATE_PKG) { + if (!sm_pkg_install_queue_candidate(c)) + log_debug(" [PKG] failed to queue package: %s", c->path); + continue; + } + bool has_src_snd0 = false; bool use_app_install_all = runtime_config().app_install_all_enabled && !c->in_app_db; diff --git a/src/sm_install_queue.c b/src/sm_install_queue.c index 9b11d38..40bd139 100644 --- a/src/sm_install_queue.c +++ b/src/sm_install_queue.c @@ -3,6 +3,7 @@ #include #include "sm_install_queue.h" +#include "sm_appinst.h" #include "sm_types.h" #include "sm_appdb.h" #include "sm_config_mount.h" @@ -447,7 +448,7 @@ bool sm_install_submit_queued(void) { log_queued_install_batch(); notify_queued_install_batch(); - int res = sceAppInstUtilAppInstallAll(NULL); + int res = sm_appinst_install_all(NULL); if (res != 0) { log_debug(" [REG] Batch install request failed: 0x%x", res); if (!g_queued_install_submit_failure_notified) { diff --git a/src/sm_pkg.c b/src/sm_pkg.c new file mode 100644 index 0000000..f5b91d9 --- /dev/null +++ b/src/sm_pkg.c @@ -0,0 +1,505 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "sm_pkg.h" + +#define PKG_MAGIC_CNT 0x7F434E54u +#define PKG_MAGIC_FIH 0x7F464948u +#define PKG_HEADER_SIZE 0xA0u +#define PKG_ENTRY_SIZE 0x20u +#define PKG_MAX_ENTRIES 1024u +#define PKG_PARAM_MAX (1024u * 1024u) +#define PKG_ENTRY_PARAM_SFO 0x1000u +#define PKG_ENTRY_PARAM_JSON 0x2000u +#define PKG_PATCH_FLAG_MASK 0x40100000u +#define PKG_FINGERPRINT_SAMPLE 4096u + +static bool read_at(int fd, uint64_t offset, void *buffer, size_t size); + +static uint64_t fingerprint_bytes(uint64_t hash, const uint8_t *data, + size_t size) { + for (size_t i = 0; i < size; i++) { + hash ^= data[i]; + hash *= 1099511628211ull; + } + return hash; +} + +static uint64_t package_fingerprint(int fd, uint64_t file_size) { + uint8_t sample[PKG_FINGERPRINT_SAMPLE]; + uint64_t hash = 1469598103934665603ull; + hash = fingerprint_bytes(hash, (const uint8_t *)&file_size, + sizeof(file_size)); + size_t first = file_size < sizeof(sample) ? (size_t)file_size : sizeof(sample); + if (first > 0 && !read_at(fd, 0, sample, first)) + return 0; + hash = fingerprint_bytes(hash, sample, first); + if (file_size > first) { + size_t last = file_size < sizeof(sample) ? (size_t)file_size : sizeof(sample); + if (!read_at(fd, file_size - last, sample, last)) + return 0; + hash = fingerprint_bytes(hash, sample, last); + } + return hash; +} + +static bool read_at(int fd, uint64_t offset, void *buffer, size_t size) { + size_t done = 0; + while (done < size) { + ssize_t n = pread(fd, (char *)buffer + done, size - done, + (off_t)(offset + done)); + if (n <= 0) + return false; + done += (size_t)n; + } + return true; +} + +static uint32_t be32(const uint8_t *p) { + return ((uint32_t)p[0] << 24) | ((uint32_t)p[1] << 16) | + ((uint32_t)p[2] << 8) | p[3]; +} + +static uint64_t le64(const uint8_t *p) { + uint64_t value = 0; + for (int i = 7; i >= 0; i--) + value = (value << 8) | p[i]; + return value; +} + +static const char *pkg_filename(const char *path) { + const char *slash = path ? strrchr(path, '/') : NULL; + return slash ? slash + 1 : path; +} + +static void copy_string(char *out, size_t out_size, const char *value) { + if (!out || out_size == 0) + return; + if (!value) + value = ""; + size_t length = strlen(value); + if (length >= out_size) + length = out_size - 1u; + memcpy(out, value, length); + out[length] = '\0'; +} + +static bool pkg_extension(const char *name) { + if (!name) + return false; + size_t length = strlen(name); + return length >= 4 && strcasecmp(name + length - 4, ".pkg") == 0; +} + +bool sm_pkg_path_is_candidate(const char *path, const char *name) { + if (!path || !pkg_extension(name ? name : pkg_filename(path))) + return false; + struct stat st; + return stat(path, &st) == 0 && S_ISREG(st.st_mode); +} + +bool sm_pkg_is_installed_content_path(const char *path) { + if (!path) + return false; + const char *rest = NULL; + if (strncmp(path, "/user/", 6) == 0) { + rest = path + 6; + } else if (strncmp(path, "/mnt/ext", 8) == 0) { + const char *p = path + 8; + if (*p < '0' || *p > '9') + return false; + while (*p >= '0' && *p <= '9') + p++; + if (strncmp(p, "/user/", 6) == 0) + rest = p + 6; + else if (strncmp(p, "/ps5/user/", 10) == 0) + rest = p + 10; + } + return rest && (strncmp(rest, "app/", 4) == 0 || + strncmp(rest, "patch/", 6) == 0 || + strncmp(rest, "addcont/", 8) == 0); +} + +const char *sm_pkg_kind_name(pkg_kind_t kind) { + switch (kind) { + case PKG_KIND_BASE: + return "base"; + case PKG_KIND_PATCH: + return "patch"; + case PKG_KIND_DLC: + return "dlc"; + default: + return "unknown"; + } +} + +bool sm_pkg_kind_is_installable(pkg_kind_t kind) { + return kind == PKG_KIND_BASE || kind == PKG_KIND_PATCH || + kind == PKG_KIND_DLC; +} + +int sm_pkg_compare_versions(const char *left, const char *right) { + const char *lp = left ? left : ""; + const char *rp = right ? right : ""; + for (;;) { + unsigned long l = 0; + unsigned long r = 0; + while (*lp >= '0' && *lp <= '9') + l = l * 10u + (unsigned long)(*lp++ - '0'); + while (*rp >= '0' && *rp <= '9') + r = r * 10u + (unsigned long)(*rp++ - '0'); + if (l != r) + return l < r ? -1 : 1; + while (*lp == '.') + lp++; + while (*rp == '.') + rp++; + bool ld = *lp >= '0' && *lp <= '9'; + bool rd = *rp >= '0' && *rp <= '9'; + if (!ld && !rd) + return 0; + if (!ld) + return -1; + if (!rd) + return 1; + } +} + +static bool content_title_id(const char *content_id, char out[MAX_TITLE_ID]) { + const char *dash = strchr(content_id, '-'); + if (!dash) + return false; + dash++; + const char *end = strchr(dash, '_'); + if (!end || end - dash != 9) + return false; + if (end - dash >= MAX_TITLE_ID) + return false; + for (const char *p = dash; p < end; p++) { + if (!isalnum((unsigned char)*p)) + return false; + } + size_t length = (size_t)(end - dash); + memcpy(out, dash, length); + out[length] = '\0'; + return true; +} + +static bool parse_sfo(const uint8_t *data, size_t size, scan_candidate_t *candidate) { + if (size < 20 || memcmp(data, "\0PSF", 4) != 0) + return false; + uint32_t key_offset = (uint32_t)data[8] | ((uint32_t)data[9] << 8) | + ((uint32_t)data[10] << 16) | ((uint32_t)data[11] << 24); + uint32_t value_offset = (uint32_t)data[12] | ((uint32_t)data[13] << 8) | + ((uint32_t)data[14] << 16) | ((uint32_t)data[15] << 24); + uint32_t count = (uint32_t)data[16] | ((uint32_t)data[17] << 8) | + ((uint32_t)data[18] << 16) | ((uint32_t)data[19] << 24); + if (count > (size - 20u) / 16u || key_offset >= size || value_offset >= size) + return false; + + for (uint32_t i = 0; i < count; i++) { + size_t entry = 20u + (size_t)i * 16u; + uint16_t key_rel = (uint16_t)data[entry] | ((uint16_t)data[entry + 1] << 8); + uint16_t format = (uint16_t)data[entry + 2] | + ((uint16_t)data[entry + 3] << 8); + uint32_t length = (uint32_t)data[entry + 4] | + ((uint32_t)data[entry + 5] << 8) | + ((uint32_t)data[entry + 6] << 16) | + ((uint32_t)data[entry + 7] << 24); + uint32_t value_rel = (uint32_t)data[entry + 12] | + ((uint32_t)data[entry + 13] << 8) | + ((uint32_t)data[entry + 14] << 16) | + ((uint32_t)data[entry + 15] << 24); + size_t key_pos = (size_t)key_offset + key_rel; + size_t value_pos = (size_t)value_offset + value_rel; + if (key_pos >= size || value_pos > size || length > size - value_pos) + continue; + + const uint8_t *key_end = memchr(data + key_pos, '\0', size - key_pos); + if (!key_end) + continue; + size_t key_length = (size_t)(key_end - (data + key_pos)); + const char *destination = NULL; + size_t destination_size = 0; + if (format == 0x0004 || format == 0x0204) { + if (key_length == 5 && memcmp(data + key_pos, "TITLE", 5) == 0) { + destination = candidate->title_name; + destination_size = sizeof(candidate->title_name); + } else if (key_length == 8 && memcmp(data + key_pos, "TITLE_ID", 8) == 0) { + destination = candidate->title_id; + destination_size = sizeof(candidate->title_id); + } else if (key_length == 8 && memcmp(data + key_pos, "CATEGORY", 8) == 0) { + destination = candidate->category; + destination_size = sizeof(candidate->category); + } else if (key_length == 7 && memcmp(data + key_pos, "APP_VER", 7) == 0) { + destination = candidate->app_ver; + destination_size = sizeof(candidate->app_ver); + } else if (key_length == 10 && memcmp(data + key_pos, "CONTENT_ID", 10) == 0) { + destination = candidate->content_id; + destination_size = sizeof(candidate->content_id); + } + } + if (!destination) + continue; + size_t copy_length = 0; + while (copy_length < length && data[value_pos + copy_length] != '\0') + copy_length++; + if (copy_length >= destination_size) + continue; + memcpy((char *)destination, data + value_pos, copy_length); + ((char *)destination)[copy_length] = '\0'; + } + return true; +} + +static bool parse_param_json(const uint8_t *data, size_t size, + scan_candidate_t *candidate) { + while (size > 0 && data[size - 1] == '\0') + size--; + if (size == 0) + return false; + char *text = malloc(size + 1u); + if (!text) + return false; + memcpy(text, data, size); + text[size] = '\0'; + struct json_tokener *tokener = json_tokener_new_ex(8); + if (!tokener) { + free(text); + return false; + } + json_tokener_set_flags(tokener, + JSON_TOKENER_STRICT | JSON_TOKENER_VALIDATE_UTF8); + struct json_object *root = json_tokener_parse_ex(tokener, text, (int)size); + bool ok = root && json_tokener_get_error(tokener) == json_tokener_success && + json_object_is_type(root, json_type_object); + if (ok) { + struct json_object *value = NULL; + if (json_object_object_get_ex(root, "contentId", &value) && + json_object_is_type(value, json_type_string)) + copy_string(candidate->content_id, sizeof(candidate->content_id), + json_object_get_string(value)); + if (json_object_object_get_ex(root, "titleId", &value) && + json_object_is_type(value, json_type_string)) + copy_string(candidate->title_id, sizeof(candidate->title_id), + json_object_get_string(value)); + if (json_object_object_get_ex(root, "contentVersion", &value) && + json_object_is_type(value, json_type_string)) + copy_string(candidate->app_ver, sizeof(candidate->app_ver), + json_object_get_string(value)); + if (json_object_object_get_ex(root, "masterVersion", &value) && + json_object_is_type(value, json_type_string) && + candidate->app_ver[0] == '\0') + copy_string(candidate->app_ver, sizeof(candidate->app_ver), + json_object_get_string(value)); + struct json_object *localized = NULL; + if (json_object_object_get_ex(root, "localizedParameters", &localized) && + json_object_is_type(localized, json_type_object)) { + struct json_object *language = NULL; + const char *preferred = NULL; + if (json_object_object_get_ex(localized, "defaultLanguage", &language) && + json_object_is_type(language, json_type_string)) + preferred = json_object_get_string(language); + struct json_object *params = NULL; + if (preferred) + json_object_object_get_ex(localized, preferred, ¶ms); + if (!params) { + struct json_object_iter iterator; + json_object_object_foreachC(localized, iterator) { + if (strcmp(iterator.key, "defaultLanguage") != 0 && + json_object_is_type(iterator.val, json_type_object)) { + params = iterator.val; + break; + } + } + } + if (params && json_object_object_get_ex(params, "titleName", &value) && + json_object_is_type(value, json_type_string)) + copy_string(candidate->title_name, sizeof(candidate->title_name), + json_object_get_string(value)); + } + } + if (root) + json_object_put(root); + json_tokener_free(tokener); + free(text); + return ok; +} + +static bool read_pkg_sfo(int fd, uint64_t base, const uint8_t *header, + uint64_t file_size, scan_candidate_t *candidate) { + uint32_t count = be32(header + 0x10); + uint32_t table = be32(header + 0x18); + if (count == 0 || count > PKG_MAX_ENTRIES || + table > file_size - base || + (uint64_t)count > (file_size - base - table) / PKG_ENTRY_SIZE) + return false; + + uint8_t entry[PKG_ENTRY_SIZE]; + for (uint32_t i = 0; i < count; i++) { + uint64_t entry_offset = base + table + (uint64_t)i * PKG_ENTRY_SIZE; + if (!read_at(fd, entry_offset, entry, sizeof(entry))) + return false; + uint32_t id = be32(entry); + if (id != PKG_ENTRY_PARAM_SFO && id != PKG_ENTRY_PARAM_JSON) + continue; + uint32_t offset = be32(entry + 0x10); + uint32_t length = be32(entry + 0x14); + if (length == 0 || length > PKG_PARAM_MAX || offset > file_size - base || + (uint64_t)length > file_size - base - offset) + continue; + uint8_t *data = malloc(length); + if (!data) + return false; + bool ok = read_at(fd, base + offset, data, length); + if (ok && id == PKG_ENTRY_PARAM_SFO) + ok = parse_sfo(data, length, candidate); + else if (ok && id == PKG_ENTRY_PARAM_JSON) + ok = parse_param_json(data, length, candidate); + free(data); + if (!ok && (id == PKG_ENTRY_PARAM_SFO || id == PKG_ENTRY_PARAM_JSON)) + return false; + } + return true; +} + +bool sm_pkg_parse_file(const char *path, const struct stat *st, + scan_candidate_t *candidate) { + if (!path || !st || !candidate || !S_ISREG(st->st_mode) || + !pkg_extension(pkg_filename(path))) + return false; + int fd = open(path, O_RDONLY); + if (fd < 0) + return false; + uint64_t file_size = (uint64_t)st->st_size; + uint8_t header[PKG_HEADER_SIZE]; + bool ok = file_size >= sizeof(header) && read_at(fd, 0, header, sizeof(header)); + if (!ok) { + close(fd); + return false; + } + + uint32_t magic = be32(header); + uint32_t outer_content_type = be32(header + 0x74); + uint32_t outer_content_flags = be32(header + 0x78); + uint64_t base = 0; + if (magic == PKG_MAGIC_FIH) { + uint16_t version = (uint16_t)header[6] | ((uint16_t)header[7] << 8); + base = le64(header + 0x58); + if (version != 3 || base > file_size || sizeof(header) > file_size - base || + !read_at(fd, base, header, sizeof(header)) || be32(header) != PKG_MAGIC_CNT) { + close(fd); + return false; + } + } else if (magic != PKG_MAGIC_CNT) { + close(fd); + return false; + } + + memset(candidate, 0, sizeof(*candidate)); + copy_string(candidate->path, sizeof(candidate->path), path); + candidate->kind = SCAN_CANDIDATE_PKG; + candidate->source_size = file_size; + candidate->source_device = (uint64_t)st->st_dev; + candidate->source_inode = (uint64_t)st->st_ino; + candidate->source_ctime = (uint64_t)st->st_ctime; + candidate->source_mtime = st->st_mtime; + candidate->source_fingerprint = package_fingerprint(fd, file_size); + if (candidate->source_fingerprint == 0) { + close(fd); + return false; + } + candidate->outer_content_type = outer_content_type; + candidate->outer_content_flags = outer_content_flags; + size_t content_length = 0; + while (content_length < 36 && header[0x40u + content_length] != '\0') + content_length++; + if (content_length == 0 || content_length >= sizeof(candidate->content_id)) { + close(fd); + return false; + } + memcpy(candidate->content_id, header + 0x40, content_length); + candidate->content_id[content_length] = '\0'; + bool parsed = read_pkg_sfo(fd, base, header, file_size, candidate); + close(fd); + if (!parsed) + return false; + if (candidate->title_id[0] == '\0') + (void)content_title_id(candidate->content_id, candidate->title_id); + if (candidate->title_id[0] == '\0') + return false; + bool supported_title_id = + strlen(candidate->title_id) == 9u && + (strncmp(candidate->title_id, "PPSA", 4u) == 0 || + strncmp(candidate->title_id, "CUSA", 4u) == 0 || + strncmp(candidate->title_id, "LAPY", 4u) == 0); + if (supported_title_id) { + for (size_t i = 4; i < 9; i++) { + if (candidate->title_id[i] < '0' || candidate->title_id[i] > '9') { + supported_title_id = false; + break; + } + } + } + if (!supported_title_id) { + return false; + } + candidate->content_type = be32(header + 0x74); + candidate->content_flags = be32(header + 0x78); + candidate->pkg_classification_confident = + candidate->content_type == 0x1Au || candidate->content_type == 0x1Bu || + candidate->content_type == 0x20u || candidate->content_type == 0x21u; + if (candidate->content_type == 0x26u) { + candidate->pkg_kind = PKG_KIND_UNKNOWN; + candidate->pkg_classification_confident = false; + } else if (candidate->content_type == 0x1Bu || + candidate->content_type == 0x21u) { + candidate->pkg_kind = PKG_KIND_DLC; + if (candidate->category[0] == '\0') + copy_string(candidate->category, sizeof(candidate->category), "ac"); + } else if ((candidate->content_flags & PKG_PATCH_FLAG_MASK) != 0) { + candidate->pkg_kind = PKG_KIND_PATCH; + if (candidate->category[0] == '\0') + copy_string(candidate->category, sizeof(candidate->category), "gp"); + } else { + candidate->pkg_kind = PKG_KIND_BASE; + if (candidate->category[0] == '\0') + copy_string(candidate->category, sizeof(candidate->category), "gd"); + } + if (candidate->category[0] != '\0') { + pkg_kind_t sfo_kind = PKG_KIND_UNKNOWN; + if (strcasecmp(candidate->category, "gd") == 0 || + strcasecmp(candidate->category, "gde") == 0 || + strcasecmp(candidate->category, "gdc") == 0 || + strcasecmp(candidate->category, "gdp") == 0) + sfo_kind = PKG_KIND_BASE; + else if (strcasecmp(candidate->category, "gp") == 0 || + strcasecmp(candidate->category, "gpd") == 0 || + strcasecmp(candidate->category, "ps5dp") == 0) + sfo_kind = PKG_KIND_PATCH; + else if (strcasecmp(candidate->category, "ac") == 0 || + strcasecmp(candidate->category, "ps5ac") == 0 || + strcasecmp(candidate->category, "dlc") == 0) + sfo_kind = PKG_KIND_DLC; + if (sfo_kind != PKG_KIND_UNKNOWN && sfo_kind != candidate->pkg_kind) + candidate->pkg_classification_confident = false; + } + if (!sm_pkg_kind_is_installable(candidate->pkg_kind) || + !candidate->pkg_classification_confident) + return false; + if (candidate->title_name[0] == '\0') + copy_string(candidate->title_name, sizeof(candidate->title_name), + pkg_filename(path)); + return true; +} diff --git a/src/sm_pkg_install.c b/src/sm_pkg_install.c new file mode 100644 index 0000000..e5b674f --- /dev/null +++ b/src/sm_pkg_install.c @@ -0,0 +1,937 @@ +#include "sm_platform.h" + +#include +#include +#include +#include + +#include "sm_appdb.h" +#include "sm_appinst.h" +#include "sm_config_mount.h" +#include "sm_game_lifecycle.h" +#include "sm_log.h" +#include "sm_path_utils.h" +#include "sm_pkg.h" +#include "sm_pkg_install.h" +#include "sm_pkg_server.h" +#include "sm_runtime.h" +#include "sm_scanner.h" +#include "sm_shellcore_service.h" +#include "sm_time.h" + +#define PKG_INSTALL_TIMEOUT_US (900ull * 1000000ull) +#define PKG_INSTALL_RETRY_US (5ull * 1000000ull) +#define PKG_INSTALL_POLL_US (2ull * 1000000ull) +#define PKG_INSTALL_IDLE_GRACE_US (5ull * 1000000ull) +#define PKG_INSTALL_MAX 128 +#define PKG_INSTALL_MAX_FAILED_ATTEMPTS 3 +#define PKG_INSTALL_BLOCKED_RETRY_US (5ull * 1000000ull) +#define PKG_INSTALL_ATTEMPT_MAX 64 +#define PKG_INSTALL_URI_MAX (MAX_PATH * 3 + PKG_INSTALL_ATTEMPT_MAX + 64) + +typedef enum { + PKG_STATE_NONE = 0, + PKG_STATE_QUEUED, + PKG_STATE_SUBMITTING, + PKG_STATE_WAITING, + PKG_STATE_DONE, + PKG_STATE_FAILED, +} pkg_state_t; + +typedef struct { + char path[MAX_PATH]; + char title_id[MAX_TITLE_ID]; + char title_name[MAX_TITLE_NAME]; + char content_id[MAX_CONTENT_ID]; + char category[16]; + char app_ver[MAX_GAME_VERSION]; + char attempt[PKG_INSTALL_ATTEMPT_MAX]; + char uri[PKG_INSTALL_URI_MAX]; + sm_pkg_server_t *server; + uint64_t source_size; + uint64_t source_device; + uint64_t source_inode; + uint64_t source_ctime; + uint64_t source_fingerprint; + time_t source_mtime; + pkg_kind_t pkg_kind; + uint64_t requested_at_us; + uint64_t next_attempt_us; + uint64_t last_bytes_served; + uint64_t last_bytes_progress_us; + uint32_t failed_attempts; + uint32_t last_code; + pkg_state_t state; +} pkg_entry_t; + +static pkg_entry_t g_entries[PKG_INSTALL_MAX]; +static bool g_pkg_native_recovery_required; +static bool g_pkg_shutdown_requested; +static bool g_pkg_submit_thread_started; +static bool g_pkg_submit_thread_done; +static pthread_t g_pkg_submit_thread; +static pthread_mutex_t g_pkg_mutex = PTHREAD_MUTEX_INITIALIZER; +static uint32_t g_pkg_attempt_sequence; + +static void require_native_recovery(const char *reason) { + if (!g_pkg_native_recovery_required) { + log_debug(" [PKG] native installer recovery required (%s); package " + "servicing is paused until ShadowMountPlus restarts", + reason ? reason : "unsafe Sony installer state"); + } + g_pkg_native_recovery_required = true; +} + + +static pkg_entry_t *find_path_locked(const char *path) { + for (size_t i = 0; i < PKG_INSTALL_MAX; i++) { + if (g_entries[i].state != PKG_STATE_NONE && + strcmp(g_entries[i].path, path) == 0) + return &g_entries[i]; + } + return NULL; +} + +static bool same_identity(const pkg_entry_t *entry, + const scan_candidate_t *candidate) { + return entry->pkg_kind == candidate->pkg_kind && + entry->source_fingerprint == candidate->source_fingerprint && + strcmp(entry->content_id, candidate->content_id) == 0 && + strcmp(entry->app_ver, candidate->app_ver) == 0; +} + +static pkg_entry_t *find_identity_locked(const scan_candidate_t *candidate) { + for (size_t i = 0; i < PKG_INSTALL_MAX; i++) { + pkg_entry_t *entry = &g_entries[i]; + if (entry->state != PKG_STATE_NONE && same_identity(entry, candidate)) + return entry; + } + return NULL; +} + +static pkg_entry_t *reserve_entry_locked(const scan_candidate_t *candidate) { + pkg_entry_t *entry = find_identity_locked(candidate); + if (entry) + return entry; + entry = find_path_locked(candidate->path); + if (entry) + return entry; + for (size_t i = 0; i < PKG_INSTALL_MAX; i++) { + if (g_entries[i].state == PKG_STATE_NONE) + return &g_entries[i]; + } + for (size_t i = 0; i < PKG_INSTALL_MAX; i++) { + if (g_entries[i].state == PKG_STATE_DONE || + g_entries[i].state == PKG_STATE_FAILED) + return &g_entries[i]; + } + return NULL; +} + +static bool same_source(const pkg_entry_t *entry, + const scan_candidate_t *candidate) { + return entry->source_size == candidate->source_size && + entry->source_device == candidate->source_device && + entry->source_inode == candidate->source_inode && + entry->source_ctime == candidate->source_ctime && + entry->source_fingerprint == candidate->source_fingerprint && + entry->source_mtime == candidate->source_mtime && + strcmp(entry->title_id, candidate->title_id) == 0 && + strcmp(entry->content_id, candidate->content_id) == 0 && + strcmp(entry->category, candidate->category) == 0 && + strcmp(entry->app_ver, candidate->app_ver) == 0 && + entry->pkg_kind == candidate->pkg_kind; +} + +static bool source_still_matches(const pkg_entry_t *entry) { + struct stat st; + scan_candidate_t candidate; + if (stat(entry->path, &st) != 0 || + !sm_pkg_parse_file(entry->path, &st, &candidate)) + return false; + return same_source(entry, &candidate); +} + +bool sm_pkg_install_queue_candidate(const scan_candidate_t *candidate) { + if (!candidate || candidate->kind != SCAN_CANDIDATE_PKG || + candidate->path[0] == '\0' || candidate->title_id[0] == '\0' || + !runtime_config().pkg_install_enabled) + return false; + + pthread_mutex_lock(&g_pkg_mutex); + if (!sm_pkg_kind_is_installable(candidate->pkg_kind) || + !candidate->pkg_classification_confident || + sm_pkg_is_installed_content_path(candidate->path)) { + pthread_mutex_unlock(&g_pkg_mutex); + return false; + } + pkg_entry_t *entry = reserve_entry_locked(candidate); + if (!entry) { + pthread_mutex_unlock(&g_pkg_mutex); + log_debug(" [PKG] package queue full: %s", candidate->path); + return false; + } + + if (entry->state != PKG_STATE_NONE && same_identity(entry, candidate)) { + if (entry->state == PKG_STATE_FAILED && + entry->failed_attempts < PKG_INSTALL_MAX_FAILED_ATTEMPTS) { + entry->state = PKG_STATE_QUEUED; + entry->next_attempt_us = 1; + } + pthread_mutex_unlock(&g_pkg_mutex); + return true; + } + + // Do not replace a package while the native installer may still be reading it. + if (entry->state == PKG_STATE_SUBMITTING || + entry->state == PKG_STATE_WAITING) { + log_debug(" [PKG] source changed while install is active: %s", + candidate->path); + pthread_mutex_unlock(&g_pkg_mutex); + return true; + } + + memset(entry, 0, sizeof(*entry)); + (void)strlcpy(entry->path, candidate->path, sizeof(entry->path)); + (void)strlcpy(entry->title_id, candidate->title_id, sizeof(entry->title_id)); + (void)strlcpy(entry->title_name, candidate->title_name, + sizeof(entry->title_name)); + (void)strlcpy(entry->content_id, candidate->content_id, + sizeof(entry->content_id)); + (void)strlcpy(entry->category, candidate->category, sizeof(entry->category)); + (void)strlcpy(entry->app_ver, candidate->app_ver, sizeof(entry->app_ver)); + entry->source_size = candidate->source_size; + entry->source_device = candidate->source_device; + entry->source_inode = candidate->source_inode; + entry->source_ctime = candidate->source_ctime; + entry->source_fingerprint = candidate->source_fingerprint; + entry->source_mtime = candidate->source_mtime; + entry->pkg_kind = candidate->pkg_kind; + entry->state = PKG_STATE_QUEUED; + entry->next_attempt_us = 1; + pthread_mutex_unlock(&g_pkg_mutex); + return true; +} + +static bool is_base_package(const pkg_entry_t *entry) { + return entry->pkg_kind == PKG_KIND_BASE; +} + +static bool is_patch_package(const pkg_entry_t *entry) { + return entry->pkg_kind == PKG_KIND_PATCH; +} + +static bool is_dlc_package(const pkg_entry_t *entry) { + return entry->pkg_kind == PKG_KIND_DLC; +} + +#define compare_version_strings sm_pkg_compare_versions + +static bool package_matches_app_db(const pkg_entry_t *entry) { + sm_app_db_game_info_t *games = NULL; + size_t count = 0; + if (!app_db_game_info_snapshot(&games, &count)) + return false; + + const sm_app_db_game_info_t *game = + app_db_find_game_info(games, count, entry->title_id); + bool matches = false; + if (game) { + if (is_patch_package(entry) && entry->app_ver[0] != '\0' && + game->version[0] != '\0') { + matches = compare_version_strings(game->version, entry->app_ver) >= 0; + } else if (is_base_package(entry) && entry->content_id[0] != '\0' && + game->content_id[0] != '\0') { + matches = strcmp(game->content_id, entry->content_id) == 0; + } + } + free(games); + return matches; +} + +static bool installed_base_artifact_present(const char *title_id) { + static const char *const roots[] = { + "/user/app", "/mnt/ext0/user/app", "/mnt/ext0/ps5/user/app", + "/mnt/ext1/user/app", "/mnt/ext1/ps5/user/app"}; + char path[MAX_PATH]; + for (size_t i = 0; i < sizeof(roots) / sizeof(roots[0]); i++) { + int written = snprintf(path, sizeof(path), "%s/%s/app.pkg", roots[i], + title_id); + struct stat st; + if (written > 0 && (size_t)written < sizeof(path) && + stat(path, &st) == 0 && S_ISREG(st.st_mode) && st.st_size > 0) + return true; + } + return false; +} + +static bool installed_base_content_matches(const pkg_entry_t *entry) { + static const char *const roots[] = { + "/user/app", "/mnt/ext0/user/app", "/mnt/ext0/ps5/user/app", + "/mnt/ext1/user/app", "/mnt/ext1/ps5/user/app"}; + char path[MAX_PATH]; + for (size_t i = 0; i < sizeof(roots) / sizeof(roots[0]); i++) { + int written = snprintf(path, sizeof(path), "%s/%s/app.pkg", roots[i], + entry->title_id); + if (written <= 0 || (size_t)written >= sizeof(path)) + continue; + struct stat st; + scan_candidate_t installed; + if (stat(path, &st) == 0 && S_ISREG(st.st_mode) && + sm_pkg_parse_file(path, &st, &installed) && + installed.pkg_kind == PKG_KIND_BASE && + (entry->content_id[0] == '\0' || + strcmp(installed.content_id, entry->content_id) == 0)) + return true; + } + return false; +} + +static bool installed_patch_version_matches(const pkg_entry_t *entry) { + if (!is_patch_package(entry)) + return false; + char patch_path[MAX_PATH]; + static const char *const roots[] = { + "/user/patch", "/mnt/ext0/user/patch", "/mnt/ext0/ps5/user/patch", + "/mnt/ext1/user/patch", "/mnt/ext1/ps5/user/patch"}; + bool patch_present = false; + for (size_t i = 0; i < sizeof(roots) / sizeof(roots[0]); i++) { + int written = snprintf(patch_path, sizeof(patch_path), "%s/%s/patch.pkg", + roots[i], entry->title_id); + if (written <= 0 || (size_t)written >= sizeof(patch_path)) + continue; + struct stat st; + scan_candidate_t installed; + if (stat(patch_path, &st) == 0 && S_ISREG(st.st_mode) && + sm_pkg_parse_file(patch_path, &st, &installed) && + installed.pkg_kind == PKG_KIND_PATCH && + (entry->content_id[0] == '\0' || + strcmp(installed.content_id, entry->content_id) == 0)) { + patch_present = true; + break; + } + } + if (!patch_present) + return false; + + sm_app_db_game_info_t *games = NULL; + size_t count = 0; + if (!app_db_game_info_snapshot(&games, &count)) + return false; + const sm_app_db_game_info_t *game = + app_db_find_game_info(games, count, entry->title_id); + bool matches = game && entry->app_ver[0] != '\0' && game->version[0] != '\0' && + compare_version_strings(game->version, entry->app_ver) >= 0; + free(games); + return matches; +} + +static bool package_is_already_installed(const pkg_entry_t *entry) { + invalidate_app_db_title_cache(); + if (is_base_package(entry)) + return package_matches_app_db(entry) && + installed_base_content_matches(entry); + if (is_patch_package(entry)) + return installed_patch_version_matches(entry); + return false; +} + +static bool installed_different_base_variant(const pkg_entry_t *entry) { + if (!is_base_package(entry)) + return false; + sm_app_db_game_info_t *games = NULL; + size_t count = 0; + if (!app_db_game_info_snapshot(&games, &count)) + return false; + const sm_app_db_game_info_t *game = + app_db_find_game_info(games, count, entry->title_id); + bool different = game && game->content_id[0] != '\0' && + entry->content_id[0] != '\0' && + strcmp(game->content_id, entry->content_id) != 0 && + installed_base_artifact_present(entry->title_id); + free(games); + return different; +} + +static bool installed_dlc_tree_matches(const pkg_entry_t *entry, + const char *path, unsigned depth) { + if (depth > 4) + return false; + DIR *dir = opendir(path); + if (!dir) + return false; + struct dirent *item; + while ((item = readdir(dir)) != NULL) { + if (item->d_name[0] == '.' || strcmp(item->d_name, "..") == 0) + continue; + char child[MAX_PATH]; + int written = snprintf(child, sizeof(child), "%s/%s", path, item->d_name); + if (written <= 0 || (size_t)written >= sizeof(child)) + continue; + struct stat st; + if (stat(child, &st) != 0) + continue; + if (S_ISDIR(st.st_mode)) { + if (installed_dlc_tree_matches(entry, child, depth + 1u)) { + closedir(dir); + return true; + } + continue; + } + size_t length = strlen(item->d_name); + if (!S_ISREG(st.st_mode) || length < 4 || + strcasecmp(item->d_name + length - 4, ".pkg") != 0) + continue; + scan_candidate_t candidate; + if (sm_pkg_parse_file(child, &st, &candidate) && + candidate.pkg_kind == PKG_KIND_DLC && + strcmp(candidate.content_id, entry->content_id) == 0) { + closedir(dir); + return true; + } + } + closedir(dir); + return false; +} + +static bool installed_dlc_content_matches(const pkg_entry_t *entry) { + static const char *const roots[] = { + "/user/addcont", "/mnt/ext0/user/addcont", "/mnt/ext0/ps5/user/addcont", + "/mnt/ext1/user/addcont", "/mnt/ext1/ps5/user/addcont"}; + char root[MAX_PATH]; + for (size_t i = 0; i < sizeof(roots) / sizeof(roots[0]); i++) { + int written = snprintf(root, sizeof(root), "%s/%s", roots[i], entry->title_id); + if (written > 0 && (size_t)written < sizeof(root) && + installed_dlc_tree_matches(entry, root, 0)) + return true; + } + return false; +} + +static bool package_is_complete(const pkg_entry_t *entry) { + invalidate_app_db_title_cache(); + if (is_patch_package(entry)) + return installed_patch_version_matches(entry); + if (is_base_package(entry)) + return package_matches_app_db(entry) && + installed_base_content_matches(entry); + return is_dlc_package(entry) && installed_dlc_content_matches(entry); +} + +static bool installer_path_is_safe(const char *path) { + if (!path || path[0] != '/') + return false; + size_t length = strlen(path); + if (length < 5 || path[length - 1] == '/' || + strcasecmp(path + length - 4, ".pkg") != 0) + return false; + if (strstr(path, "/../") || strstr(path, "/./") || + (length >= 3 && strcmp(path + length - 3, "/..") == 0) || + (length >= 2 && strcmp(path + length - 2, "/.") == 0)) + return false; + if (strncmp(path, "/data/", 6) == 0 || strncmp(path, "/user/", 6) == 0) + return true; + const char *tail = NULL; + if (strncmp(path, "/mnt/usb", 8) == 0 || + strncmp(path, "/mnt/ext", 8) == 0) + tail = path + 8; + if (!tail || *tail < '0' || *tail > '9') + return false; + while (*tail >= '0' && *tail <= '9') + tail++; + return *tail == '/'; +} + +static void schedule_retry(pkg_entry_t *entry, uint64_t now_us, + uint32_t code, bool count_failure) { + entry->last_code = code; + if (count_failure && entry->failed_attempts < UINT32_MAX) + entry->failed_attempts++; + if (count_failure && + entry->failed_attempts >= PKG_INSTALL_MAX_FAILED_ATTEMPTS) { + entry->state = PKG_STATE_FAILED; + entry->next_attempt_us = 0; + log_debug(" [PKG] giving up after %u attempts: %s code=0x%08X", + (unsigned)entry->failed_attempts, entry->path, code); + return; + } + entry->state = PKG_STATE_QUEUED; + entry->next_attempt_us = now_us + PKG_INSTALL_RETRY_US; + log_debug(" [PKG] retrying %s code=0x%08X", entry->path, code); +} + +static void mark_permanent_failure(pkg_entry_t *entry, uint32_t code) { + entry->state = PKG_STATE_FAILED; + entry->failed_attempts = PKG_INSTALL_MAX_FAILED_ATTEMPTS; + entry->last_code = code; + entry->next_attempt_us = 0; +} + +static int package_kind_priority(pkg_kind_t kind) { + if (kind == PKG_KIND_BASE) + return 0; + if (kind == PKG_KIND_PATCH) + return 1; + if (kind == PKG_KIND_DLC) + return 2; + return 3; +} + +static int compare_package_selection(const pkg_entry_t *left, + const pkg_entry_t *right) { + int left_priority = package_kind_priority(left->pkg_kind); + int right_priority = package_kind_priority(right->pkg_kind); + if (left_priority != right_priority) + return left_priority < right_priority ? -1 : 1; + int comparison = strcmp(left->title_id, right->title_id); + if (comparison != 0) + return comparison; + comparison = strcmp(left->content_id, right->content_id); + if (comparison != 0) + return comparison; + if (left->pkg_kind == PKG_KIND_PATCH && right->pkg_kind == PKG_KIND_PATCH) { + comparison = sm_pkg_compare_versions(left->app_ver, right->app_ver); + if (comparison != 0) + return comparison; + } + comparison = strcmp(left->app_ver, right->app_ver); + if (comparison != 0) + return comparison; + if (left->source_fingerprint < right->source_fingerprint) + return -1; + if (left->source_fingerprint > right->source_fingerprint) + return 1; + return strcmp(left->path, right->path); +} + +static void complete_entry(pkg_entry_t *entry) { + log_debug(" [PKG] installed: %s (%s)", entry->title_name, + entry->title_id); + entry->state = PKG_STATE_DONE; + if (entry->server) { + sm_pkg_server_stop(entry->server); + entry->server = NULL; + } + entry->attempt[0] = '\0'; + entry->uri[0] = '\0'; + entry->next_attempt_us = 0; +} + +static bool base_preflight_ready(const pkg_entry_t *entry) { + if (is_base_package(entry)) + return true; + invalidate_app_db_title_cache(); + sm_app_db_game_info_t *games = NULL; + size_t count = 0; + if (!app_db_game_info_snapshot(&games, &count)) + return true; + const sm_app_db_game_info_t *game = + app_db_find_game_info(games, count, entry->title_id); + bool ready = game != NULL && + installed_base_artifact_present(entry->title_id); + free(games); + return ready; +} + +static bool native_url_encode(const char *input, char *output, + size_t output_size) { + static const char hex[] = "0123456789ABCDEF"; + size_t used = 0; + for (const unsigned char *cursor = (const unsigned char *)input; *cursor; + cursor++) { + bool unreserved = (*cursor >= 'A' && *cursor <= 'Z') || + (*cursor >= 'a' && *cursor <= 'z') || + (*cursor >= '0' && *cursor <= '9') || *cursor == '-' || + *cursor == '_' || *cursor == '.' || *cursor == '~'; + size_t required = unreserved ? 1u : 3u; + if (used + required >= output_size) + return false; + if (unreserved) { + output[used++] = (char)*cursor; + } else { + output[used++] = '%'; + output[used++] = hex[*cursor >> 4]; + output[used++] = hex[*cursor & 0x0f]; + } + } + output[used] = '\0'; + return true; +} + +static bool native_url_for_entry(pkg_entry_t *entry) { + uint16_t port = 0; + char encoded_basename[MAX_PATH * 3]; + if (sm_pkg_server_start(&entry->server, entry->path, entry->attempt, + &port) != 0) + return false; + const char *slash = strrchr(entry->path, '/'); + const char *basename = slash ? slash + 1 : entry->path; + if (!native_url_encode(basename, encoded_basename, + sizeof(encoded_basename))) { + sm_pkg_server_stop(entry->server); + entry->server = NULL; + return false; + } + int written = snprintf(entry->uri, sizeof(entry->uri), + "http://127.0.0.1:%u/%s/%s", (unsigned)port, + entry->attempt, encoded_basename); + if (written <= 0 || (size_t)written >= sizeof(entry->uri)) { + sm_pkg_server_stop(entry->server); + entry->server = NULL; + entry->uri[0] = '\0'; + return false; + } + return true; +} + +static void reap_finished_submit_thread(void) { + pthread_t thread; + bool join = false; + pthread_mutex_lock(&g_pkg_mutex); + if (g_pkg_submit_thread_started && g_pkg_submit_thread_done) { + thread = g_pkg_submit_thread; + g_pkg_submit_thread_started = false; + join = true; + } + pthread_mutex_unlock(&g_pkg_mutex); + if (join) + (void)pthread_join(thread, NULL); +} + +static void *native_submit_worker(void *opaque) { + pkg_entry_t *entry = opaque; + char uri[PKG_INSTALL_URI_MAX]; + char title_name[MAX_TITLE_NAME]; + sm_pkg_server_t *server_to_stop = NULL; + uint64_t now_us = monotonic_time_us(); + bool mutation_claimed = false; + int result = EBUSY; + + pthread_mutex_lock(&g_pkg_mutex); + if (entry->state == PKG_STATE_SUBMITTING && !g_pkg_shutdown_requested) { + (void)strlcpy(uri, entry->uri, sizeof(uri)); + (void)strlcpy(title_name, entry->title_name, sizeof(title_name)); + } else { + g_pkg_submit_thread_done = true; + pthread_mutex_unlock(&g_pkg_mutex); + return NULL; + } + pthread_mutex_unlock(&g_pkg_mutex); + + if (!runtime_sleep_mode_active() && !sm_game_lifecycle_has_active_game() && + !sm_shellcore_service_has_prepared_mount() && + sm_shellcore_try_begin_external_mutation()) { + mutation_claimed = true; + pthread_mutex_lock(&g_pkg_mutex); + bool cancelled = g_pkg_shutdown_requested || + entry->state != PKG_STATE_SUBMITTING; + pthread_mutex_unlock(&g_pkg_mutex); + if (!cancelled && source_still_matches(entry)) + result = sm_appinst_install_by_package(uri, title_name); + } + if (mutation_claimed) + sm_shellcore_end_external_mutation(); + + pthread_mutex_lock(&g_pkg_mutex); + if (entry->state == PKG_STATE_SUBMITTING) { + entry->last_code = (uint32_t)result; + if (result == 0) { + entry->state = PKG_STATE_WAITING; + entry->failed_attempts = 0; + entry->next_attempt_us = now_us + PKG_INSTALL_POLL_US; + log_debug(" [PKG] native InstallByPackage accepted: %s", entry->path); + } else if (g_pkg_shutdown_requested) { + server_to_stop = entry->server; + entry->server = NULL; + entry->state = PKG_STATE_FAILED; + entry->next_attempt_us = 0; + } else if (!source_still_matches(entry)) { + server_to_stop = entry->server; + entry->server = NULL; + mark_permanent_failure(entry, ESTALE); + log_debug(" [PKG] source changed before native submission: %s", + entry->path); + } else { + server_to_stop = entry->server; + entry->server = NULL; + entry->uri[0] = '\0'; + entry->attempt[0] = '\0'; + schedule_retry(entry, monotonic_time_us(), (uint32_t)result, true); + log_debug(" [PKG] native InstallByPackage refused: %s code=0x%08X", + entry->path, (uint32_t)result); + } + } + g_pkg_submit_thread_done = true; + bool shutting_down = g_pkg_shutdown_requested; + pthread_mutex_unlock(&g_pkg_mutex); + + if (server_to_stop) + sm_pkg_server_stop(server_to_stop); + if (!shutting_down) + sm_scanner_wake(); + return NULL; +} + +static void service_entry(pkg_entry_t *entry, uint64_t now_us) { + if (entry->state == PKG_STATE_QUEUED) { + if (entry->next_attempt_us > now_us) + return; + if (!installer_path_is_safe(entry->path) || + sm_pkg_is_installed_content_path(entry->path)) { + mark_permanent_failure(entry, EINVAL); + log_debug(" [PKG] native installer rejected path policy: %s", entry->path); + return; + } + if (!source_still_matches(entry)) { + mark_permanent_failure(entry, ESTALE); + log_debug(" [PKG] source changed before install: %s", entry->path); + return; + } + if (!base_preflight_ready(entry)) { + entry->next_attempt_us = now_us + PKG_INSTALL_RETRY_US; + log_debug(" [PKG] waiting for base title in app.db or /user/app: %s", + entry->path); + return; + } + if (package_is_already_installed(entry)) { + log_debug(" [PKG] already installed: %s", entry->path); + complete_entry(entry); + return; + } + if (installed_different_base_variant(entry)) { + mark_permanent_failure(entry, EEXIST); + log_debug(" [PKG] refusing different base variant over installed title: %s", + entry->path); + return; + } + if (entry->server || entry->uri[0] != '\0') { + require_native_recovery("stale native package state before submission"); + mark_permanent_failure(entry, EBUSY); + return; + } + + int written = snprintf(entry->attempt, sizeof(entry->attempt), + "sm-%u", ++g_pkg_attempt_sequence); + if (written <= 0 || (size_t)written >= sizeof(entry->attempt) || + !native_url_for_entry(entry)) { + schedule_retry(entry, now_us, EIO, true); + return; + } + entry->state = PKG_STATE_SUBMITTING; + entry->requested_at_us = now_us; + entry->last_bytes_served = 0; + entry->last_bytes_progress_us = now_us; + entry->next_attempt_us = now_us + PKG_INSTALL_POLL_US; + g_pkg_submit_thread_done = false; + if (pthread_create(&g_pkg_submit_thread, NULL, native_submit_worker, + entry) != 0) { + sm_pkg_server_t *server = entry->server; + entry->server = NULL; + entry->uri[0] = '\0'; + entry->attempt[0] = '\0'; + entry->state = PKG_STATE_QUEUED; + entry->last_code = EAGAIN; + entry->next_attempt_us = now_us + PKG_INSTALL_RETRY_US; + entry->failed_attempts++; + if (entry->failed_attempts >= PKG_INSTALL_MAX_FAILED_ATTEMPTS) + entry->state = PKG_STATE_FAILED; + if (server) + sm_pkg_server_stop(server); + } else { + g_pkg_submit_thread_started = true; + } + return; + } + + if (entry->state != PKG_STATE_WAITING || entry->next_attempt_us > now_us) + return; + if (!source_still_matches(entry)) { + require_native_recovery("package source changed during native install"); + mark_permanent_failure(entry, ESTALE); + return; + } + + uint64_t bytes_served = entry->server + ? sm_pkg_server_bytes_served(entry->server) + : 0; + uint64_t total = entry->server ? sm_pkg_server_total(entry->server) : 0; + if (bytes_served > entry->last_bytes_served) { + entry->last_bytes_served = bytes_served; + entry->last_bytes_progress_us = now_us; + } + if (entry->requested_at_us != 0 && now_us > entry->requested_at_us && + now_us - entry->requested_at_us > PKG_INSTALL_TIMEOUT_US) { + require_native_recovery("native package install timed out"); + mark_permanent_failure(entry, ETIMEDOUT); + return; + } + if (total > 0 && bytes_served < total && entry->server && + now_us > entry->last_bytes_progress_us && + now_us - entry->last_bytes_progress_us > PKG_INSTALL_TIMEOUT_US) { + require_native_recovery("native package delivery stalled"); + mark_permanent_failure(entry, ETIMEDOUT); + return; + } + if (entry->server && sm_pkg_server_complete(entry->server)) { + uint64_t last_request = sm_pkg_server_last_request_us(entry->server); + if (last_request != 0 && now_us > last_request && + now_us - last_request >= PKG_INSTALL_IDLE_GRACE_US) { + sm_pkg_server_stop(entry->server); + entry->server = NULL; + } + } + // Full delivery is not installation completion. Require the server to be + // retired before accepting category-specific artifact verification. + if (!entry->server && package_is_complete(entry)) { + complete_entry(entry); + return; + } + entry->next_attempt_us = now_us + PKG_INSTALL_POLL_US; +} + +static void prune_missing_entries_locked(void) { + for (size_t i = 0; i < PKG_INSTALL_MAX; i++) { + if (g_entries[i].state == PKG_STATE_NONE || + g_entries[i].state == PKG_STATE_SUBMITTING || + g_entries[i].state == PKG_STATE_WAITING) + continue; + struct stat st; + if (stat(g_entries[i].path, &st) != 0 && errno == ENOENT) + memset(&g_entries[i], 0, sizeof(g_entries[i])); + } +} + +void sm_pkg_install_service(void) { + if (runtime_sleep_mode_active() || !runtime_config().pkg_install_enabled) + return; + + reap_finished_submit_thread(); + uint64_t now_us = monotonic_time_us(); + pthread_mutex_lock(&g_pkg_mutex); + prune_missing_entries_locked(); + + pkg_entry_t *selected = NULL; + pkg_entry_t *waiting = NULL; + bool blocked = sm_game_lifecycle_has_active_game() || + sm_shellcore_service_has_prepared_mount(); + for (size_t i = 0; i < PKG_INSTALL_MAX; i++) { + pkg_entry_t *entry = &g_entries[i]; + if (entry->state == PKG_STATE_WAITING) { + waiting = entry; + break; + } + } + if (waiting) { + if (waiting->next_attempt_us <= now_us) + selected = waiting; + } else if (!g_pkg_submit_thread_started) { + for (size_t i = 0; i < PKG_INSTALL_MAX; i++) { + pkg_entry_t *entry = &g_entries[i]; + if (entry->state != PKG_STATE_QUEUED || + entry->next_attempt_us > now_us) + continue; + if (!selected || compare_package_selection(entry, selected) < 0) + selected = entry; + } + } + + if (g_pkg_native_recovery_required) { + pthread_mutex_unlock(&g_pkg_mutex); + return; + } + + if (selected && blocked) { + selected->next_attempt_us = now_us + PKG_INSTALL_BLOCKED_RETRY_US; + } else if (selected) { + service_entry(selected, now_us); + } + pthread_mutex_unlock(&g_pkg_mutex); +} + +uint64_t sm_pkg_install_next_wake_us(uint64_t now_us) { + if (!runtime_config().pkg_install_enabled) + return 0; + + uint64_t next = 0; + pthread_mutex_lock(&g_pkg_mutex); + if (g_pkg_native_recovery_required) { + pthread_mutex_unlock(&g_pkg_mutex); + return 0; + } + for (size_t i = 0; i < PKG_INSTALL_MAX; i++) { + const pkg_entry_t *entry = &g_entries[i]; + if (entry->state != PKG_STATE_QUEUED && + entry->state != PKG_STATE_WAITING) + continue; + uint64_t deadline = entry->next_attempt_us; + if (deadline == 0) + deadline = now_us == 0 ? 1 : now_us; + if (next == 0 || deadline < next) + next = deadline; + } + pthread_mutex_unlock(&g_pkg_mutex); + return next; +} + +bool sm_pkg_install_has_pending_work(void) { + bool pending = false; + pthread_mutex_lock(&g_pkg_mutex); + for (size_t i = 0; i < PKG_INSTALL_MAX; i++) { + if (g_entries[i].state == PKG_STATE_QUEUED || + g_entries[i].state == PKG_STATE_SUBMITTING || + g_entries[i].state == PKG_STATE_WAITING) { + pending = true; + break; + } + } + pthread_mutex_unlock(&g_pkg_mutex); + return pending; +} + +void sm_pkg_install_forget_path(const char *path) { + if (!path) + return; + pthread_mutex_lock(&g_pkg_mutex); + pkg_entry_t *entry = find_path_locked(path); + if (entry && entry->state != PKG_STATE_SUBMITTING && + entry->state != PKG_STATE_WAITING) { + memset(entry, 0, sizeof(*entry)); + } + pthread_mutex_unlock(&g_pkg_mutex); +} + +void sm_pkg_install_shutdown(void) { + pthread_t submit_thread; + bool join_submit = false; + sm_pkg_server_t *servers[PKG_INSTALL_MAX]; + size_t server_count = 0; + + pthread_mutex_lock(&g_pkg_mutex); + g_pkg_shutdown_requested = true; + if (g_pkg_submit_thread_started) { + submit_thread = g_pkg_submit_thread; + join_submit = true; + } + pthread_mutex_unlock(&g_pkg_mutex); + + // Do not close the source server while InstallByPackage may still be + // reading it. The synchronous Sony call owns that decision until it returns. + if (join_submit) + (void)pthread_join(submit_thread, NULL); + + pthread_mutex_lock(&g_pkg_mutex); + g_pkg_submit_thread_started = false; + g_pkg_submit_thread_done = false; + for (size_t i = 0; i < PKG_INSTALL_MAX; i++) { + if (g_entries[i].server && server_count < PKG_INSTALL_MAX) { + servers[server_count++] = g_entries[i].server; + g_entries[i].server = NULL; + } + g_entries[i].uri[0] = '\0'; + g_entries[i].attempt[0] = '\0'; + } + pthread_mutex_unlock(&g_pkg_mutex); + + for (size_t i = 0; i < server_count; i++) + sm_pkg_server_stop(servers[i]); +} diff --git a/src/sm_pkg_server.c b/src/sm_pkg_server.c new file mode 100644 index 0000000..154a010 --- /dev/null +++ b/src/sm_pkg_server.c @@ -0,0 +1,650 @@ +#define _GNU_SOURCE +#include "sm_platform.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "sm_pkg_server.h" +#include "sm_limits.h" +#include "sm_time.h" + +#define SM_PKG_SERVER_MAX_CONNECTIONS 16 +#define SM_PKG_SERVER_REQUEST_MAX 8192 +#define SM_PKG_SERVER_SEND_CHUNK (1024u * 1024u) +#define SM_PKG_SERVER_IO_TIMEOUT_SECONDS 60 +#define SM_PKG_SERVER_COVERAGE_MAX 256 + +struct sm_pkg_server { + pthread_mutex_t mutex; + volatile int running; + int listen_fd; + int pkg_fd; + int connections[SM_PKG_SERVER_MAX_CONNECTIONS]; + int worker_count; + pthread_t listener; + char directory[MAX_PATH]; + char attempt[64]; + char basename[MAX_PATH]; + uint16_t port; + uint64_t total; + uint64_t last_request_us; + struct { + uint64_t start; + uint64_t end; + } intervals[SM_PKG_SERVER_COVERAGE_MAX]; + size_t interval_count; +}; + +typedef struct { + sm_pkg_server_t *server; + int fd; +} sm_pkg_server_worker_arg_t; + +typedef struct { + bool get; + bool head; + bool keep_alive; + char target[MAX_PATH]; + char range[128]; + bool has_range; +} sm_pkg_http_request_t; + +static bool send_all(int fd, const void *buffer, size_t size) { + const char *data = buffer; + while (size > 0) { + ssize_t sent = send(fd, data, size, 0); + if (sent < 0 && errno == EINTR) + continue; + if (sent <= 0) + return false; + data += sent; + size -= (size_t)sent; + } + return true; +} + +static int hex_digit(char value) { + if (value >= '0' && value <= '9') + return value - '0'; + if (value >= 'a' && value <= 'f') + return value - 'a' + 10; + if (value >= 'A' && value <= 'F') + return value - 'A' + 10; + return -1; +} + +static bool decode_path(const char *encoded, char *decoded, size_t size) { + size_t used = 0; + for (size_t i = 0; encoded[i] != '\0'; i++) { + unsigned char value = (unsigned char)encoded[i]; + if (value == '%') { + if (encoded[i + 1] == '\0' || encoded[i + 2] == '\0') + return false; + int high = hex_digit(encoded[i + 1]); + int low = hex_digit(encoded[i + 2]); + if (high < 0 || low < 0) + return false; + value = (unsigned char)((high << 4) | low); + i += 2; + } + if (value == '\0' || used + 1 >= size) + return false; + decoded[used++] = (char)value; + } + decoded[used] = '\0'; + return true; +} + +static bool contains_ci(const char *value, const char *needle) { + size_t needle_size = strlen(needle); + if (needle_size == 0) + return true; + for (const char *cursor = value; cursor && *cursor; cursor++) { + if (strncasecmp(cursor, needle, needle_size) == 0) + return true; + } + return false; +} + +static bool header_value(const char *request, const char *name, char *value, + size_t value_size) { + size_t name_size = strlen(name); + const char *line = request; + value[0] = '\0'; + while (line && *line) { + const char *end = strstr(line, "\r\n"); + size_t length = end ? (size_t)(end - line) : strlen(line); + if (length > name_size && strncasecmp(line, name, name_size) == 0 && + line[name_size] == ':') { + const char *start = line + name_size + 1; + const char *limit = line + length; + while (start < limit && (*start == ' ' || *start == '\t')) + start++; + while (limit > start && (limit[-1] == ' ' || limit[-1] == '\t')) + limit--; + size_t copy = (size_t)(limit - start); + if (copy >= value_size) + copy = value_size - 1; + memcpy(value, start, copy); + value[copy] = '\0'; + return true; + } + if (!end) + break; + line = end + 2; + } + return false; +} + +static bool parse_request(const char *request, sm_pkg_http_request_t *out) { + char method[16]; + char version[16]; + char connection[64]; + if (sscanf(request, "%15s %1023s %15s", method, out->target, version) != 3) + return false; + out->get = strcasecmp(method, "GET") == 0; + out->head = strcasecmp(method, "HEAD") == 0; + if (!out->get && !out->head) + return false; + out->keep_alive = strcasecmp(version, "HTTP/1.0") != 0; + if (header_value(request, "Connection", connection, sizeof(connection))) { + if (contains_ci(connection, "close")) + out->keep_alive = false; + else if (contains_ci(connection, "keep-alive")) + out->keep_alive = true; + } + out->has_range = header_value(request, "Range", out->range, + sizeof(out->range)); + return true; +} + +static bool parse_range(const char *value, uint64_t total, uint64_t *start, + uint64_t *end) { + const char *dash; + char *endptr; + uint64_t first; + uint64_t last; + if (total == 0 || strncasecmp(value, "bytes=", 6) != 0) + return false; + dash = strchr(value + 6, '-'); + if (!dash || strchr(dash + 1, ',') != NULL) + return false; + if (dash == value + 6) { + uint64_t suffix = strtoull(dash + 1, &endptr, 10); + if (endptr == dash + 1 || *endptr != '\0' || suffix == 0) + return false; + if (suffix > total) + suffix = total; + *start = total - suffix; + *end = total - 1; + return true; + } + first = strtoull(value + 6, &endptr, 10); + if (endptr != dash || first >= total) + return false; + if (dash[1] == '\0') { + last = total - 1; + } else { + last = strtoull(dash + 1, &endptr, 10); + if (*endptr != '\0' || last < first) + return false; + if (last >= total) + last = total - 1; + } + *start = first; + *end = last; + return true; +} + +static void add_coverage_locked(sm_pkg_server_t *server, uint64_t start, + uint64_t end) { + size_t position = 0; + if (end < start) + return; + while (position < server->interval_count && + server->intervals[position].start < start) + position++; + if (server->interval_count >= SM_PKG_SERVER_COVERAGE_MAX) + return; + for (size_t i = server->interval_count; i > position; i--) + server->intervals[i] = server->intervals[i - 1]; + server->intervals[position].start = start; + server->intervals[position].end = end; + server->interval_count++; + size_t write = 0; + for (size_t read = 1; read < server->interval_count; read++) { + if (server->intervals[read].start <= server->intervals[write].end + 1) { + if (server->intervals[read].end > server->intervals[write].end) + server->intervals[write].end = server->intervals[read].end; + } else { + server->intervals[++write] = server->intervals[read]; + } + } + server->interval_count = write + 1; +} + +static uint64_t covered_bytes_locked(const sm_pkg_server_t *server) { + uint64_t total = 0; + for (size_t i = 0; i < server->interval_count; i++) + total += server->intervals[i].end - server->intervals[i].start + 1; + return total; +} + +static bool complete_locked(const sm_pkg_server_t *server) { + return server->total == 0 || + (server->interval_count == 1 && server->intervals[0].start == 0 && + server->intervals[0].end == server->total - 1); +} + +static int header_404(char *buffer, size_t size, bool keep_alive) { + return snprintf(buffer, size, + "HTTP/1.1 404 Not Found\r\nContent-Length: 0\r\n" + "Connection: %s\r\n\r\n", + keep_alive ? "keep-alive" : "close"); +} + +static int header_416(char *buffer, size_t size, uint64_t total, + bool keep_alive) { + return snprintf(buffer, size, + "HTTP/1.1 416 Range Not Satisfiable\r\nContent-Length: 0\r\n" + "Content-Range: bytes */%llu\r\nConnection: %s\r\n\r\n", + (unsigned long long)total, + keep_alive ? "keep-alive" : "close"); +} + +static int header_200(char *buffer, size_t size, uint64_t length, + bool keep_alive) { + return snprintf(buffer, size, + "HTTP/1.1 200 OK\r\nContent-Length: %llu\r\n" + "Accept-Ranges: bytes\r\nConnection: %s\r\n\r\n", + (unsigned long long)length, + keep_alive ? "keep-alive" : "close"); +} + +static int header_206(char *buffer, size_t size, uint64_t start, uint64_t end, + uint64_t total, bool keep_alive) { + return snprintf(buffer, size, + "HTTP/1.1 206 Partial Content\r\nContent-Length: %llu\r\n" + "Content-Range: bytes %llu-%llu/%llu\r\n" + "Accept-Ranges: bytes\r\nConnection: %s\r\n\r\n", + (unsigned long long)(end - start + 1), + (unsigned long long)start, (unsigned long long)end, + (unsigned long long)total, + keep_alive ? "keep-alive" : "close"); +} + +static bool serve_file(sm_pkg_server_t *server, int fd, + const sm_pkg_http_request_t *request) { + char decoded[MAX_PATH]; + char expected[MAX_PATH + 80]; + char sidecar[MAX_PATH]; + char prefix[80]; + char header[1024]; + uint64_t start = 0; + uint64_t end; + bool ranged = false; + bool invalid_range = false; + + if (!decode_path(request->target, decoded, sizeof(decoded))) { + int size = header_404(header, sizeof(header), false); + return size > 0 && send_all(fd, header, (size_t)size) && false; + } + pthread_mutex_lock(&server->mutex); + server->last_request_us = monotonic_time_us(); + snprintf(expected, sizeof(expected), "/%s/%s", server->attempt, + server->basename); + snprintf(prefix, sizeof(prefix), "/%s/", server->attempt); + uint64_t total = server->total; + pthread_mutex_unlock(&server->mutex); + + if (strcmp(decoded, expected) != 0) { + if (strncmp(decoded, prefix, strlen(prefix)) != 0) { + int size = header_404(header, sizeof(header), request->keep_alive); + return size > 0 && send_all(fd, header, (size_t)size) && + request->keep_alive; + } + const char *name = decoded + strlen(prefix); + size_t length = strlen(name); + if (strchr(name, '/') != NULL || length <= 4 || + strcasecmp(name + length - 4, ".crc") != 0) { + int size = header_404(header, sizeof(header), request->keep_alive); + return size > 0 && send_all(fd, header, (size_t)size) && + request->keep_alive; + } + snprintf(sidecar, sizeof(sidecar), "%s/%s", server->directory, name); + struct stat st; + if (stat(sidecar, &st) != 0 || !S_ISREG(st.st_mode)) { + int size = header_404(header, sizeof(header), request->keep_alive); + return size > 0 && send_all(fd, header, (size_t)size) && + request->keep_alive; + } + int size = snprintf(header, sizeof(header), + "HTTP/1.1 200 OK\r\nContent-Length: %llu\r\n" + "Connection: close\r\n\r\n", + (unsigned long long)st.st_size); + if (size <= 0 || (size_t)size >= sizeof(header) || + !send_all(fd, header, (size_t)size)) + return false; + if (!request->head) { + int side_fd = open(sidecar, O_RDONLY); + if (side_fd < 0) + return false; + char *buffer = malloc(SM_PKG_SERVER_SEND_CHUNK); + bool ok = buffer != NULL; + while (ok) { + ssize_t count = read(side_fd, buffer, SM_PKG_SERVER_SEND_CHUNK); + if (count == 0) + break; + if (count < 0 || !send_all(fd, buffer, (size_t)count)) + ok = false; + } + free(buffer); + close(side_fd); + return false; + } + return false; + } + + if (request->has_range) { + if (parse_range(request->range, total, &start, &end)) + ranged = true; + else + invalid_range = true; + } + int header_size; + if (invalid_range) { + header_size = header_416(header, sizeof(header), total, + request->keep_alive); + } else if (ranged) { + header_size = header_206(header, sizeof(header), start, end, total, + request->keep_alive); + } else { + end = total == 0 ? 0 : total - 1; + header_size = header_200(header, sizeof(header), total, + request->keep_alive); + } + if (header_size <= 0 || (size_t)header_size >= sizeof(header) || + !send_all(fd, header, (size_t)header_size)) + return false; + if (invalid_range || request->head || total == 0) + return request->keep_alive && !invalid_range; + + char *buffer = malloc(SM_PKG_SERVER_SEND_CHUNK); + if (!buffer) + return false; + uint64_t offset = start; + bool ok = true; + while (offset <= end) { + uint64_t remaining = end - offset + 1; + size_t want = remaining > SM_PKG_SERVER_SEND_CHUNK + ? SM_PKG_SERVER_SEND_CHUNK + : (size_t)remaining; + ssize_t count = pread(server->pkg_fd, buffer, want, (off_t)offset); + if (count <= 0 || !send_all(fd, buffer, (size_t)count)) { + ok = false; + break; + } + pthread_mutex_lock(&server->mutex); + add_coverage_locked(server, offset, offset + (uint64_t)count - 1); + pthread_mutex_unlock(&server->mutex); + offset += (uint64_t)count; + } + free(buffer); + return ok && request->keep_alive; +} + +static void *worker(void *opaque) { + sm_pkg_server_worker_arg_t *argument = opaque; + sm_pkg_server_t *server = argument->server; + int fd = argument->fd; + int slot = -1; + free(argument); + pthread_mutex_lock(&server->mutex); + for (int i = 0; i < SM_PKG_SERVER_MAX_CONNECTIONS; i++) { + if (server->connections[i] < 0) { + server->connections[i] = fd; + slot = i; + break; + } + } + pthread_mutex_unlock(&server->mutex); + if (slot < 0) { + close(fd); + __sync_sub_and_fetch(&server->worker_count, 1); + return NULL; + } + struct timeval timeout = {SM_PKG_SERVER_IO_TIMEOUT_SECONDS, 0}; + (void)setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)); + (void)setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)); + + char request[SM_PKG_SERVER_REQUEST_MAX + 1]; + size_t used = 0; + while (server->running && used < SM_PKG_SERVER_REQUEST_MAX) { + ssize_t count = recv(fd, request + used, + SM_PKG_SERVER_REQUEST_MAX - used, 0); + if (count <= 0) + break; + used += (size_t)count; + request[used] = '\0'; + char *end = strstr(request, "\r\n\r\n"); + if (!end) + continue; + size_t request_size = (size_t)(end + 4 - request); + sm_pkg_http_request_t parsed; + bool keep_alive = false; + if (parse_request(request, &parsed)) + keep_alive = serve_file(server, fd, &parsed) && parsed.keep_alive; + else { + char header[256]; + int header_size = header_404(header, sizeof(header), false); + if (header_size > 0) + (void)send_all(fd, header, (size_t)header_size); + } + if (!keep_alive) + break; + memmove(request, request + request_size, used - request_size); + used -= request_size; + request[used] = '\0'; + } + + pthread_mutex_lock(&server->mutex); + if (slot >= 0) + server->connections[slot] = -1; + pthread_mutex_unlock(&server->mutex); + close(fd); + __sync_sub_and_fetch(&server->worker_count, 1); + return NULL; +} + +static void *listener(void *opaque) { + sm_pkg_server_t *server = opaque; + while (server->running) { + struct sockaddr_in address; + socklen_t address_size = sizeof(address); + int fd = accept(server->listen_fd, (struct sockaddr *)&address, + &address_size); + if (fd < 0) { + if (server->running) + continue; + break; + } + int one = 1; + (void)setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one)); + if (__sync_add_and_fetch(&server->worker_count, 1) > + SM_PKG_SERVER_MAX_CONNECTIONS) { + __sync_sub_and_fetch(&server->worker_count, 1); + close(fd); + continue; + } + sm_pkg_server_worker_arg_t *argument = malloc(sizeof(*argument)); + if (!argument) { + __sync_sub_and_fetch(&server->worker_count, 1); + close(fd); + continue; + } + argument->server = server; + argument->fd = fd; + pthread_t thread; + if (pthread_create(&thread, NULL, worker, argument) != 0) { + __sync_sub_and_fetch(&server->worker_count, 1); + free(argument); + close(fd); + continue; + } + (void)pthread_detach(thread); + } + return NULL; +} + +int sm_pkg_server_start(sm_pkg_server_t **out, const char *pkg_path, + const char *attempt, uint16_t *port_out) { + struct stat st; + struct sockaddr_in address; + socklen_t address_size = sizeof(address); + sm_pkg_server_t *server; + if (!out || !pkg_path || !attempt || !port_out || + stat(pkg_path, &st) != 0 || !S_ISREG(st.st_mode) || st.st_size <= 0) + return EINVAL; + server = calloc(1, sizeof(*server)); + if (!server) + return ENOMEM; + pthread_mutex_init(&server->mutex, NULL); + server->listen_fd = -1; + server->pkg_fd = open(pkg_path, O_RDONLY); + if (server->pkg_fd < 0) { + free(server); + return errno; + } + server->total = (uint64_t)st.st_size; + (void)strlcpy(server->attempt, attempt, sizeof(server->attempt)); + (void)strlcpy(server->basename, strrchr(pkg_path, '/') + ? strrchr(pkg_path, '/') + 1 + : pkg_path, + sizeof(server->basename)); + (void)strlcpy(server->directory, pkg_path, sizeof(server->directory)); + char *slash = strrchr(server->directory, '/'); + if (slash) + *slash = '\0'; + else + (void)strlcpy(server->directory, ".", sizeof(server->directory)); + for (int i = 0; i < SM_PKG_SERVER_MAX_CONNECTIONS; i++) + server->connections[i] = -1; + server->listen_fd = socket(AF_INET, SOCK_STREAM, 0); + if (server->listen_fd < 0) { + int error = errno; + close(server->pkg_fd); + pthread_mutex_destroy(&server->mutex); + free(server); + return error; + } + int one = 1; + (void)setsockopt(server->listen_fd, SOL_SOCKET, SO_REUSEADDR, &one, + sizeof(one)); + memset(&address, 0, sizeof(address)); + address.sin_family = AF_INET; + address.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + address.sin_port = 0; + if (bind(server->listen_fd, (struct sockaddr *)&address, sizeof(address)) != 0 || + listen(server->listen_fd, SM_PKG_SERVER_MAX_CONNECTIONS) != 0 || + getsockname(server->listen_fd, (struct sockaddr *)&address, + &address_size) != 0) { + int error = errno; + close(server->listen_fd); + close(server->pkg_fd); + pthread_mutex_destroy(&server->mutex); + free(server); + return error; + } + server->port = ntohs(address.sin_port); + server->running = true; + server->last_request_us = monotonic_time_us(); + int thread_result = pthread_create(&server->listener, NULL, listener, server); + if (thread_result != 0) { + close(server->listen_fd); + close(server->pkg_fd); + pthread_mutex_destroy(&server->mutex); + free(server); + return thread_result; + } + *out = server; + *port_out = server->port; + return 0; +} + +uint64_t sm_pkg_server_bytes_served(sm_pkg_server_t *server) { + if (!server) + return 0; + pthread_mutex_lock(&server->mutex); + uint64_t result = covered_bytes_locked(server); + pthread_mutex_unlock(&server->mutex); + return result; +} + +uint64_t sm_pkg_server_total(sm_pkg_server_t *server) { + if (!server) + return 0; + pthread_mutex_lock(&server->mutex); + uint64_t result = server->total; + pthread_mutex_unlock(&server->mutex); + return result; +} + +bool sm_pkg_server_complete(sm_pkg_server_t *server) { + if (!server) + return false; + pthread_mutex_lock(&server->mutex); + bool result = complete_locked(server); + pthread_mutex_unlock(&server->mutex); + return result; +} + +uint64_t sm_pkg_server_last_request_us(sm_pkg_server_t *server) { + if (!server) + return 0; + pthread_mutex_lock(&server->mutex); + uint64_t result = server->last_request_us; + pthread_mutex_unlock(&server->mutex); + return result; +} + +void sm_pkg_server_stop(sm_pkg_server_t *server) { + int listen_fd; + int connections[SM_PKG_SERVER_MAX_CONNECTIONS]; + if (!server) + return; + + pthread_mutex_lock(&server->mutex); + server->running = 0; + listen_fd = server->listen_fd; + server->listen_fd = -1; + pthread_mutex_unlock(&server->mutex); + + if (listen_fd >= 0) { + (void)shutdown(listen_fd, SHUT_RDWR); + close(listen_fd); + } + // Join the listener before taking the connection snapshot. This prevents + // a just-accepted worker from escaping the shutdown socket sweep. + (void)pthread_join(server->listener, NULL); + + pthread_mutex_lock(&server->mutex); + for (int i = 0; i < SM_PKG_SERVER_MAX_CONNECTIONS; i++) { + connections[i] = server->connections[i]; + server->connections[i] = -1; + } + pthread_mutex_unlock(&server->mutex); + for (int i = 0; i < SM_PKG_SERVER_MAX_CONNECTIONS; i++) { + if (connections[i] >= 0) + (void)shutdown(connections[i], SHUT_RDWR); + } + while (__sync_val_compare_and_swap(&server->worker_count, 0, 0) != 0) + usleep(1000); + close(server->pkg_fd); + pthread_mutex_destroy(&server->mutex); + free(server); +} diff --git a/src/sm_scan.c b/src/sm_scan.c index 9b99b24..8cc7c17 100644 --- a/src/sm_scan.c +++ b/src/sm_scan.c @@ -11,9 +11,11 @@ #include "sm_mount_device.h" #include "sm_filesystem.h" #include "sm_appdb.h" +#include "sm_appinst.h" #include "sm_paths.h" #include "sm_path_state.h" #include "sm_path_utils.h" +#include "sm_pkg.h" #include "sm_stability.h" #include "sm_title_state.h" #include "sm_image_cache.h" @@ -125,7 +127,7 @@ static bool request_blocked_ppsa_uninstall(const char *title_id, return false; remember_blocked_ppsa_uninstall(title_id); - int res = sceAppInstUtilAppUnInstall(title_id); + int res = sm_appinst_uninstall(title_id); if (res == 0) { sm_install_forget_pending_title(title_id); invalidate_app_db_title_cache(); @@ -410,6 +412,12 @@ static bool enqueue_directory_candidate( sizeof(candidates[*candidate_count].title_id)); (void)strlcpy(candidates[*candidate_count].title_name, info->title_name, sizeof(candidates[*candidate_count].title_name)); + candidates[*candidate_count].content_id[0] = '\0'; + candidates[*candidate_count].category[0] = '\0'; + candidates[*candidate_count].app_ver[0] = '\0'; + candidates[*candidate_count].source_size = 0; + candidates[*candidate_count].source_mtime = 0; + candidates[*candidate_count].kind = SCAN_CANDIDATE_DIRECTORY; candidates[*candidate_count].manual_source_path[0] = '\0'; candidates[*candidate_count].installed = installed; candidates[*candidate_count].in_app_db = in_app_db; @@ -548,6 +556,54 @@ static sm_scan_tree_dir_visit_t collect_candidate_directory_visit( return SM_SCAN_TREE_DIR_DESCEND; } +static bool collect_candidate_pkg_visit(const char *pkg_path, + const char *pkg_name, + unsigned int depth_from_root, + void *ctx_ptr) { + (void)pkg_name; + (void)depth_from_root; + collect_candidates_walk_ctx_t *ctx = (collect_candidates_walk_ctx_t *)ctx_ptr; + if (!runtime_config().pkg_install_enabled || + defer_full_candidate_batch(*ctx->candidate_count, ctx->max_candidates, + ctx->unstable_found_out)) + return true; + + struct stat pkg_st; + if (sm_pkg_is_installed_content_path(pkg_path) || + stat(pkg_path, &pkg_st) != 0 || + !wait_for_stability_fast(pkg_path, "PKG")) { + if (ctx->unstable_found_out) + *ctx->unstable_found_out = true; + return true; + } + + scan_candidate_t candidate; + if (!sm_pkg_parse_file(pkg_path, &pkg_st, &candidate)) { + log_debug(" [PKG] invalid or unsupported package: %s", pkg_path); + return true; + } + for (int i = 0; i < *ctx->candidate_count; i++) { + if (ctx->candidates[i].kind == SCAN_CANDIDATE_PKG && + strcmp(ctx->candidates[i].path, pkg_path) == 0) + return true; + } + candidate.manual_source_path[0] = '\0'; + candidate.manual = false; + candidate.installed = is_installed(candidate.title_id); + candidate.in_app_db = app_db_title_list_contains(ctx->app_db->titles, + candidate.title_id); + if (ctx->manual_source_path) { + candidate.manual = true; + (void)strlcpy(candidate.manual_source_path, ctx->manual_source_path, + sizeof(candidate.manual_source_path)); + } + ctx->candidates[*ctx->candidate_count] = candidate; + (*ctx->candidate_count)++; + log_debug(" [PKG] discovered: %s (%s %s)", candidate.title_name, + candidate.title_id, candidate.category); + return true; +} + static bool collect_candidate_image_visit(const char *image_path, const char *image_name, unsigned int depth_from_root, @@ -644,6 +700,7 @@ static void collect_scan_candidates_from_manual_root( .on_directory = collect_candidate_directory_visit, .on_image_file = pfsc_container_root ? collect_candidate_image_visit : NULL, + .on_pkg_file = collect_candidate_pkg_visit, }; if (!sm_scan_tree_walk(scan_path, scan_path, 0u, scan_depth, &callbacks, &ctx) && unstable_found_out) @@ -671,6 +728,34 @@ static void collect_scan_candidates_from_manual_path( clear_manual_missing_source(manual_path); const char *name = get_filename_component(manual_path); + if (S_ISREG(st.st_mode) && runtime_config().pkg_install_enabled && + sm_pkg_path_is_candidate(manual_path, name)) { + scan_candidate_t candidate; + if (!sm_pkg_is_installed_content_path(manual_path) && + wait_for_stability_fast(manual_path, "PKG") && + sm_pkg_parse_file(manual_path, &st, &candidate)) { + candidate.manual = true; + candidate.installed = is_installed(candidate.title_id); + candidate.in_app_db = app_db_title_list_contains(app_db->titles, + candidate.title_id); + (void)strlcpy(candidate.manual_source_path, manual_path, + sizeof(candidate.manual_source_path)); + bool duplicate = false; + for (int i = 0; i < *candidate_count; i++) { + if (candidates[i].kind == SCAN_CANDIDATE_PKG && + strcmp(candidates[i].path, manual_path) == 0) { + duplicate = true; + break; + } + } + if (!duplicate) + candidates[(*candidate_count)++] = candidate; + } else { + log_debug(" [MANUAL] invalid or unstable package: %s", manual_path); + } + return; + } + if (S_ISREG(st.st_mode) && is_supported_image_file_path(manual_path, name)) { bool index_ready = sm_image_index_visit_ready_titles( @@ -1129,6 +1214,7 @@ static void collect_scan_candidates_from_root( sm_scan_tree_callbacks_t callbacks = { .on_directory = collect_candidate_directory_visit, .on_image_file = collect_candidate_image_visit, + .on_pkg_file = collect_candidate_pkg_visit, }; if (!sm_scan_tree_walk(scan_path, scan_path, 0u, scan_depth, &callbacks, &ctx) && unstable_found_out) diff --git a/src/sm_scan_tree.c b/src/sm_scan_tree.c index 9e21049..19f8781 100644 --- a/src/sm_scan_tree.c +++ b/src/sm_scan_tree.c @@ -5,6 +5,7 @@ #include "sm_filesystem.h" #include "sm_image.h" #include "sm_path_utils.h" +#include "sm_pkg.h" #include "sm_paths.h" #include "sm_runtime.h" @@ -84,6 +85,8 @@ bool sm_scan_tree_walk(const char *scan_root, const char *dir_path, callbacks->on_image_file && (!path_matches_root_or_child(scan_root, IMAGE_MOUNT_BASE) || scan_root_is_pfsc_mount_base); + bool allow_pkg_file_visits = + callbacks->on_pkg_file && !is_under_image_mount_base(scan_root); int read_error = 0; for (;;) { @@ -126,6 +129,15 @@ bool sm_scan_tree_walk(const char *scan_root, const char *dir_path, return false; } } + if (allow_pkg_file_visits && is_regular && + !is_under_image_mount_base(full_path) && + sm_pkg_path_is_candidate(full_path, entry->d_name)) { + if (!callbacks->on_pkg_file(full_path, entry->d_name, + depth_from_root + 1u, ctx)) { + closedir(d); + return false; + } + } if (!is_dir) continue; diff --git a/src/sm_scanner.c b/src/sm_scanner.c index edb4cf5..45bf2b4 100644 --- a/src/sm_scanner.c +++ b/src/sm_scanner.c @@ -19,6 +19,7 @@ #include "sm_image.h" #include "sm_install.h" #include "sm_install_queue.h" +#include "sm_pkg_install.h" #include "sm_limits.h" #include "sm_l10n.h" #include "sm_log.h" @@ -818,6 +819,25 @@ typedef struct { unsigned int scan_depth; } register_watch_tree_ctx_t; +static void schedule_scan_root_dirty(int scan_root_index, uint64_t now_us, + bool immediate); + +static bool register_watch_pkg_visit(const char *pkg_path, + const char *pkg_name, + unsigned int depth_from_root, + void *ctx_ptr) { + (void)pkg_path; + (void)pkg_name; + (void)depth_from_root; + register_watch_tree_ctx_t *ctx = (register_watch_tree_ctx_t *)ctx_ptr; + if (ctx && ctx->scan_root_index >= 0 && + ctx->scan_root_index < MAX_SCAN_PATHS) { + schedule_scan_root_dirty(ctx->scan_root_index, monotonic_time_us(), + false); + } + return true; +} + static sm_scan_tree_dir_visit_t register_watch_directory_visit( const char *dir_path, unsigned int depth_from_root, void *ctx_ptr) { register_watch_tree_ctx_t *ctx = (register_watch_tree_ctx_t *)ctx_ptr; @@ -882,6 +902,7 @@ static bool rebuild_scan_root_watch_tree(int kq, int scan_root_index) { sm_scan_tree_callbacks_t callbacks = { .on_directory = register_watch_directory_visit, .on_image_file = NULL, + .on_pkg_file = register_watch_pkg_visit, }; if (!sm_scan_tree_walk(scan_root, scan_root, 0u, scan_depth, &callbacks, &walk_ctx)) { @@ -925,6 +946,7 @@ static bool rebuild_scan_root_watch_subtree(int kq, int scan_root_index, sm_scan_tree_callbacks_t callbacks = { .on_directory = register_watch_directory_visit, .on_image_file = NULL, + .on_pkg_file = register_watch_pkg_visit, }; if (!sm_scan_tree_walk(scan_root, rebuild_path, rebuild_depth, scan_depth - rebuild_depth, &callbacks, &walk_ctx)) { @@ -1001,9 +1023,6 @@ static bool suspend_usb_scan_root_watch_trees(void) { return !removed_any || rebuild_scanner_watch_fd_index(); } -static void schedule_scan_root_dirty(int scan_root_index, uint64_t now_us, - bool immediate); - static void schedule_scan_roots_for_usb_slot_except(int slot, int excluded_root_index, uint64_t now_us) { @@ -1574,11 +1593,16 @@ static uint64_t compute_next_scan_deadline_us(uint64_t now_us, bool include_scan_work) { uint64_t next_deadline = full_resync_due_us; uint64_t install_wake_us = sm_install_next_wake_us(now_us); + uint64_t pkg_install_wake_us = sm_pkg_install_next_wake_us(now_us); if (install_wake_us != 0 && (next_deadline == 0 || install_wake_us < next_deadline)) { next_deadline = install_wake_us; } + if (pkg_install_wake_us != 0 && + (next_deadline == 0 || pkg_install_wake_us < next_deadline)) { + next_deadline = pkg_install_wake_us; + } if (g_scanner_config_reload_pending && (next_deadline == 0 || @@ -2282,12 +2306,19 @@ void sm_scanner_run_loop(void) { } uint64_t install_wake_us = sm_install_next_wake_us(now_us); + uint64_t pkg_install_wake_us = sm_pkg_install_next_wake_us(now_us); if (install_wake_us != 0 && now_us >= install_wake_us) { pthread_mutex_lock(&g_scanner_cycle_mutex); sm_install_service_pending(); pthread_mutex_unlock(&g_scanner_cycle_mutex); continue; } + if (pkg_install_wake_us != 0 && now_us >= pkg_install_wake_us) { + pthread_mutex_lock(&g_scanner_cycle_mutex); + sm_pkg_install_service(); + pthread_mutex_unlock(&g_scanner_cycle_mutex); + continue; + } if (!game_mount_busy && now_us >= next_fakelib_cache_cleanup_us) { sm_fakelib_cleanup_caches(); diff --git a/src/sm_shellcore_hooks.c b/src/sm_shellcore_hooks.c index 36dc3a1..f841a86 100644 --- a/src/sm_shellcore_hooks.c +++ b/src/sm_shellcore_hooks.c @@ -9,6 +9,7 @@ #include "sm_kstuff.h" #include "sm_log.h" #include "sm_runtime.h" +#include "sm_appinst.h" #include "sm_shellcore_hooks.h" #include "sm_shellcore_protocol_defs.h" #include "sm_shellcore_remote.h" @@ -1090,7 +1091,7 @@ bool sm_shellcore_install_title_dir(const char *title_id, return false; } - int result = sceAppInstUtilAppInstallAll(NULL); + int result = sm_appinst_install_all(NULL); armed = 0; bool disarmed = sm_remote_process_write( pid, remote_bridge_symbol(sm_shellcore_bridge_install_armed), &armed, diff --git a/tests/README.md b/tests/README.md index 917f3cf..d7176dd 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,5 +1,17 @@ Host regression tests (Linux/WSL; no console connection): +PKG parser and classification test (macOS/Linux with json-c): + +```sh +cc -std=gnu11 -O2 -Wall -Wextra -Werror -pthread \ + -Iinclude tests/test_pkg_parser.c src/sm_pkg.c \ + $(pkg-config --cflags --libs json-c) \ + -o /tmp/shadowmount-test-pkg +/tmp/shadowmount-test-pkg +``` + +Runtime configuration test (Linux/WSL): + ```sh cc -std=gnu11 -O2 -Wall -Wextra -Werror -pthread -ffunction-sections \ -Wl,--gc-sections -Iinclude tests/test_runtime_config.c \ diff --git a/tests/test_pkg_parser.c b/tests/test_pkg_parser.c new file mode 100644 index 0000000..215fe1c --- /dev/null +++ b/tests/test_pkg_parser.c @@ -0,0 +1,192 @@ +#include +#include +#include +#include +#include +#include + +#include "sm_pkg.h" + +static void put_be32(uint8_t *p, uint32_t value) { + p[0] = (uint8_t)(value >> 24); + p[1] = (uint8_t)(value >> 16); + p[2] = (uint8_t)(value >> 8); + p[3] = (uint8_t)value; +} + +static void put_le16(uint8_t *p, uint16_t value) { + p[0] = (uint8_t)value; + p[1] = (uint8_t)(value >> 8); +} + +static void put_le32(uint8_t *p, uint32_t value) { + p[0] = (uint8_t)value; + p[1] = (uint8_t)(value >> 8); + p[2] = (uint8_t)(value >> 16); + p[3] = (uint8_t)(value >> 24); +} + +static void put_le64(uint8_t *p, uint64_t value) { + for (int i = 0; i < 8; i++) { + p[i] = (uint8_t)value; + value >>= 8; + } +} + +static size_t build_sfo(uint8_t *out, const char *title_id, + const char *category) { + static const char keys[] = "TITLE\0TITLE_ID\0CATEGORY\0APP_VER\0"; + const char *names[] = {"TITLE", "TITLE_ID", "CATEGORY", "APP_VER"}; + const char *texts[] = {"Test Game", title_id, category, "01.02"}; + const uint32_t key_offset = 20u + 4u * 16u; + const uint32_t data_offset = key_offset + (uint32_t)sizeof(keys); + memset(out, 0, 512); + memcpy(out, "\0PSF", 4); + put_le32(out + 8, key_offset); + put_le32(out + 12, data_offset); + put_le32(out + 16, 4); + size_t key_pos = 0; + size_t data_pos = 0; + for (size_t i = 0; i < 4; i++) { + uint8_t *entry = out + 20u + i * 16u; + put_le16(entry, (uint16_t)key_pos); + put_le16(entry + 2, 0x0204); + put_le32(entry + 4, (uint32_t)strlen(texts[i]) + 1u); + put_le32(entry + 8, (uint32_t)strlen(texts[i]) + 1u); + put_le32(entry + 12, (uint32_t)data_pos); + key_pos += strlen(names[i]) + 1u; + data_pos += strlen(texts[i]) + 1u; + } + memcpy(out + key_offset, keys, sizeof(keys)); + data_pos = 0; + for (size_t i = 0; i < 4; i++) { + size_t length = strlen(texts[i]) + 1u; + memcpy(out + data_offset + data_pos, texts[i], length); + data_pos += length; + } + return (size_t)data_offset + data_pos; +} + +static size_t build_cnt_kind(uint8_t *out, uint32_t content_type, + uint32_t content_flags, const char *title_id, + const char *category) { + uint8_t sfo[512]; + size_t sfo_size = build_sfo(sfo, title_id, category); + const uint32_t table_offset = 0xA0; + const uint32_t sfo_offset = table_offset + 0x20; + memset(out, 0, 2048); + put_be32(out, 0x7F434E54u); + put_be32(out + 0x10, 1); + put_be32(out + 0x18, table_offset); + put_be32(out + 0x74, 0x20u); + memcpy(out + 0x40, "UP0000-PPSA12345_00-TESTGAME0000000", 36); + uint8_t *entry = out + table_offset; + put_be32(entry, 0x1000); + put_be32(entry + 0x10, sfo_offset); + put_be32(entry + 0x14, (uint32_t)sfo_size); + memcpy(out + sfo_offset, sfo, sfo_size); + put_be32(out + 0x74, content_type); + put_be32(out + 0x78, content_flags); + return sfo_offset + sfo_size; +} + +static size_t build_cnt(uint8_t *out, uint32_t base) { + (void)base; + return build_cnt_kind(out, 0x20u, 0u, "PPSA12345", "gd"); +} + +static void write_file(const char *path, const uint8_t *data, size_t size) { + FILE *file = fopen(path, "wb"); + assert(file); + assert(fwrite(data, 1, size, file) == size); + assert(fclose(file) == 0); +} + +int main(void) { + char path[] = "/tmp/shadowmount-test-XXXXXX.pkg"; + int fd = mkstemps(path, 4); + assert(fd >= 0); + close(fd); + + uint8_t cnt[2048]; + size_t cnt_size = build_cnt(cnt, 0); + write_file(path, cnt, cnt_size); + struct stat st; + assert(stat(path, &st) == 0); + scan_candidate_t candidate; + assert(sm_pkg_parse_file(path, &st, &candidate)); + assert(candidate.kind == SCAN_CANDIDATE_PKG); + assert(strcmp(candidate.title_id, "PPSA12345") == 0); + assert(strcmp(candidate.title_name, "Test Game") == 0); + assert(strcmp(candidate.category, "gd") == 0); + assert(candidate.pkg_kind == PKG_KIND_BASE); + assert(candidate.pkg_classification_confident); + assert(candidate.content_type == 0x20u); + assert(strcmp(candidate.app_ver, "01.02") == 0); + assert(strcmp(candidate.content_id, "UP0000-PPSA12345_00-TESTGAME0000000") == 0); + + uint8_t fih[4096]; + memset(fih, 0, sizeof(fih)); + memcpy(fih, cnt, 0xA0); + put_be32(fih, 0x7F464948u); + put_le16(fih + 6, 3); + put_le64(fih + 0x58, 0x200); + memcpy(fih + 0x200, cnt, cnt_size); + write_file(path, fih, 0x200 + cnt_size); + assert(stat(path, &st) == 0); + assert(sm_pkg_parse_file(path, &st, &candidate)); + assert(strcmp(candidate.title_id, "PPSA12345") == 0); + assert(candidate.pkg_kind == PKG_KIND_BASE); + assert(candidate.outer_content_type == 0x20u); + + uint8_t patch[2048]; + size_t patch_size = build_cnt_kind(patch, 0x20u, 0x40100000u, + "PPSA12345", "gp"); + write_file(path, patch, patch_size); + assert(stat(path, &st) == 0); + assert(sm_pkg_parse_file(path, &st, &candidate)); + assert(candidate.pkg_kind == PKG_KIND_PATCH); + + uint8_t dlc[2048]; + size_t dlc_size = build_cnt_kind(dlc, 0x21u, 0u, "PPSA12345", "ac"); + write_file(path, dlc, dlc_size); + assert(stat(path, &st) == 0); + assert(sm_pkg_parse_file(path, &st, &candidate)); + assert(candidate.pkg_kind == PKG_KIND_DLC); + + uint8_t system_app[2048]; + size_t system_app_size = + build_cnt_kind(system_app, 0x26u, 0u, "PPSA12345", "gd"); + write_file(path, system_app, system_app_size); + assert(stat(path, &st) == 0); + assert(!sm_pkg_parse_file(path, &st, &candidate)); + + uint8_t contradictory[2048]; + size_t contradictory_size = + build_cnt_kind(contradictory, 0x20u, 0u, "PPSA12345", "gp"); + write_file(path, contradictory, contradictory_size); + assert(stat(path, &st) == 0); + assert(!sm_pkg_parse_file(path, &st, &candidate)); + + contradictory_size = + build_cnt_kind(contradictory, 0x20u, 0u, "FAKE12345", "gd"); + memcpy(contradictory + 0x40, "UP0000-FAKE12345_00-TESTGAME0000000", 36); + write_file(path, contradictory, contradictory_size); + assert(stat(path, &st) == 0); + assert(!sm_pkg_parse_file(path, &st, &candidate)); + + assert(sm_pkg_compare_versions("1.10", "1.9") > 0); + assert(sm_pkg_compare_versions("1.02", "1.02") == 0); + assert(sm_pkg_is_installed_content_path("/user/app/PPSA12345/app.pkg")); + assert(sm_pkg_is_installed_content_path("/mnt/ext0/user/addcont/PPSA12345/x.pkg")); + assert(!sm_pkg_is_installed_content_path("/user/data/game.pkg")); + + fih[0] = 0; + write_file(path, fih, 0x200 + cnt_size); + assert(stat(path, &st) == 0); + assert(!sm_pkg_parse_file(path, &st, &candidate)); + + unlink(path); + puts("pkg parser tests passed"); + return 0; +} diff --git a/third_party/ps5-sdk/sce_stubs/libkernel_sys.c b/third_party/ps5-sdk/sce_stubs/libkernel_sys.c new file mode 100644 index 0000000..16f5a19 --- /dev/null +++ b/third_party/ps5-sdk/sce_stubs/libkernel_sys.c @@ -0,0 +1,5124 @@ + +asm(".global __Ux86_64_setcontext\n" + ".type __Ux86_64_setcontext @function\n" + "__Ux86_64_setcontext:\n"); + +asm(".global __elf_phdr_match_addr\n" + ".type __elf_phdr_match_addr @function\n" + "__elf_phdr_match_addr:\n"); + +asm(".global __error\n" + ".type __error @function\n" + "__error:\n"); + +asm(".global __freeze\n" + ".type __freeze @function\n" + "__freeze:\n"); + +asm(".global __getcwd\n" + ".type __getcwd @function\n" + "__getcwd:\n"); + +asm(".global __inet_ntop\n" + ".type __inet_ntop @function\n" + "__inet_ntop:\n"); + +asm(".global __inet_pton\n" + ".type __inet_pton @function\n" + "__inet_pton:\n"); + +asm(".global __pthread_cleanup_pop_imp\n" + ".type __pthread_cleanup_pop_imp @function\n" + "__pthread_cleanup_pop_imp:\n"); + +asm(".global __pthread_cleanup_push_imp\n" + ".type __pthread_cleanup_push_imp @function\n" + "__pthread_cleanup_push_imp:\n"); + +asm(".global __pthread_cxa_finalize\n" + ".type __pthread_cxa_finalize @function\n" + "__pthread_cxa_finalize:\n"); + +asm(".global __sceKernelGetGPI\n" + ".type __sceKernelGetGPI @function\n" + "__sceKernelGetGPI:\n"); + +asm(".global __stack_chk_fail\n" + ".type __stack_chk_fail @function\n" + "__stack_chk_fail:\n"); + +asm(".global __sys_debug_init\n" + ".type __sys_debug_init @function\n" + "__sys_debug_init:\n"); + +asm(".global __sys_dl_get_info\n" + ".type __sys_dl_get_info @function\n" + "__sys_dl_get_info:\n"); + +asm(".global __sys_dl_get_info_2\n" + ".type __sys_dl_get_info_2 @function\n" + "__sys_dl_get_info_2:\n"); + +asm(".global __sys_dl_get_list\n" + ".type __sys_dl_get_list @function\n" + "__sys_dl_get_list:\n"); + +asm(".global __sys_dl_get_metadata\n" + ".type __sys_dl_get_metadata @function\n" + "__sys_dl_get_metadata:\n"); + +asm(".global __sys_dynlib_get_info2\n" + ".type __sys_dynlib_get_info2 @function\n" + "__sys_dynlib_get_info2:\n"); + +asm(".global __sys_dynlib_get_info_for_libdbg\n" + ".type __sys_dynlib_get_info_for_libdbg @function\n" + "__sys_dynlib_get_info_for_libdbg:\n"); + +asm(".global __sys_dynlib_get_list2\n" + ".type __sys_dynlib_get_list2 @function\n" + "__sys_dynlib_get_list2:\n"); + +asm(".global __sys_dynlib_get_list_for_libdbg\n" + ".type __sys_dynlib_get_list_for_libdbg @function\n" + "__sys_dynlib_get_list_for_libdbg:\n"); + +asm(".global __sys_dynlib_load_prx\n" + ".type __sys_dynlib_load_prx @function\n" + "__sys_dynlib_load_prx:\n"); + +asm(".global __sys_get_proc_type_info\n" + ".type __sys_get_proc_type_info @function\n" + "__sys_get_proc_type_info:\n"); + +asm(".global __sys_is_development_mode\n" + ".type __sys_is_development_mode @function\n" + "__sys_is_development_mode:\n"); + +asm(".global __sys_kqueueex\n" + ".type __sys_kqueueex @function\n" + "__sys_kqueueex:\n"); + +asm(".global __sys_namedobj_create\n" + ".type __sys_namedobj_create @function\n" + "__sys_namedobj_create:\n"); + +asm(".global __sys_namedobj_delete\n" + ".type __sys_namedobj_delete @function\n" + "__sys_namedobj_delete:\n"); + +asm(".global __sys_nanosleep\n" + ".type __sys_nanosleep @function\n" + "__sys_nanosleep:\n"); + +asm(".global __sys_netabort\n" + ".type __sys_netabort @function\n" + "__sys_netabort:\n"); + +asm(".global __sys_netcontrol\n" + ".type __sys_netcontrol @function\n" + "__sys_netcontrol:\n"); + +asm(".global __sys_netgetiflist\n" + ".type __sys_netgetiflist @function\n" + "__sys_netgetiflist:\n"); + +asm(".global __sys_netgetsockinfo\n" + ".type __sys_netgetsockinfo @function\n" + "__sys_netgetsockinfo:\n"); + +asm(".global __sys_opmc_disable\n" + ".type __sys_opmc_disable @function\n" + "__sys_opmc_disable:\n"); + +asm(".global __sys_opmc_enable\n" + ".type __sys_opmc_enable @function\n" + "__sys_opmc_enable:\n"); + +asm(".global __sys_opmc_get_ctr\n" + ".type __sys_opmc_get_ctr @function\n" + "__sys_opmc_get_ctr:\n"); + +asm(".global __sys_opmc_get_hw\n" + ".type __sys_opmc_get_hw @function\n" + "__sys_opmc_get_hw:\n"); + +asm(".global __sys_opmc_set_ctl\n" + ".type __sys_opmc_set_ctl @function\n" + "__sys_opmc_set_ctl:\n"); + +asm(".global __sys_opmc_set_ctr\n" + ".type __sys_opmc_set_ctr @function\n" + "__sys_opmc_set_ctr:\n"); + +asm(".global __sys_opmc_set_hw\n" + ".type __sys_opmc_set_hw @function\n" + "__sys_opmc_set_hw:\n"); + +asm(".global __sys_osem_close\n" + ".type __sys_osem_close @function\n" + "__sys_osem_close:\n"); + +asm(".global __sys_osem_open\n" + ".type __sys_osem_open @function\n" + "__sys_osem_open:\n"); + +asm(".global __sys_randomized_path\n" + ".type __sys_randomized_path @function\n" + "__sys_randomized_path:\n"); + +asm(".global __sys_rdup\n" + ".type __sys_rdup @function\n" + "__sys_rdup:\n"); + +asm(".global __sys_regmgr_call\n" + ".type __sys_regmgr_call @function\n" + "__sys_regmgr_call:\n"); + +asm(".global __sys_resume_internal_hdd\n" + ".type __sys_resume_internal_hdd @function\n" + "__sys_resume_internal_hdd:\n"); + +asm(".global __sys_resume_process\n" + ".type __sys_resume_process @function\n" + "__sys_resume_process:\n"); + +asm(".global __sys_set_uevt\n" + ".type __sys_set_uevt @function\n" + "__sys_set_uevt:\n"); + +asm(".global __sys_socketclose\n" + ".type __sys_socketclose @function\n" + "__sys_socketclose:\n"); + +asm(".global __sys_socketex\n" + ".type __sys_socketex @function\n" + "__sys_socketex:\n"); + +asm(".global __sys_suspend_process\n" + ".type __sys_suspend_process @function\n" + "__sys_suspend_process:\n"); + +asm(".global __sys_test_debug_rwmem\n" + ".type __sys_test_debug_rwmem @function\n" + "__sys_test_debug_rwmem:\n"); + +asm(".global __sys_workaround8849\n" + ".type __sys_workaround8849 @function\n" + "__sys_workaround8849:\n"); + +asm(".global __tls_get_addr\n" + ".type __tls_get_addr @function\n" + "__tls_get_addr:\n"); + +asm(".global _accept\n" + ".type _accept @function\n" + "_accept:\n"); + +asm(".global _bind\n" + ".type _bind @function\n" + "_bind:\n"); + +asm(".global _close\n" + ".type _close @function\n" + "_close:\n"); + +asm(".global _connect\n" + ".type _connect @function\n" + "_connect:\n"); + +asm(".global _dup2\n" + ".type _dup2 @function\n" + "_dup2:\n"); + +asm(".global _execve\n" + ".type _execve @function\n" + "_execve:\n"); + +asm(".global _execvpe\n" + ".type _execvpe @function\n" + "_execvpe:\n"); + +asm(".global _exit\n" + ".type _exit @function\n" + "_exit:\n"); + +asm(".global _fcntl\n" + ".type _fcntl @function\n" + "_fcntl:\n"); + +asm(".global _fpathconf\n" + ".type _fpathconf @function\n" + "_fpathconf:\n"); + +asm(".global _fstat\n" + ".type _fstat @function\n" + "_fstat:\n"); + +asm(".global _fstatfs\n" + ".type _fstatfs @function\n" + "_fstatfs:\n"); + +asm(".global _getdirentries\n" + ".type _getdirentries @function\n" + "_getdirentries:\n"); + +asm(".global _getpeername\n" + ".type _getpeername @function\n" + "_getpeername:\n"); + +asm(".global _getsockname\n" + ".type _getsockname @function\n" + "_getsockname:\n"); + +asm(".global _getsockopt\n" + ".type _getsockopt @function\n" + "_getsockopt:\n"); + +asm(".global _ioctl\n" + ".type _ioctl @function\n" + "_ioctl:\n"); + +asm(".global _is_signal_return\n" + ".type _is_signal_return @function\n" + "_is_signal_return:\n"); + +asm(".global _listen\n" + ".type _listen @function\n" + "_listen:\n"); + +asm(".global _nanosleep\n" + ".type _nanosleep @function\n" + "_nanosleep:\n"); + +asm(".global _open\n" + ".type _open @function\n" + "_open:\n"); + +asm(".global _openat\n" + ".type _openat @function\n" + "_openat:\n"); + +asm(".global _read\n" + ".type _read @function\n" + "_read:\n"); + +asm(".global _readv\n" + ".type _readv @function\n" + "_readv:\n"); + +asm(".global _recvfrom\n" + ".type _recvfrom @function\n" + "_recvfrom:\n"); + +asm(".global _recvmsg\n" + ".type _recvmsg @function\n" + "_recvmsg:\n"); + +asm(".global _sceKernelRtldSetApplicationHeapAPI\n" + ".type _sceKernelRtldSetApplicationHeapAPI @function\n" + "_sceKernelRtldSetApplicationHeapAPI:\n"); + +asm(".global _sceKernelRtldThreadAtexitDecrement\n" + ".type _sceKernelRtldThreadAtexitDecrement @function\n" + "_sceKernelRtldThreadAtexitDecrement:\n"); + +asm(".global _sceKernelRtldThreadAtexitIncrement\n" + ".type _sceKernelRtldThreadAtexitIncrement @function\n" + "_sceKernelRtldThreadAtexitIncrement:\n"); + +asm(".global _sceKernelSetThreadAtexitCount\n" + ".type _sceKernelSetThreadAtexitCount @function\n" + "_sceKernelSetThreadAtexitCount:\n"); + +asm(".global _sceKernelSetThreadAtexitReport\n" + ".type _sceKernelSetThreadAtexitReport @function\n" + "_sceKernelSetThreadAtexitReport:\n"); + +asm(".global _sceKernelSetThreadDtors\n" + ".type _sceKernelSetThreadDtors @function\n" + "_sceKernelSetThreadDtors:\n"); + +asm(".global _sendmsg\n" + ".type _sendmsg @function\n" + "_sendmsg:\n"); + +asm(".global _sendto\n" + ".type _sendto @function\n" + "_sendto:\n"); + +asm(".global _setsockopt\n" + ".type _setsockopt @function\n" + "_setsockopt:\n"); + +asm(".global _sigaction\n" + ".type _sigaction @function\n" + "_sigaction:\n"); + +asm(".global _sigprocmask\n" + ".type _sigprocmask @function\n" + "_sigprocmask:\n"); + +asm(".global _sigsuspend\n" + ".type _sigsuspend @function\n" + "_sigsuspend:\n"); + +asm(".global _umtx_op\n" + ".type _umtx_op @function\n" + "_umtx_op:\n"); + +asm(".global _wait4\n" + ".type _wait4 @function\n" + "_wait4:\n"); + +asm(".global _write\n" + ".type _write @function\n" + "_write:\n"); + +asm(".global _writev\n" + ".type _writev @function\n" + "_writev:\n"); + +asm(".global accept\n" + ".type accept @function\n" + "accept:\n"); + +asm(".global access\n" + ".type access @function\n" + "access:\n"); + +asm(".global aio_cancel\n" + ".type aio_cancel @function\n" + "aio_cancel:\n"); + +asm(".global aio_error\n" + ".type aio_error @function\n" + "aio_error:\n"); + +asm(".global aio_fsync\n" + ".type aio_fsync @function\n" + "aio_fsync:\n"); + +asm(".global aio_read\n" + ".type aio_read @function\n" + "aio_read:\n"); + +asm(".global aio_return\n" + ".type aio_return @function\n" + "aio_return:\n"); + +asm(".global aio_suspend\n" + ".type aio_suspend @function\n" + "aio_suspend:\n"); + +asm(".global aio_waitcomplete\n" + ".type aio_waitcomplete @function\n" + "aio_waitcomplete:\n"); + +asm(".global aio_write\n" + ".type aio_write @function\n" + "aio_write:\n"); + +asm(".global amd64_set_fsbase\n" + ".type amd64_set_fsbase @function\n" + "amd64_set_fsbase:\n"); + +asm(".global bind\n" + ".type bind @function\n" + "bind:\n"); + +asm(".global blockpool_batch\n" + ".type blockpool_batch @function\n" + "blockpool_batch:\n"); + +asm(".global blockpool_map\n" + ".type blockpool_map @function\n" + "blockpool_map:\n"); + +asm(".global blockpool_open\n" + ".type blockpool_open @function\n" + "blockpool_open:\n"); + +asm(".global blockpool_unmap\n" + ".type blockpool_unmap @function\n" + "blockpool_unmap:\n"); + +asm(".global cfsetspeed\n" + ".type cfsetspeed @function\n" + "cfsetspeed:\n"); + +asm(".global chdir\n" + ".type chdir @function\n" + "chdir:\n"); + +asm(".global chflags\n" + ".type chflags @function\n" + "chflags:\n"); + +asm(".global chmod\n" + ".type chmod @function\n" + "chmod:\n"); + +asm(".global chown\n" + ".type chown @function\n" + "chown:\n"); + +asm(".global chroot\n" + ".type chroot @function\n" + "chroot:\n"); + +asm(".global clock_getres\n" + ".type clock_getres @function\n" + "clock_getres:\n"); + +asm(".global clock_gettime\n" + ".type clock_gettime @function\n" + "clock_gettime:\n"); + +asm(".global clock_settime\n" + ".type clock_settime @function\n" + "clock_settime:\n"); + +asm(".global close\n" + ".type close @function\n" + "close:\n"); + +asm(".global connect\n" + ".type connect @function\n" + "connect:\n"); + +asm(".global cpuset\n" + ".type cpuset @function\n" + "cpuset:\n"); + +asm(".global cpuset_getaffinity\n" + ".type cpuset_getaffinity @function\n" + "cpuset_getaffinity:\n"); + +asm(".global cpuset_getid\n" + ".type cpuset_getid @function\n" + "cpuset_getid:\n"); + +asm(".global cpuset_setaffinity\n" + ".type cpuset_setaffinity @function\n" + "cpuset_setaffinity:\n"); + +asm(".global cpuset_setid\n" + ".type cpuset_setid @function\n" + "cpuset_setid:\n"); + +asm(".global creat\n" + ".type creat @function\n" + "creat:\n"); + +asm(".global dlclose\n" + ".type dlclose @function\n" + "dlclose:\n"); + +asm(".global dlerror\n" + ".type dlerror @function\n" + "dlerror:\n"); + +asm(".global dlopen\n" + ".type dlopen @function\n" + "dlopen:\n"); + +asm(".global dlsym\n" + ".type dlsym @function\n" + "dlsym:\n"); + +asm(".global dup\n" + ".type dup @function\n" + "dup:\n"); + +asm(".global dup2\n" + ".type dup2 @function\n" + "dup2:\n"); + +asm(".global dynlib_get_obj_member\n" + ".type dynlib_get_obj_member @function\n" + "dynlib_get_obj_member:\n"); + +asm(".global execv\n" + ".type execv @function\n" + "execv:\n"); + +asm(".global execve\n" + ".type execve @function\n" + "execve:\n"); + +asm(".global execvp\n" + ".type execvp @function\n" + "execvp:\n"); + +asm(".global fchdir\n" + ".type fchdir @function\n" + "fchdir:\n"); + +asm(".global fchflags\n" + ".type fchflags @function\n" + "fchflags:\n"); + +asm(".global fchmod\n" + ".type fchmod @function\n" + "fchmod:\n"); + +asm(".global fchmodat\n" + ".type fchmodat @function\n" + "fchmodat:\n"); + +asm(".global fchown\n" + ".type fchown @function\n" + "fchown:\n"); + +asm(".global fchownat\n" + ".type fchownat @function\n" + "fchownat:\n"); + +asm(".global fcntl\n" + ".type fcntl @function\n" + "fcntl:\n"); + +asm(".global fdatasync\n" + ".type fdatasync @function\n" + "fdatasync:\n"); + +asm(".global flock\n" + ".type flock @function\n" + "flock:\n"); + +asm(".global fork\n" + ".type fork @function\n" + "fork:\n"); + +asm(".global fpathconf\n" + ".type fpathconf @function\n" + "fpathconf:\n"); + +asm(".global fstat\n" + ".type fstat @function\n" + "fstat:\n"); + +asm(".global fstatat\n" + ".type fstatat @function\n" + "fstatat:\n"); + +asm(".global fstatfs\n" + ".type fstatfs @function\n" + "fstatfs:\n"); + +asm(".global fsync\n" + ".type fsync @function\n" + "fsync:\n"); + +asm(".global ftruncate\n" + ".type ftruncate @function\n" + "ftruncate:\n"); + +asm(".global futimes\n" + ".type futimes @function\n" + "futimes:\n"); + +asm(".global futimesat\n" + ".type futimesat @function\n" + "futimesat:\n"); + +asm(".global get_authinfo\n" + ".type get_authinfo @function\n" + "get_authinfo:\n"); + +asm(".global get_module_info_list\n" + ".type get_module_info_list @function\n" + "get_module_info_list:\n"); + +asm(".global get_page_table_stats\n" + ".type get_page_table_stats @function\n" + "get_page_table_stats:\n"); + +asm(".global get_sdk_compiled_version\n" + ".type get_sdk_compiled_version @function\n" + "get_sdk_compiled_version:\n"); + +asm(".global get_self_auth_info\n" + ".type get_self_auth_info @function\n" + "get_self_auth_info:\n"); + +asm(".global get_vm_map_timestamp\n" + ".type get_vm_map_timestamp @function\n" + "get_vm_map_timestamp:\n"); + +asm(".global getargc\n" + ".type getargc @function\n" + "getargc:\n"); + +asm(".global getargv\n" + ".type getargv @function\n" + "getargv:\n"); + +asm(".global getcontext\n" + ".type getcontext @function\n" + "getcontext:\n"); + +asm(".global getdents\n" + ".type getdents @function\n" + "getdents:\n"); + +asm(".global getdirentries\n" + ".type getdirentries @function\n" + "getdirentries:\n"); + +asm(".global getdtablesize\n" + ".type getdtablesize @function\n" + "getdtablesize:\n"); + +asm(".global getegid\n" + ".type getegid @function\n" + "getegid:\n"); + +asm(".global geteuid\n" + ".type geteuid @function\n" + "geteuid:\n"); + +asm(".global getfsstat\n" + ".type getfsstat @function\n" + "getfsstat:\n"); + +asm(".global getgid\n" + ".type getgid @function\n" + "getgid:\n"); + +asm(".global getgroups\n" + ".type getgroups @function\n" + "getgroups:\n"); + +asm(".global getitimer\n" + ".type getitimer @function\n" + "getitimer:\n"); + +asm(".global getlogin\n" + ".type getlogin @function\n" + "getlogin:\n"); + +asm(".global getlogin_r\n" + ".type getlogin_r @function\n" + "getlogin_r:\n"); + +asm(".global getpagesize\n" + ".type getpagesize @function\n" + "getpagesize:\n"); + +asm(".global getpeername\n" + ".type getpeername @function\n" + "getpeername:\n"); + +asm(".global getpid\n" + ".type getpid @function\n" + "getpid:\n"); + +asm(".global getppid\n" + ".type getppid @function\n" + "getppid:\n"); + +asm(".global getpriority\n" + ".type getpriority @function\n" + "getpriority:\n"); + +asm(".global getrlimit\n" + ".type getrlimit @function\n" + "getrlimit:\n"); + +asm(".global getrusage\n" + ".type getrusage @function\n" + "getrusage:\n"); + +asm(".global getsid\n" + ".type getsid @function\n" + "getsid:\n"); + +asm(".global getsockname\n" + ".type getsockname @function\n" + "getsockname:\n"); + +asm(".global getsockopt\n" + ".type getsockopt @function\n" + "getsockopt:\n"); + +asm(".global gettimeofday\n" + ".type gettimeofday @function\n" + "gettimeofday:\n"); + +asm(".global getuid\n" + ".type getuid @function\n" + "getuid:\n"); + +asm(".global htonl\n" + ".type htonl @function\n" + "htonl:\n"); + +asm(".global htons\n" + ".type htons @function\n" + "htons:\n"); + +asm(".global inet_ntop\n" + ".type inet_ntop @function\n" + "inet_ntop:\n"); + +asm(".global inet_pton\n" + ".type inet_pton @function\n" + "inet_pton:\n"); + +asm(".global ioctl\n" + ".type ioctl @function\n" + "ioctl:\n"); + +asm(".global ipmimgr_call\n" + ".type ipmimgr_call @function\n" + "ipmimgr_call:\n"); + +asm(".global is_in_sandbox\n" + ".type is_in_sandbox @function\n" + "is_in_sandbox:\n"); + +asm(".global issetugid\n" + ".type issetugid @function\n" + "issetugid:\n"); + +asm(".global kenv\n" + ".type kenv @function\n" + "kenv:\n"); + +asm(".global kevent\n" + ".type kevent @function\n" + "kevent:\n"); + +asm(".global kill\n" + ".type kill @function\n" + "kill:\n"); + +asm(".global kldfind\n" + ".type kldfind @function\n" + "kldfind:\n"); + +asm(".global kldfirstmod\n" + ".type kldfirstmod @function\n" + "kldfirstmod:\n"); + +asm(".global kldload\n" + ".type kldload @function\n" + "kldload:\n"); + +asm(".global kldnext\n" + ".type kldnext @function\n" + "kldnext:\n"); + +asm(".global kldstat\n" + ".type kldstat @function\n" + "kldstat:\n"); + +asm(".global kldsym\n" + ".type kldsym @function\n" + "kldsym:\n"); + +asm(".global kldunload\n" + ".type kldunload @function\n" + "kldunload:\n"); + +asm(".global kmq_notify\n" + ".type kmq_notify @function\n" + "kmq_notify:\n"); + +asm(".global kmq_open\n" + ".type kmq_open @function\n" + "kmq_open:\n"); + +asm(".global kmq_setattr\n" + ".type kmq_setattr @function\n" + "kmq_setattr:\n"); + +asm(".global kmq_timedreceive\n" + ".type kmq_timedreceive @function\n" + "kmq_timedreceive:\n"); + +asm(".global kmq_timedsend\n" + ".type kmq_timedsend @function\n" + "kmq_timedsend:\n"); + +asm(".global kmq_unlink\n" + ".type kmq_unlink @function\n" + "kmq_unlink:\n"); + +asm(".global kqueue\n" + ".type kqueue @function\n" + "kqueue:\n"); + +asm(".global ksem_close\n" + ".type ksem_close @function\n" + "ksem_close:\n"); + +asm(".global ksem_destroy\n" + ".type ksem_destroy @function\n" + "ksem_destroy:\n"); + +asm(".global ksem_getvalue\n" + ".type ksem_getvalue @function\n" + "ksem_getvalue:\n"); + +asm(".global ksem_init\n" + ".type ksem_init @function\n" + "ksem_init:\n"); + +asm(".global ksem_open\n" + ".type ksem_open @function\n" + "ksem_open:\n"); + +asm(".global ksem_post\n" + ".type ksem_post @function\n" + "ksem_post:\n"); + +asm(".global ksem_timedwait\n" + ".type ksem_timedwait @function\n" + "ksem_timedwait:\n"); + +asm(".global ksem_trywait\n" + ".type ksem_trywait @function\n" + "ksem_trywait:\n"); + +asm(".global ksem_unlink\n" + ".type ksem_unlink @function\n" + "ksem_unlink:\n"); + +asm(".global ksem_wait\n" + ".type ksem_wait @function\n" + "ksem_wait:\n"); + +asm(".global ktimer_create\n" + ".type ktimer_create @function\n" + "ktimer_create:\n"); + +asm(".global ktimer_delete\n" + ".type ktimer_delete @function\n" + "ktimer_delete:\n"); + +asm(".global ktimer_getoverrun\n" + ".type ktimer_getoverrun @function\n" + "ktimer_getoverrun:\n"); + +asm(".global ktimer_gettime\n" + ".type ktimer_gettime @function\n" + "ktimer_gettime:\n"); + +asm(".global ktimer_settime\n" + ".type ktimer_settime @function\n" + "ktimer_settime:\n"); + +asm(".global ktrace\n" + ".type ktrace @function\n" + "ktrace:\n"); + +asm(".global lchflags\n" + ".type lchflags @function\n" + "lchflags:\n"); + +asm(".global lchmod\n" + ".type lchmod @function\n" + "lchmod:\n"); + +asm(".global lchown\n" + ".type lchown @function\n" + "lchown:\n"); + +asm(".global link\n" + ".type link @function\n" + "link:\n"); + +asm(".global linkat\n" + ".type linkat @function\n" + "linkat:\n"); + +asm(".global listen\n" + ".type listen @function\n" + "listen:\n"); + +asm(".global lseek\n" + ".type lseek @function\n" + "lseek:\n"); + +asm(".global lstat\n" + ".type lstat @function\n" + "lstat:\n"); + +asm(".global lutimes\n" + ".type lutimes @function\n" + "lutimes:\n"); + +asm(".global madvise\n" + ".type madvise @function\n" + "madvise:\n"); + +asm(".global mdbg_call\n" + ".type mdbg_call @function\n" + "mdbg_call:\n"); + +asm(".global mdbg_service\n" + ".type mdbg_service @function\n" + "mdbg_service:\n"); + +asm(".global mincore\n" + ".type mincore @function\n" + "mincore:\n"); + +asm(".global mkdir\n" + ".type mkdir @function\n" + "mkdir:\n"); + +asm(".global mkdirat\n" + ".type mkdirat @function\n" + "mkdirat:\n"); + +asm(".global mlock\n" + ".type mlock @function\n" + "mlock:\n"); + +asm(".global mlockall\n" + ".type mlockall @function\n" + "mlockall:\n"); + +asm(".global mmap\n" + ".type mmap @function\n" + "mmap:\n"); + +asm(".global mount\n" + ".type mount @function\n" + "mount:\n"); + +asm(".global mprotect\n" + ".type mprotect @function\n" + "mprotect:\n"); + +asm(".global msync\n" + ".type msync @function\n" + "msync:\n"); + +asm(".global munlock\n" + ".type munlock @function\n" + "munlock:\n"); + +asm(".global munlockall\n" + ".type munlockall @function\n" + "munlockall:\n"); + +asm(".global munmap\n" + ".type munmap @function\n" + "munmap:\n"); + +asm(".global nanosleep\n" + ".type nanosleep @function\n" + "nanosleep:\n"); + +asm(".global nmount\n" + ".type nmount @function\n" + "nmount:\n"); + +asm(".global ntohl\n" + ".type ntohl @function\n" + "ntohl:\n"); + +asm(".global ntohs\n" + ".type ntohs @function\n" + "ntohs:\n"); + +asm(".global open\n" + ".type open @function\n" + "open:\n"); + +asm(".global openat\n" + ".type openat @function\n" + "openat:\n"); + +asm(".global openintr\n" + ".type openintr @function\n" + "openintr:\n"); + +asm(".global pathconf\n" + ".type pathconf @function\n" + "pathconf:\n"); + +asm(".global pause\n" + ".type pause @function\n" + "pause:\n"); + +asm(".global physhm_open\n" + ".type physhm_open @function\n" + "physhm_open:\n"); + +asm(".global physhm_unlink\n" + ".type physhm_unlink @function\n" + "physhm_unlink:\n"); + +asm(".global pipe\n" + ".type pipe @function\n" + "pipe:\n"); + +asm(".global poll\n" + ".type poll @function\n" + "poll:\n"); + +asm(".global pread\n" + ".type pread @function\n" + "pread:\n"); + +asm(".global preadv\n" + ".type preadv @function\n" + "preadv:\n"); + +asm(".global profil\n" + ".type profil @function\n" + "profil:\n"); + +asm(".global pselect\n" + ".type pselect @function\n" + "pselect:\n"); + +asm(".global pthread_atfork\n" + ".type pthread_atfork @function\n" + "pthread_atfork:\n"); + +asm(".global pthread_attr_destroy\n" + ".type pthread_attr_destroy @function\n" + "pthread_attr_destroy:\n"); + +asm(".global pthread_attr_get_np\n" + ".type pthread_attr_get_np @function\n" + "pthread_attr_get_np:\n"); + +asm(".global pthread_attr_getaffinity_np\n" + ".type pthread_attr_getaffinity_np @function\n" + "pthread_attr_getaffinity_np:\n"); + +asm(".global pthread_attr_getdetachstate\n" + ".type pthread_attr_getdetachstate @function\n" + "pthread_attr_getdetachstate:\n"); + +asm(".global pthread_attr_getguardsize\n" + ".type pthread_attr_getguardsize @function\n" + "pthread_attr_getguardsize:\n"); + +asm(".global pthread_attr_getinheritsched\n" + ".type pthread_attr_getinheritsched @function\n" + "pthread_attr_getinheritsched:\n"); + +asm(".global pthread_attr_getschedparam\n" + ".type pthread_attr_getschedparam @function\n" + "pthread_attr_getschedparam:\n"); + +asm(".global pthread_attr_getschedpolicy\n" + ".type pthread_attr_getschedpolicy @function\n" + "pthread_attr_getschedpolicy:\n"); + +asm(".global pthread_attr_getscope\n" + ".type pthread_attr_getscope @function\n" + "pthread_attr_getscope:\n"); + +asm(".global pthread_attr_getsolosched_np\n" + ".type pthread_attr_getsolosched_np @function\n" + "pthread_attr_getsolosched_np:\n"); + +asm(".global pthread_attr_getstack\n" + ".type pthread_attr_getstack @function\n" + "pthread_attr_getstack:\n"); + +asm(".global pthread_attr_getstackaddr\n" + ".type pthread_attr_getstackaddr @function\n" + "pthread_attr_getstackaddr:\n"); + +asm(".global pthread_attr_getstacksize\n" + ".type pthread_attr_getstacksize @function\n" + "pthread_attr_getstacksize:\n"); + +asm(".global pthread_attr_init\n" + ".type pthread_attr_init @function\n" + "pthread_attr_init:\n"); + +asm(".global pthread_attr_setaffinity_np\n" + ".type pthread_attr_setaffinity_np @function\n" + "pthread_attr_setaffinity_np:\n"); + +asm(".global pthread_attr_setcreatesuspend_np\n" + ".type pthread_attr_setcreatesuspend_np @function\n" + "pthread_attr_setcreatesuspend_np:\n"); + +asm(".global pthread_attr_setdetachstate\n" + ".type pthread_attr_setdetachstate @function\n" + "pthread_attr_setdetachstate:\n"); + +asm(".global pthread_attr_setguardsize\n" + ".type pthread_attr_setguardsize @function\n" + "pthread_attr_setguardsize:\n"); + +asm(".global pthread_attr_setinheritsched\n" + ".type pthread_attr_setinheritsched @function\n" + "pthread_attr_setinheritsched:\n"); + +asm(".global pthread_attr_setschedparam\n" + ".type pthread_attr_setschedparam @function\n" + "pthread_attr_setschedparam:\n"); + +asm(".global pthread_attr_setschedpolicy\n" + ".type pthread_attr_setschedpolicy @function\n" + "pthread_attr_setschedpolicy:\n"); + +asm(".global pthread_attr_setscope\n" + ".type pthread_attr_setscope @function\n" + "pthread_attr_setscope:\n"); + +asm(".global pthread_attr_setsolosched_np\n" + ".type pthread_attr_setsolosched_np @function\n" + "pthread_attr_setsolosched_np:\n"); + +asm(".global pthread_attr_setstack\n" + ".type pthread_attr_setstack @function\n" + "pthread_attr_setstack:\n"); + +asm(".global pthread_attr_setstackaddr\n" + ".type pthread_attr_setstackaddr @function\n" + "pthread_attr_setstackaddr:\n"); + +asm(".global pthread_attr_setstacksize\n" + ".type pthread_attr_setstacksize @function\n" + "pthread_attr_setstacksize:\n"); + +asm(".global pthread_barrier_destroy\n" + ".type pthread_barrier_destroy @function\n" + "pthread_barrier_destroy:\n"); + +asm(".global pthread_barrier_init\n" + ".type pthread_barrier_init @function\n" + "pthread_barrier_init:\n"); + +asm(".global pthread_barrier_setname_np\n" + ".type pthread_barrier_setname_np @function\n" + "pthread_barrier_setname_np:\n"); + +asm(".global pthread_barrier_wait\n" + ".type pthread_barrier_wait @function\n" + "pthread_barrier_wait:\n"); + +asm(".global pthread_barrierattr_destroy\n" + ".type pthread_barrierattr_destroy @function\n" + "pthread_barrierattr_destroy:\n"); + +asm(".global pthread_barrierattr_getpshared\n" + ".type pthread_barrierattr_getpshared @function\n" + "pthread_barrierattr_getpshared:\n"); + +asm(".global pthread_barrierattr_init\n" + ".type pthread_barrierattr_init @function\n" + "pthread_barrierattr_init:\n"); + +asm(".global pthread_barrierattr_setpshared\n" + ".type pthread_barrierattr_setpshared @function\n" + "pthread_barrierattr_setpshared:\n"); + +asm(".global pthread_cancel\n" + ".type pthread_cancel @function\n" + "pthread_cancel:\n"); + +asm(".global pthread_cleanup_pop\n" + ".type pthread_cleanup_pop @function\n" + "pthread_cleanup_pop:\n"); + +asm(".global pthread_cleanup_push\n" + ".type pthread_cleanup_push @function\n" + "pthread_cleanup_push:\n"); + +asm(".global pthread_cond_broadcast\n" + ".type pthread_cond_broadcast @function\n" + "pthread_cond_broadcast:\n"); + +asm(".global pthread_cond_destroy\n" + ".type pthread_cond_destroy @function\n" + "pthread_cond_destroy:\n"); + +asm(".global pthread_cond_init\n" + ".type pthread_cond_init @function\n" + "pthread_cond_init:\n"); + +asm(".global pthread_cond_reltimedwait_np\n" + ".type pthread_cond_reltimedwait_np @function\n" + "pthread_cond_reltimedwait_np:\n"); + +asm(".global pthread_cond_setname_np\n" + ".type pthread_cond_setname_np @function\n" + "pthread_cond_setname_np:\n"); + +asm(".global pthread_cond_signal\n" + ".type pthread_cond_signal @function\n" + "pthread_cond_signal:\n"); + +asm(".global pthread_cond_signalto_np\n" + ".type pthread_cond_signalto_np @function\n" + "pthread_cond_signalto_np:\n"); + +asm(".global pthread_cond_timedwait\n" + ".type pthread_cond_timedwait @function\n" + "pthread_cond_timedwait:\n"); + +asm(".global pthread_cond_wait\n" + ".type pthread_cond_wait @function\n" + "pthread_cond_wait:\n"); + +asm(".global pthread_condattr_destroy\n" + ".type pthread_condattr_destroy @function\n" + "pthread_condattr_destroy:\n"); + +asm(".global pthread_condattr_getclock\n" + ".type pthread_condattr_getclock @function\n" + "pthread_condattr_getclock:\n"); + +asm(".global pthread_condattr_getpshared\n" + ".type pthread_condattr_getpshared @function\n" + "pthread_condattr_getpshared:\n"); + +asm(".global pthread_condattr_init\n" + ".type pthread_condattr_init @function\n" + "pthread_condattr_init:\n"); + +asm(".global pthread_condattr_setclock\n" + ".type pthread_condattr_setclock @function\n" + "pthread_condattr_setclock:\n"); + +asm(".global pthread_condattr_setpshared\n" + ".type pthread_condattr_setpshared @function\n" + "pthread_condattr_setpshared:\n"); + +asm(".global pthread_create\n" + ".type pthread_create @function\n" + "pthread_create:\n"); + +asm(".global pthread_create_name_np\n" + ".type pthread_create_name_np @function\n" + "pthread_create_name_np:\n"); + +asm(".global pthread_detach\n" + ".type pthread_detach @function\n" + "pthread_detach:\n"); + +asm(".global pthread_equal\n" + ".type pthread_equal @function\n" + "pthread_equal:\n"); + +asm(".global pthread_exit\n" + ".type pthread_exit @function\n" + "pthread_exit:\n"); + +asm(".global pthread_get_specificarray_np\n" + ".type pthread_get_specificarray_np @function\n" + "pthread_get_specificarray_np:\n"); + +asm(".global pthread_get_user_context_np\n" + ".type pthread_get_user_context_np @function\n" + "pthread_get_user_context_np:\n"); + +asm(".global pthread_getaffinity_np\n" + ".type pthread_getaffinity_np @function\n" + "pthread_getaffinity_np:\n"); + +asm(".global pthread_getconcurrency\n" + ".type pthread_getconcurrency @function\n" + "pthread_getconcurrency:\n"); + +asm(".global pthread_getcpuclockid\n" + ".type pthread_getcpuclockid @function\n" + "pthread_getcpuclockid:\n"); + +asm(".global pthread_getname_np\n" + ".type pthread_getname_np @function\n" + "pthread_getname_np:\n"); + +asm(".global pthread_getprio\n" + ".type pthread_getprio @function\n" + "pthread_getprio:\n"); + +asm(".global pthread_getschedparam\n" + ".type pthread_getschedparam @function\n" + "pthread_getschedparam:\n"); + +asm(".global pthread_getspecific\n" + ".type pthread_getspecific @function\n" + "pthread_getspecific:\n"); + +asm(".global pthread_getstack_np\n" + ".type pthread_getstack_np @function\n" + "pthread_getstack_np:\n"); + +asm(".global pthread_getthreadid_np\n" + ".type pthread_getthreadid_np @function\n" + "pthread_getthreadid_np:\n"); + +asm(".global pthread_join\n" + ".type pthread_join @function\n" + "pthread_join:\n"); + +asm(".global pthread_key_create\n" + ".type pthread_key_create @function\n" + "pthread_key_create:\n"); + +asm(".global pthread_key_delete\n" + ".type pthread_key_delete @function\n" + "pthread_key_delete:\n"); + +asm(".global pthread_kill\n" + ".type pthread_kill @function\n" + "pthread_kill:\n"); + +asm(".global pthread_main_np\n" + ".type pthread_main_np @function\n" + "pthread_main_np:\n"); + +asm(".global pthread_multi_np\n" + ".type pthread_multi_np @function\n" + "pthread_multi_np:\n"); + +asm(".global pthread_mutex_destroy\n" + ".type pthread_mutex_destroy @function\n" + "pthread_mutex_destroy:\n"); + +asm(".global pthread_mutex_getprioceiling\n" + ".type pthread_mutex_getprioceiling @function\n" + "pthread_mutex_getprioceiling:\n"); + +asm(".global pthread_mutex_getspinloops_np\n" + ".type pthread_mutex_getspinloops_np @function\n" + "pthread_mutex_getspinloops_np:\n"); + +asm(".global pthread_mutex_getyieldloops_np\n" + ".type pthread_mutex_getyieldloops_np @function\n" + "pthread_mutex_getyieldloops_np:\n"); + +asm(".global pthread_mutex_init\n" + ".type pthread_mutex_init @function\n" + "pthread_mutex_init:\n"); + +asm(".global pthread_mutex_init_for_mono\n" + ".type pthread_mutex_init_for_mono @function\n" + "pthread_mutex_init_for_mono:\n"); + +asm(".global pthread_mutex_isowned_np\n" + ".type pthread_mutex_isowned_np @function\n" + "pthread_mutex_isowned_np:\n"); + +asm(".global pthread_mutex_lock\n" + ".type pthread_mutex_lock @function\n" + "pthread_mutex_lock:\n"); + +asm(".global pthread_mutex_reltimedlock_np\n" + ".type pthread_mutex_reltimedlock_np @function\n" + "pthread_mutex_reltimedlock_np:\n"); + +asm(".global pthread_mutex_setname_np\n" + ".type pthread_mutex_setname_np @function\n" + "pthread_mutex_setname_np:\n"); + +asm(".global pthread_mutex_setprioceiling\n" + ".type pthread_mutex_setprioceiling @function\n" + "pthread_mutex_setprioceiling:\n"); + +asm(".global pthread_mutex_setspinloops_np\n" + ".type pthread_mutex_setspinloops_np @function\n" + "pthread_mutex_setspinloops_np:\n"); + +asm(".global pthread_mutex_setyieldloops_np\n" + ".type pthread_mutex_setyieldloops_np @function\n" + "pthread_mutex_setyieldloops_np:\n"); + +asm(".global pthread_mutex_timedlock\n" + ".type pthread_mutex_timedlock @function\n" + "pthread_mutex_timedlock:\n"); + +asm(".global pthread_mutex_trylock\n" + ".type pthread_mutex_trylock @function\n" + "pthread_mutex_trylock:\n"); + +asm(".global pthread_mutex_unlock\n" + ".type pthread_mutex_unlock @function\n" + "pthread_mutex_unlock:\n"); + +asm(".global pthread_mutexattr_destroy\n" + ".type pthread_mutexattr_destroy @function\n" + "pthread_mutexattr_destroy:\n"); + +asm(".global pthread_mutexattr_getgen_np\n" + ".type pthread_mutexattr_getgen_np @function\n" + "pthread_mutexattr_getgen_np:\n"); + +asm(".global pthread_mutexattr_getkind_np\n" + ".type pthread_mutexattr_getkind_np @function\n" + "pthread_mutexattr_getkind_np:\n"); + +asm(".global pthread_mutexattr_getprioceiling\n" + ".type pthread_mutexattr_getprioceiling @function\n" + "pthread_mutexattr_getprioceiling:\n"); + +asm(".global pthread_mutexattr_getprotocol\n" + ".type pthread_mutexattr_getprotocol @function\n" + "pthread_mutexattr_getprotocol:\n"); + +asm(".global pthread_mutexattr_getpshared\n" + ".type pthread_mutexattr_getpshared @function\n" + "pthread_mutexattr_getpshared:\n"); + +asm(".global pthread_mutexattr_gettype\n" + ".type pthread_mutexattr_gettype @function\n" + "pthread_mutexattr_gettype:\n"); + +asm(".global pthread_mutexattr_init\n" + ".type pthread_mutexattr_init @function\n" + "pthread_mutexattr_init:\n"); + +asm(".global pthread_mutexattr_setgen_np\n" + ".type pthread_mutexattr_setgen_np @function\n" + "pthread_mutexattr_setgen_np:\n"); + +asm(".global pthread_mutexattr_setkind_np\n" + ".type pthread_mutexattr_setkind_np @function\n" + "pthread_mutexattr_setkind_np:\n"); + +asm(".global pthread_mutexattr_setprioceiling\n" + ".type pthread_mutexattr_setprioceiling @function\n" + "pthread_mutexattr_setprioceiling:\n"); + +asm(".global pthread_mutexattr_setprotocol\n" + ".type pthread_mutexattr_setprotocol @function\n" + "pthread_mutexattr_setprotocol:\n"); + +asm(".global pthread_mutexattr_setpshared\n" + ".type pthread_mutexattr_setpshared @function\n" + "pthread_mutexattr_setpshared:\n"); + +asm(".global pthread_mutexattr_settype\n" + ".type pthread_mutexattr_settype @function\n" + "pthread_mutexattr_settype:\n"); + +asm(".global pthread_once\n" + ".type pthread_once @function\n" + "pthread_once:\n"); + +asm(".global pthread_rename_np\n" + ".type pthread_rename_np @function\n" + "pthread_rename_np:\n"); + +asm(".global pthread_resume_all_np\n" + ".type pthread_resume_all_np @function\n" + "pthread_resume_all_np:\n"); + +asm(".global pthread_resume_np\n" + ".type pthread_resume_np @function\n" + "pthread_resume_np:\n"); + +asm(".global pthread_resume_user_context_np\n" + ".type pthread_resume_user_context_np @function\n" + "pthread_resume_user_context_np:\n"); + +asm(".global pthread_rwlock_destroy\n" + ".type pthread_rwlock_destroy @function\n" + "pthread_rwlock_destroy:\n"); + +asm(".global pthread_rwlock_init\n" + ".type pthread_rwlock_init @function\n" + "pthread_rwlock_init:\n"); + +asm(".global pthread_rwlock_rdlock\n" + ".type pthread_rwlock_rdlock @function\n" + "pthread_rwlock_rdlock:\n"); + +asm(".global pthread_rwlock_reltimedrdlock_np\n" + ".type pthread_rwlock_reltimedrdlock_np @function\n" + "pthread_rwlock_reltimedrdlock_np:\n"); + +asm(".global pthread_rwlock_reltimedwrlock_np\n" + ".type pthread_rwlock_reltimedwrlock_np @function\n" + "pthread_rwlock_reltimedwrlock_np:\n"); + +asm(".global pthread_rwlock_setname_np\n" + ".type pthread_rwlock_setname_np @function\n" + "pthread_rwlock_setname_np:\n"); + +asm(".global pthread_rwlock_timedrdlock\n" + ".type pthread_rwlock_timedrdlock @function\n" + "pthread_rwlock_timedrdlock:\n"); + +asm(".global pthread_rwlock_timedwrlock\n" + ".type pthread_rwlock_timedwrlock @function\n" + "pthread_rwlock_timedwrlock:\n"); + +asm(".global pthread_rwlock_tryrdlock\n" + ".type pthread_rwlock_tryrdlock @function\n" + "pthread_rwlock_tryrdlock:\n"); + +asm(".global pthread_rwlock_trywrlock\n" + ".type pthread_rwlock_trywrlock @function\n" + "pthread_rwlock_trywrlock:\n"); + +asm(".global pthread_rwlock_unlock\n" + ".type pthread_rwlock_unlock @function\n" + "pthread_rwlock_unlock:\n"); + +asm(".global pthread_rwlock_wrlock\n" + ".type pthread_rwlock_wrlock @function\n" + "pthread_rwlock_wrlock:\n"); + +asm(".global pthread_rwlockattr_destroy\n" + ".type pthread_rwlockattr_destroy @function\n" + "pthread_rwlockattr_destroy:\n"); + +asm(".global pthread_rwlockattr_getpshared\n" + ".type pthread_rwlockattr_getpshared @function\n" + "pthread_rwlockattr_getpshared:\n"); + +asm(".global pthread_rwlockattr_gettype_np\n" + ".type pthread_rwlockattr_gettype_np @function\n" + "pthread_rwlockattr_gettype_np:\n"); + +asm(".global pthread_rwlockattr_init\n" + ".type pthread_rwlockattr_init @function\n" + "pthread_rwlockattr_init:\n"); + +asm(".global pthread_rwlockattr_setpshared\n" + ".type pthread_rwlockattr_setpshared @function\n" + "pthread_rwlockattr_setpshared:\n"); + +asm(".global pthread_rwlockattr_settype_np\n" + ".type pthread_rwlockattr_settype_np @function\n" + "pthread_rwlockattr_settype_np:\n"); + +asm(".global pthread_self\n" + ".type pthread_self @function\n" + "pthread_self:\n"); + +asm(".global pthread_set_defaultstacksize_np\n" + ".type pthread_set_defaultstacksize_np @function\n" + "pthread_set_defaultstacksize_np:\n"); + +asm(".global pthread_set_name_np\n" + ".type pthread_set_name_np @function\n" + "pthread_set_name_np:\n"); + +asm(".global pthread_set_user_context_np\n" + ".type pthread_set_user_context_np @function\n" + "pthread_set_user_context_np:\n"); + +asm(".global pthread_setaffinity_np\n" + ".type pthread_setaffinity_np @function\n" + "pthread_setaffinity_np:\n"); + +asm(".global pthread_setcancelstate\n" + ".type pthread_setcancelstate @function\n" + "pthread_setcancelstate:\n"); + +asm(".global pthread_setcanceltype\n" + ".type pthread_setcanceltype @function\n" + "pthread_setcanceltype:\n"); + +asm(".global pthread_setconcurrency\n" + ".type pthread_setconcurrency @function\n" + "pthread_setconcurrency:\n"); + +asm(".global pthread_setprio\n" + ".type pthread_setprio @function\n" + "pthread_setprio:\n"); + +asm(".global pthread_setschedparam\n" + ".type pthread_setschedparam @function\n" + "pthread_setschedparam:\n"); + +asm(".global pthread_setspecific\n" + ".type pthread_setspecific @function\n" + "pthread_setspecific:\n"); + +asm(".global pthread_sigmask\n" + ".type pthread_sigmask @function\n" + "pthread_sigmask:\n"); + +asm(".global pthread_single_np\n" + ".type pthread_single_np @function\n" + "pthread_single_np:\n"); + +asm(".global pthread_spin_destroy\n" + ".type pthread_spin_destroy @function\n" + "pthread_spin_destroy:\n"); + +asm(".global pthread_spin_init\n" + ".type pthread_spin_init @function\n" + "pthread_spin_init:\n"); + +asm(".global pthread_spin_lock\n" + ".type pthread_spin_lock @function\n" + "pthread_spin_lock:\n"); + +asm(".global pthread_spin_trylock\n" + ".type pthread_spin_trylock @function\n" + "pthread_spin_trylock:\n"); + +asm(".global pthread_spin_unlock\n" + ".type pthread_spin_unlock @function\n" + "pthread_spin_unlock:\n"); + +asm(".global pthread_suspend_all_np\n" + ".type pthread_suspend_all_np @function\n" + "pthread_suspend_all_np:\n"); + +asm(".global pthread_suspend_np\n" + ".type pthread_suspend_np @function\n" + "pthread_suspend_np:\n"); + +asm(".global pthread_suspend_user_context_np\n" + ".type pthread_suspend_user_context_np @function\n" + "pthread_suspend_user_context_np:\n"); + +asm(".global pthread_switch_add_np\n" + ".type pthread_switch_add_np @function\n" + "pthread_switch_add_np:\n"); + +asm(".global pthread_switch_delete_np\n" + ".type pthread_switch_delete_np @function\n" + "pthread_switch_delete_np:\n"); + +asm(".global pthread_testcancel\n" + ".type pthread_testcancel @function\n" + "pthread_testcancel:\n"); + +asm(".global pthread_timedjoin_np\n" + ".type pthread_timedjoin_np @function\n" + "pthread_timedjoin_np:\n"); + +asm(".global pthread_yield\n" + ".type pthread_yield @function\n" + "pthread_yield:\n"); + +asm(".global ptrace\n" + ".type ptrace @function\n" + "ptrace:\n"); + +asm(".global pwrite\n" + ".type pwrite @function\n" + "pwrite:\n"); + +asm(".global pwritev\n" + ".type pwritev @function\n" + "pwritev:\n"); + +asm(".global raise\n" + ".type raise @function\n" + "raise:\n"); + +asm(".global read\n" + ".type read @function\n" + "read:\n"); + +asm(".global readlink\n" + ".type readlink @function\n" + "readlink:\n"); + +asm(".global readv\n" + ".type readv @function\n" + "readv:\n"); + +asm(".global reboot\n" + ".type reboot @function\n" + "reboot:\n"); + +asm(".global recv\n" + ".type recv @function\n" + "recv:\n"); + +asm(".global recvfrom\n" + ".type recvfrom @function\n" + "recvfrom:\n"); + +asm(".global recvmsg\n" + ".type recvmsg @function\n" + "recvmsg:\n"); + +asm(".global rename\n" + ".type rename @function\n" + "rename:\n"); + +asm(".global renameat\n" + ".type renameat @function\n" + "renameat:\n"); + +asm(".global revoke\n" + ".type revoke @function\n" + "revoke:\n"); + +asm(".global rfork_thread\n" + ".type rfork_thread @function\n" + "rfork_thread:\n"); + +asm(".global rmdir\n" + ".type rmdir @function\n" + "rmdir:\n"); + +asm(".global rtld_printf\n" + ".type rtld_printf @function\n" + "rtld_printf:\n"); + +asm(".global rtprio_thread\n" + ".type rtprio_thread @function\n" + "rtprio_thread:\n"); + +asm(".global sceCoredumpAttachMemoryRegion\n" + ".type sceCoredumpAttachMemoryRegion @function\n" + "sceCoredumpAttachMemoryRegion:\n"); + +asm(".global sceCoredumpAttachMemoryRegionAsUserFile\n" + ".type sceCoredumpAttachMemoryRegionAsUserFile @function\n" + "sceCoredumpAttachMemoryRegionAsUserFile:\n"); + +asm(".global sceCoredumpAttachUserFile\n" + ".type sceCoredumpAttachUserFile @function\n" + "sceCoredumpAttachUserFile:\n"); + +asm(".global sceCoredumpAttachUserMemoryFile\n" + ".type sceCoredumpAttachUserMemoryFile @function\n" + "sceCoredumpAttachUserMemoryFile:\n"); + +asm(".global sceCoredumpConfigDumpMode\n" + ".type sceCoredumpConfigDumpMode @function\n" + "sceCoredumpConfigDumpMode:\n"); + +asm(".global sceCoredumpDebugForceCoredumpOnAppClose\n" + ".type sceCoredumpDebugForceCoredumpOnAppClose @function\n" + "sceCoredumpDebugForceCoredumpOnAppClose:\n"); + +asm(".global sceCoredumpDebugTextOut\n" + ".type sceCoredumpDebugTextOut @function\n" + "sceCoredumpDebugTextOut:\n"); + +asm(".global sceCoredumpDebugTriggerCoredump\n" + ".type sceCoredumpDebugTriggerCoredump @function\n" + "sceCoredumpDebugTriggerCoredump:\n"); + +asm(".global sceCoredumpGetStopInfoCpu\n" + ".type sceCoredumpGetStopInfoCpu @function\n" + "sceCoredumpGetStopInfoCpu:\n"); + +asm(".global sceCoredumpGetStopInfoGpu\n" + ".type sceCoredumpGetStopInfoGpu @function\n" + "sceCoredumpGetStopInfoGpu:\n"); + +asm(".global sceCoredumpGetThreadContextInfo\n" + ".type sceCoredumpGetThreadContextInfo @function\n" + "sceCoredumpGetThreadContextInfo:\n"); + +asm(".global sceCoredumpInternalGetThreadContextInfo\n" + ".type sceCoredumpInternalGetThreadContextInfo @function\n" + "sceCoredumpInternalGetThreadContextInfo:\n"); + +asm(".global sceCoredumpRegisterCoredumpHandler\n" + ".type sceCoredumpRegisterCoredumpHandler @function\n" + "sceCoredumpRegisterCoredumpHandler:\n"); + +asm(".global sceCoredumpSetUserDataType\n" + ".type sceCoredumpSetUserDataType @function\n" + "sceCoredumpSetUserDataType:\n"); + +asm(".global sceCoredumpUnregisterCoredumpHandler\n" + ".type sceCoredumpUnregisterCoredumpHandler @function\n" + "sceCoredumpUnregisterCoredumpHandler:\n"); + +asm(".global sceCoredumpWriteUserData\n" + ".type sceCoredumpWriteUserData @function\n" + "sceCoredumpWriteUserData:\n"); + +asm(".global sceKernelAddACInfo\n" + ".type sceKernelAddACInfo @function\n" + "sceKernelAddACInfo:\n"); + +asm(".global sceKernelAddAmprEvent\n" + ".type sceKernelAddAmprEvent @function\n" + "sceKernelAddAmprEvent:\n"); + +asm(".global sceKernelAddAmprSystemEvent\n" + ".type sceKernelAddAmprSystemEvent @function\n" + "sceKernelAddAmprSystemEvent:\n"); + +asm(".global sceKernelAddCpumodeEvent\n" + ".type sceKernelAddCpumodeEvent @function\n" + "sceKernelAddCpumodeEvent:\n"); + +asm(".global sceKernelAddFileEvent\n" + ".type sceKernelAddFileEvent @function\n" + "sceKernelAddFileEvent:\n"); + +asm(".global sceKernelAddGpuExceptionEvent\n" + ".type sceKernelAddGpuExceptionEvent @function\n" + "sceKernelAddGpuExceptionEvent:\n"); + +asm(".global sceKernelAddHRTimerEvent\n" + ".type sceKernelAddHRTimerEvent @function\n" + "sceKernelAddHRTimerEvent:\n"); + +asm(".global sceKernelAddProcessToCanvasMap\n" + ".type sceKernelAddProcessToCanvasMap @function\n" + "sceKernelAddProcessToCanvasMap:\n"); + +asm(".global sceKernelAddReadEvent\n" + ".type sceKernelAddReadEvent @function\n" + "sceKernelAddReadEvent:\n"); + +asm(".global sceKernelAddResource\n" + ".type sceKernelAddResource @function\n" + "sceKernelAddResource:\n"); + +asm(".global sceKernelAddTimerEvent\n" + ".type sceKernelAddTimerEvent @function\n" + "sceKernelAddTimerEvent:\n"); + +asm(".global sceKernelAddUserEvent\n" + ".type sceKernelAddUserEvent @function\n" + "sceKernelAddUserEvent:\n"); + +asm(".global sceKernelAddUserEventEdge\n" + ".type sceKernelAddUserEventEdge @function\n" + "sceKernelAddUserEventEdge:\n"); + +asm(".global sceKernelAddWriteEvent\n" + ".type sceKernelAddWriteEvent @function\n" + "sceKernelAddWriteEvent:\n"); + +asm(".global sceKernelAioCancelRequest\n" + ".type sceKernelAioCancelRequest @function\n" + "sceKernelAioCancelRequest:\n"); + +asm(".global sceKernelAioCancelRequests\n" + ".type sceKernelAioCancelRequests @function\n" + "sceKernelAioCancelRequests:\n"); + +asm(".global sceKernelAioDeleteRequest\n" + ".type sceKernelAioDeleteRequest @function\n" + "sceKernelAioDeleteRequest:\n"); + +asm(".global sceKernelAioDeleteRequests\n" + ".type sceKernelAioDeleteRequests @function\n" + "sceKernelAioDeleteRequests:\n"); + +asm(".global sceKernelAioInitializeImpl\n" + ".type sceKernelAioInitializeImpl @function\n" + "sceKernelAioInitializeImpl:\n"); + +asm(".global sceKernelAioInitializeParam\n" + ".type sceKernelAioInitializeParam @function\n" + "sceKernelAioInitializeParam:\n"); + +asm(".global sceKernelAioPollRequest\n" + ".type sceKernelAioPollRequest @function\n" + "sceKernelAioPollRequest:\n"); + +asm(".global sceKernelAioPollRequests\n" + ".type sceKernelAioPollRequests @function\n" + "sceKernelAioPollRequests:\n"); + +asm(".global sceKernelAioSetParam\n" + ".type sceKernelAioSetParam @function\n" + "sceKernelAioSetParam:\n"); + +asm(".global sceKernelAioSubmitReadCommands\n" + ".type sceKernelAioSubmitReadCommands @function\n" + "sceKernelAioSubmitReadCommands:\n"); + +asm(".global sceKernelAioSubmitReadCommandsMultiple\n" + ".type sceKernelAioSubmitReadCommandsMultiple @function\n" + "sceKernelAioSubmitReadCommandsMultiple:\n"); + +asm(".global sceKernelAioSubmitWriteCommands\n" + ".type sceKernelAioSubmitWriteCommands @function\n" + "sceKernelAioSubmitWriteCommands:\n"); + +asm(".global sceKernelAioSubmitWriteCommandsMultiple\n" + ".type sceKernelAioSubmitWriteCommandsMultiple @function\n" + "sceKernelAioSubmitWriteCommandsMultiple:\n"); + +asm(".global sceKernelAioWaitRequest\n" + ".type sceKernelAioWaitRequest @function\n" + "sceKernelAioWaitRequest:\n"); + +asm(".global sceKernelAioWaitRequests\n" + ".type sceKernelAioWaitRequests @function\n" + "sceKernelAioWaitRequests:\n"); + +asm(".global sceKernelAllocateDirectMemory\n" + ".type sceKernelAllocateDirectMemory @function\n" + "sceKernelAllocateDirectMemory:\n"); + +asm(".global sceKernelAllocateDirectMemory2\n" + ".type sceKernelAllocateDirectMemory2 @function\n" + "sceKernelAllocateDirectMemory2:\n"); + +asm(".global sceKernelAllocateDirectMemoryForApp\n" + ".type sceKernelAllocateDirectMemoryForApp @function\n" + "sceKernelAllocateDirectMemoryForApp:\n"); + +asm(".global sceKernelAllocateDirectMemoryForMiniApp\n" + ".type sceKernelAllocateDirectMemoryForMiniApp @function\n" + "sceKernelAllocateDirectMemoryForMiniApp:\n"); + +asm(".global sceKernelAllocateMainDirectMemory\n" + ".type sceKernelAllocateMainDirectMemory @function\n" + "sceKernelAllocateMainDirectMemory:\n"); + +asm(".global sceKernelAllocateToolMemory\n" + ".type sceKernelAllocateToolMemory @function\n" + "sceKernelAllocateToolMemory:\n"); + +asm(".global sceKernelAllocateTraceDirectMemory\n" + ".type sceKernelAllocateTraceDirectMemory @function\n" + "sceKernelAllocateTraceDirectMemory:\n"); + +asm(".global sceKernelAprCtrl\n" + ".type sceKernelAprCtrl @function\n" + "sceKernelAprCtrl:\n"); + +asm(".global sceKernelAprGetFileSize\n" + ".type sceKernelAprGetFileSize @function\n" + "sceKernelAprGetFileSize:\n"); + +asm(".global sceKernelAprGetFileStat\n" + ".type sceKernelAprGetFileStat @function\n" + "sceKernelAprGetFileStat:\n"); + +asm(".global sceKernelAprResolveFilepathsToIds\n" + ".type sceKernelAprResolveFilepathsToIds @function\n" + "sceKernelAprResolveFilepathsToIds:\n"); + +asm(".global sceKernelAprResolveFilepathsToIdsAndFileSizes\n" + ".type sceKernelAprResolveFilepathsToIdsAndFileSizes @function\n" + "sceKernelAprResolveFilepathsToIdsAndFileSizes:\n"); + +asm(".global sceKernelAprResolveFilepathsToIdsAndFileSizesForEach\n" + ".type sceKernelAprResolveFilepathsToIdsAndFileSizesForEach @function\n" + "sceKernelAprResolveFilepathsToIdsAndFileSizesForEach:\n"); + +asm(".global sceKernelAprResolveFilepathsToIdsForEach\n" + ".type sceKernelAprResolveFilepathsToIdsForEach @function\n" + "sceKernelAprResolveFilepathsToIdsForEach:\n"); + +asm(".global sceKernelAprResolveFilepathsWithPrefixToIds\n" + ".type sceKernelAprResolveFilepathsWithPrefixToIds @function\n" + "sceKernelAprResolveFilepathsWithPrefixToIds:\n"); + +asm(".global sceKernelAprResolveFilepathsWithPrefixToIdsAndFileSizes\n" + ".type sceKernelAprResolveFilepathsWithPrefixToIdsAndFileSizes @function\n" + "sceKernelAprResolveFilepathsWithPrefixToIdsAndFileSizes:\n"); + +asm(".global sceKernelAprResolveFilepathsWithPrefixToIdsAndFileSizesForEach\n" + ".type sceKernelAprResolveFilepathsWithPrefixToIdsAndFileSizesForEach @function\n" + "sceKernelAprResolveFilepathsWithPrefixToIdsAndFileSizesForEach:\n"); + +asm(".global sceKernelAprResolveFilepathsWithPrefixToIdsForEach\n" + ".type sceKernelAprResolveFilepathsWithPrefixToIdsForEach @function\n" + "sceKernelAprResolveFilepathsWithPrefixToIdsForEach:\n"); + +asm(".global sceKernelAprSubmitCommandBuffer\n" + ".type sceKernelAprSubmitCommandBuffer @function\n" + "sceKernelAprSubmitCommandBuffer:\n"); + +asm(".global sceKernelAprSubmitCommandBufferAndGetId\n" + ".type sceKernelAprSubmitCommandBufferAndGetId @function\n" + "sceKernelAprSubmitCommandBufferAndGetId:\n"); + +asm(".global sceKernelAprSubmitCommandBufferAndGetResult\n" + ".type sceKernelAprSubmitCommandBufferAndGetResult @function\n" + "sceKernelAprSubmitCommandBufferAndGetResult:\n"); + +asm(".global sceKernelAprSubmitCommandBufferAndGetResult_TEST\n" + ".type sceKernelAprSubmitCommandBufferAndGetResult_TEST @function\n" + "sceKernelAprSubmitCommandBufferAndGetResult_TEST:\n"); + +asm(".global sceKernelAprSubmitCommandBuffer_TEST\n" + ".type sceKernelAprSubmitCommandBuffer_TEST @function\n" + "sceKernelAprSubmitCommandBuffer_TEST:\n"); + +asm(".global sceKernelAprWaitCommandBuffer\n" + ".type sceKernelAprWaitCommandBuffer @function\n" + "sceKernelAprWaitCommandBuffer:\n"); + +asm(".global sceKernelAvailableDirectMemorySize\n" + ".type sceKernelAvailableDirectMemorySize @function\n" + "sceKernelAvailableDirectMemorySize:\n"); + +asm(".global sceKernelAvailableFlexibleMemorySize\n" + ".type sceKernelAvailableFlexibleMemorySize @function\n" + "sceKernelAvailableFlexibleMemorySize:\n"); + +asm(".global sceKernelAvailableToolMemorySize\n" + ".type sceKernelAvailableToolMemorySize @function\n" + "sceKernelAvailableToolMemorySize:\n"); + +asm(".global sceKernelBacktraceSelf\n" + ".type sceKernelBacktraceSelf @function\n" + "sceKernelBacktraceSelf:\n"); + +asm(".global sceKernelBatchMap\n" + ".type sceKernelBatchMap @function\n" + "sceKernelBatchMap:\n"); + +asm(".global sceKernelBatchMap2\n" + ".type sceKernelBatchMap2 @function\n" + "sceKernelBatchMap2:\n"); + +asm(".global sceKernelBeginAppMount\n" + ".type sceKernelBeginAppMount @function\n" + "sceKernelBeginAppMount:\n"); + +asm(".global sceKernelBeginAppMount2\n" + ".type sceKernelBeginAppMount2 @function\n" + "sceKernelBeginAppMount2:\n"); + +asm(".global sceKernelCallIndirectBuffer\n" + ".type sceKernelCallIndirectBuffer @function\n" + "sceKernelCallIndirectBuffer:\n"); + +asm(".global sceKernelCallIndirectBuffer2\n" + ".type sceKernelCallIndirectBuffer2 @function\n" + "sceKernelCallIndirectBuffer2:\n"); + +asm(".global sceKernelCallIndirectBuffer3\n" + ".type sceKernelCallIndirectBuffer3 @function\n" + "sceKernelCallIndirectBuffer3:\n"); + +asm(".global sceKernelCancelEventFlag\n" + ".type sceKernelCancelEventFlag @function\n" + "sceKernelCancelEventFlag:\n"); + +asm(".global sceKernelCancelSema\n" + ".type sceKernelCancelSema @function\n" + "sceKernelCancelSema:\n"); + +asm(".global sceKernelCheckReachability\n" + ".type sceKernelCheckReachability @function\n" + "sceKernelCheckReachability:\n"); + +asm(".global sceKernelCheckedReleaseDirectMemory\n" + ".type sceKernelCheckedReleaseDirectMemory @function\n" + "sceKernelCheckedReleaseDirectMemory:\n"); + +asm(".global sceKernelChmod\n" + ".type sceKernelChmod @function\n" + "sceKernelChmod:\n"); + +asm(".global sceKernelClearBootReqNotifyCount\n" + ".type sceKernelClearBootReqNotifyCount @function\n" + "sceKernelClearBootReqNotifyCount:\n"); + +asm(".global sceKernelClearEventFlag\n" + ".type sceKernelClearEventFlag @function\n" + "sceKernelClearEventFlag:\n"); + +asm(".global sceKernelClearGameDirectMemory\n" + ".type sceKernelClearGameDirectMemory @function\n" + "sceKernelClearGameDirectMemory:\n"); + +asm(".global sceKernelClockGetres\n" + ".type sceKernelClockGetres @function\n" + "sceKernelClockGetres:\n"); + +asm(".global sceKernelClockGettime\n" + ".type sceKernelClockGettime @function\n" + "sceKernelClockGettime:\n"); + +asm(".global sceKernelClose\n" + ".type sceKernelClose @function\n" + "sceKernelClose:\n"); + +asm(".global sceKernelCloseEport\n" + ".type sceKernelCloseEport @function\n" + "sceKernelCloseEport:\n"); + +asm(".global sceKernelCloseEventFlag\n" + ".type sceKernelCloseEventFlag @function\n" + "sceKernelCloseEventFlag:\n"); + +asm(".global sceKernelCloseSema\n" + ".type sceKernelCloseSema @function\n" + "sceKernelCloseSema:\n"); + +asm(".global sceKernelConfiguredFlexibleMemorySize\n" + ".type sceKernelConfiguredFlexibleMemorySize @function\n" + "sceKernelConfiguredFlexibleMemorySize:\n"); + +asm(".global sceKernelConvertLocaltimeToUtc\n" + ".type sceKernelConvertLocaltimeToUtc @function\n" + "sceKernelConvertLocaltimeToUtc:\n"); + +asm(".global sceKernelConvertUtcToLocaltime\n" + ".type sceKernelConvertUtcToLocaltime @function\n" + "sceKernelConvertUtcToLocaltime:\n"); + +asm(".global sceKernelCreateBudget\n" + ".type sceKernelCreateBudget @function\n" + "sceKernelCreateBudget:\n"); + +asm(".global sceKernelCreateEport\n" + ".type sceKernelCreateEport @function\n" + "sceKernelCreateEport:\n"); + +asm(".global sceKernelCreateEqueue\n" + ".type sceKernelCreateEqueue @function\n" + "sceKernelCreateEqueue:\n"); + +asm(".global sceKernelCreateEventFlag\n" + ".type sceKernelCreateEventFlag @function\n" + "sceKernelCreateEventFlag:\n"); + +asm(".global sceKernelCreateSema\n" + ".type sceKernelCreateSema @function\n" + "sceKernelCreateSema:\n"); + +asm(".global sceKernelDebugAcquireAndUpdateDebugRegister\n" + ".type sceKernelDebugAcquireAndUpdateDebugRegister @function\n" + "sceKernelDebugAcquireAndUpdateDebugRegister:\n"); + +asm(".global sceKernelDebugGetAppStatus\n" + ".type sceKernelDebugGetAppStatus @function\n" + "sceKernelDebugGetAppStatus:\n"); + +asm(".global sceKernelDebugGetPauseCount\n" + ".type sceKernelDebugGetPauseCount @function\n" + "sceKernelDebugGetPauseCount:\n"); + +asm(".global sceKernelDebugGetPrivateLogText\n" + ".type sceKernelDebugGetPrivateLogText @function\n" + "sceKernelDebugGetPrivateLogText:\n"); + +asm(".global sceKernelDebugGetSchedLockMode\n" + ".type sceKernelDebugGetSchedLockMode @function\n" + "sceKernelDebugGetSchedLockMode:\n"); + +asm(".global sceKernelDebugGetSdkLogText\n" + ".type sceKernelDebugGetSdkLogText @function\n" + "sceKernelDebugGetSdkLogText:\n"); + +asm(".global sceKernelDebugGpuPaDebugIsInProgress\n" + ".type sceKernelDebugGpuPaDebugIsInProgress @function\n" + "sceKernelDebugGpuPaDebugIsInProgress:\n"); + +asm(".global sceKernelDebugInjectProcessEvent\n" + ".type sceKernelDebugInjectProcessEvent @function\n" + "sceKernelDebugInjectProcessEvent:\n"); + +asm(".global sceKernelDebugOutText\n" + ".type sceKernelDebugOutText @function\n" + "sceKernelDebugOutText:\n"); + +asm(".global sceKernelDebugPackageCorrupted\n" + ".type sceKernelDebugPackageCorrupted @function\n" + "sceKernelDebugPackageCorrupted:\n"); + +asm(".global sceKernelDebugRaiseException\n" + ".type sceKernelDebugRaiseException @function\n" + "sceKernelDebugRaiseException:\n"); + +asm(".global sceKernelDebugRaiseExceptionOnReleaseMode\n" + ".type sceKernelDebugRaiseExceptionOnReleaseMode @function\n" + "sceKernelDebugRaiseExceptionOnReleaseMode:\n"); + +asm(".global sceKernelDebugRaiseExceptionWithContext\n" + ".type sceKernelDebugRaiseExceptionWithContext @function\n" + "sceKernelDebugRaiseExceptionWithContext:\n"); + +asm(".global sceKernelDebugRaiseExceptionWithInfo\n" + ".type sceKernelDebugRaiseExceptionWithInfo @function\n" + "sceKernelDebugRaiseExceptionWithInfo:\n"); + +asm(".global sceKernelDebugReleaseDebugContext\n" + ".type sceKernelDebugReleaseDebugContext @function\n" + "sceKernelDebugReleaseDebugContext:\n"); + +asm(".global sceKernelDeleteACInfo\n" + ".type sceKernelDeleteACInfo @function\n" + "sceKernelDeleteACInfo:\n"); + +asm(".global sceKernelDeleteAmprEvent\n" + ".type sceKernelDeleteAmprEvent @function\n" + "sceKernelDeleteAmprEvent:\n"); + +asm(".global sceKernelDeleteAmprSystemEvent\n" + ".type sceKernelDeleteAmprSystemEvent @function\n" + "sceKernelDeleteAmprSystemEvent:\n"); + +asm(".global sceKernelDeleteBudget\n" + ".type sceKernelDeleteBudget @function\n" + "sceKernelDeleteBudget:\n"); + +asm(".global sceKernelDeleteCpumodeEvent\n" + ".type sceKernelDeleteCpumodeEvent @function\n" + "sceKernelDeleteCpumodeEvent:\n"); + +asm(".global sceKernelDeleteEport\n" + ".type sceKernelDeleteEport @function\n" + "sceKernelDeleteEport:\n"); + +asm(".global sceKernelDeleteEqueue\n" + ".type sceKernelDeleteEqueue @function\n" + "sceKernelDeleteEqueue:\n"); + +asm(".global sceKernelDeleteEventFlag\n" + ".type sceKernelDeleteEventFlag @function\n" + "sceKernelDeleteEventFlag:\n"); + +asm(".global sceKernelDeleteFileEvent\n" + ".type sceKernelDeleteFileEvent @function\n" + "sceKernelDeleteFileEvent:\n"); + +asm(".global sceKernelDeleteGpuExceptionEvent\n" + ".type sceKernelDeleteGpuExceptionEvent @function\n" + "sceKernelDeleteGpuExceptionEvent:\n"); + +asm(".global sceKernelDeleteHRTimerEvent\n" + ".type sceKernelDeleteHRTimerEvent @function\n" + "sceKernelDeleteHRTimerEvent:\n"); + +asm(".global sceKernelDeleteProcessFromCanvasMap\n" + ".type sceKernelDeleteProcessFromCanvasMap @function\n" + "sceKernelDeleteProcessFromCanvasMap:\n"); + +asm(".global sceKernelDeleteReadEvent\n" + ".type sceKernelDeleteReadEvent @function\n" + "sceKernelDeleteReadEvent:\n"); + +asm(".global sceKernelDeleteSavedApp\n" + ".type sceKernelDeleteSavedApp @function\n" + "sceKernelDeleteSavedApp:\n"); + +asm(".global sceKernelDeleteSema\n" + ".type sceKernelDeleteSema @function\n" + "sceKernelDeleteSema:\n"); + +asm(".global sceKernelDeleteTimerEvent\n" + ".type sceKernelDeleteTimerEvent @function\n" + "sceKernelDeleteTimerEvent:\n"); + +asm(".global sceKernelDeleteUserEvent\n" + ".type sceKernelDeleteUserEvent @function\n" + "sceKernelDeleteUserEvent:\n"); + +asm(".global sceKernelDeleteWriteEvent\n" + ".type sceKernelDeleteWriteEvent @function\n" + "sceKernelDeleteWriteEvent:\n"); + +asm(".global sceKernelDirectMemoryQuery\n" + ".type sceKernelDirectMemoryQuery @function\n" + "sceKernelDirectMemoryQuery:\n"); + +asm(".global sceKernelDirectMemoryQueryForId\n" + ".type sceKernelDirectMemoryQueryForId @function\n" + "sceKernelDirectMemoryQueryForId:\n"); + +asm(".global sceKernelDlsym\n" + ".type sceKernelDlsym @function\n" + "sceKernelDlsym:\n"); + +asm(".global sceKernelEnableDmemAliasing\n" + ".type sceKernelEnableDmemAliasing @function\n" + "sceKernelEnableDmemAliasing:\n"); + +asm(".global sceKernelEnableDmemAliasing2\n" + ".type sceKernelEnableDmemAliasing2 @function\n" + "sceKernelEnableDmemAliasing2:\n"); + +asm(".global sceKernelEnablePthreadObjectCheck\n" + ".type sceKernelEnablePthreadObjectCheck @function\n" + "sceKernelEnablePthreadObjectCheck:\n"); + +asm(".global sceKernelEndAppMount\n" + ".type sceKernelEndAppMount @function\n" + "sceKernelEndAppMount:\n"); + +asm(".global sceKernelEndAppMount2\n" + ".type sceKernelEndAppMount2 @function\n" + "sceKernelEndAppMount2:\n"); + +asm(".global sceKernelError\n" + ".type sceKernelError @function\n" + "sceKernelError:\n"); + +asm(".global sceKernelEventLogInit\n" + ".type sceKernelEventLogInit @function\n" + "sceKernelEventLogInit:\n"); + +asm(".global sceKernelEventLogPread\n" + ".type sceKernelEventLogPread @function\n" + "sceKernelEventLogPread:\n"); + +asm(".global sceKernelEventLogRead\n" + ".type sceKernelEventLogRead @function\n" + "sceKernelEventLogRead:\n"); + +asm(".global sceKernelEventLogWrite\n" + ".type sceKernelEventLogWrite @function\n" + "sceKernelEventLogWrite:\n"); + +asm(".global sceKernelExpectedHddFormat\n" + ".type sceKernelExpectedHddFormat @function\n" + "sceKernelExpectedHddFormat:\n"); + +asm(".global sceKernelFchmod\n" + ".type sceKernelFchmod @function\n" + "sceKernelFchmod:\n"); + +asm(".global sceKernelFcntl\n" + ".type sceKernelFcntl @function\n" + "sceKernelFcntl:\n"); + +asm(".global sceKernelFdatasync\n" + ".type sceKernelFdatasync @function\n" + "sceKernelFdatasync:\n"); + +asm(".global sceKernelFlock\n" + ".type sceKernelFlock @function\n" + "sceKernelFlock:\n"); + +asm(".global sceKernelFstat\n" + ".type sceKernelFstat @function\n" + "sceKernelFstat:\n"); + +asm(".global sceKernelFsync\n" + ".type sceKernelFsync @function\n" + "sceKernelFsync:\n"); + +asm(".global sceKernelFtruncate\n" + ".type sceKernelFtruncate @function\n" + "sceKernelFtruncate:\n"); + +asm(".global sceKernelFutimes\n" + ".type sceKernelFutimes @function\n" + "sceKernelFutimes:\n"); + +asm(".global sceKernelGetACInfoAllForCoredump\n" + ".type sceKernelGetACInfoAllForCoredump @function\n" + "sceKernelGetACInfoAllForCoredump:\n"); + +asm(".global sceKernelGetAllowedSdkVersionOnSystem\n" + ".type sceKernelGetAllowedSdkVersionOnSystem @function\n" + "sceKernelGetAllowedSdkVersionOnSystem:\n"); + +asm(".global sceKernelGetAppCategoryType\n" + ".type sceKernelGetAppCategoryType @function\n" + "sceKernelGetAppCategoryType:\n"); + +asm(".global sceKernelGetAppInfo\n" + ".type sceKernelGetAppInfo @function\n" + "sceKernelGetAppInfo:\n"); + +asm(".global sceKernelGetAppInfoByAppId\n" + ".type sceKernelGetAppInfoByAppId @function\n" + "sceKernelGetAppInfoByAppId:\n"); + +asm(".global sceKernelGetAppInfoListForMinisyscore\n" + ".type sceKernelGetAppInfoListForMinisyscore @function\n" + "sceKernelGetAppInfoListForMinisyscore:\n"); + +asm(".global sceKernelGetAppState\n" + ".type sceKernelGetAppState @function\n" + "sceKernelGetAppState:\n"); + +asm(".global sceKernelGetAslrStatus\n" + ".type sceKernelGetAslrStatus @function\n" + "sceKernelGetAslrStatus:\n"); + +asm(".global sceKernelGetAutoUpdateVersion\n" + ".type sceKernelGetAutoUpdateVersion @function\n" + "sceKernelGetAutoUpdateVersion:\n"); + +asm(".global sceKernelGetBackupRestoreMode\n" + ".type sceKernelGetBackupRestoreMode @function\n" + "sceKernelGetBackupRestoreMode:\n"); + +asm(".global sceKernelGetBackupRestoreModeOfNextBoot\n" + ".type sceKernelGetBackupRestoreModeOfNextBoot @function\n" + "sceKernelGetBackupRestoreModeOfNextBoot:\n"); + +asm(".global sceKernelGetBasicProductShape\n" + ".type sceKernelGetBasicProductShape @function\n" + "sceKernelGetBasicProductShape:\n"); + +asm(".global sceKernelGetBetaUpdateTestForRcmgr\n" + ".type sceKernelGetBetaUpdateTestForRcmgr @function\n" + "sceKernelGetBetaUpdateTestForRcmgr:\n"); + +asm(".global sceKernelGetBioUsageAll\n" + ".type sceKernelGetBioUsageAll @function\n" + "sceKernelGetBioUsageAll:\n"); + +asm(".global sceKernelGetBootReqNotifyCount\n" + ".type sceKernelGetBootReqNotifyCount @function\n" + "sceKernelGetBootReqNotifyCount:\n"); + +asm(".global sceKernelGetBudget\n" + ".type sceKernelGetBudget @function\n" + "sceKernelGetBudget:\n"); + +asm(".global sceKernelGetBuildNumber\n" + ".type sceKernelGetBuildNumber @function\n" + "sceKernelGetBuildNumber:\n"); + +asm(".global sceKernelGetCallRecord\n" + ".type sceKernelGetCallRecord @function\n" + "sceKernelGetCallRecord:\n"); + +asm(".global sceKernelGetChildApp\n" + ".type sceKernelGetChildApp @function\n" + "sceKernelGetChildApp:\n"); + +asm(".global sceKernelGetCompiledSdkVersion\n" + ".type sceKernelGetCompiledSdkVersion @function\n" + "sceKernelGetCompiledSdkVersion:\n"); + +asm(".global sceKernelGetCompiledSdkVersionByPath\n" + ".type sceKernelGetCompiledSdkVersionByPath @function\n" + "sceKernelGetCompiledSdkVersionByPath:\n"); + +asm(".global sceKernelGetCompiledSdkVersionByPid\n" + ".type sceKernelGetCompiledSdkVersionByPid @function\n" + "sceKernelGetCompiledSdkVersionByPid:\n"); + +asm(".global sceKernelGetCoredumpAppInfo\n" + ".type sceKernelGetCoredumpAppInfo @function\n" + "sceKernelGetCoredumpAppInfo:\n"); + +asm(".global sceKernelGetCpuCoreClock\n" + ".type sceKernelGetCpuCoreClock @function\n" + "sceKernelGetCpuCoreClock:\n"); + +asm(".global sceKernelGetCpuFrequency\n" + ".type sceKernelGetCpuFrequency @function\n" + "sceKernelGetCpuFrequency:\n"); + +asm(".global sceKernelGetCpuTemperature\n" + ".type sceKernelGetCpuTemperature @function\n" + "sceKernelGetCpuTemperature:\n"); + +asm(".global sceKernelGetCpuUsage\n" + ".type sceKernelGetCpuUsage @function\n" + "sceKernelGetCpuUsage:\n"); + +asm(".global sceKernelGetCpuUsageAll\n" + ".type sceKernelGetCpuUsageAll @function\n" + "sceKernelGetCpuUsageAll:\n"); + +asm(".global sceKernelGetCpuUsageProc\n" + ".type sceKernelGetCpuUsageProc @function\n" + "sceKernelGetCpuUsageProc:\n"); + +asm(".global sceKernelGetCpuUsageProc2\n" + ".type sceKernelGetCpuUsageProc2 @function\n" + "sceKernelGetCpuUsageProc2:\n"); + +asm(".global sceKernelGetCpuUsageThread\n" + ".type sceKernelGetCpuUsageThread @function\n" + "sceKernelGetCpuUsageThread:\n"); + +asm(".global sceKernelGetCpumode\n" + ".type sceKernelGetCpumode @function\n" + "sceKernelGetCpumode:\n"); + +asm(".global sceKernelGetCpumodeGame\n" + ".type sceKernelGetCpumodeGame @function\n" + "sceKernelGetCpumodeGame:\n"); + +asm(".global sceKernelGetCurrentCpu\n" + ".type sceKernelGetCurrentCpu @function\n" + "sceKernelGetCurrentCpu:\n"); + +asm(".global sceKernelGetCurrentFanDuty\n" + ".type sceKernelGetCurrentFanDuty @function\n" + "sceKernelGetCurrentFanDuty:\n"); + +asm(".global sceKernelGetDataTransferMode\n" + ".type sceKernelGetDataTransferMode @function\n" + "sceKernelGetDataTransferMode:\n"); + +asm(".global sceKernelGetDebugMenuMiniModeForRcmgr\n" + ".type sceKernelGetDebugMenuMiniModeForRcmgr @function\n" + "sceKernelGetDebugMenuMiniModeForRcmgr:\n"); + +asm(".global sceKernelGetDebugMenuModeForPsmForRcmgr\n" + ".type sceKernelGetDebugMenuModeForPsmForRcmgr @function\n" + "sceKernelGetDebugMenuModeForPsmForRcmgr:\n"); + +asm(".global sceKernelGetDebugMenuModeForRcmgr\n" + ".type sceKernelGetDebugMenuModeForRcmgr @function\n" + "sceKernelGetDebugMenuModeForRcmgr:\n"); + +asm(".global sceKernelGetDefaultToolMemorySize\n" + ".type sceKernelGetDefaultToolMemorySize @function\n" + "sceKernelGetDefaultToolMemorySize:\n"); + +asm(".global sceKernelGetDirectMemorySize\n" + ".type sceKernelGetDirectMemorySize @function\n" + "sceKernelGetDirectMemorySize:\n"); + +asm(".global sceKernelGetDirectMemoryType\n" + ".type sceKernelGetDirectMemoryType @function\n" + "sceKernelGetDirectMemoryType:\n"); + +asm(".global sceKernelGetEmergencyErrorLog\n" + ".type sceKernelGetEmergencyErrorLog @function\n" + "sceKernelGetEmergencyErrorLog:\n"); + +asm(".global sceKernelGetEventData\n" + ".type sceKernelGetEventData @function\n" + "sceKernelGetEventData:\n"); + +asm(".global sceKernelGetEventError\n" + ".type sceKernelGetEventError @function\n" + "sceKernelGetEventError:\n"); + +asm(".global sceKernelGetEventFflags\n" + ".type sceKernelGetEventFflags @function\n" + "sceKernelGetEventFflags:\n"); + +asm(".global sceKernelGetEventFilter\n" + ".type sceKernelGetEventFilter @function\n" + "sceKernelGetEventFilter:\n"); + +asm(".global sceKernelGetEventId\n" + ".type sceKernelGetEventId @function\n" + "sceKernelGetEventId:\n"); + +asm(".global sceKernelGetEventUserData\n" + ".type sceKernelGetEventUserData @function\n" + "sceKernelGetEventUserData:\n"); + +asm(".global sceKernelGetExecutableModuleHandle\n" + ".type sceKernelGetExecutableModuleHandle @function\n" + "sceKernelGetExecutableModuleHandle:\n"); + +asm(".global sceKernelGetExtLibcHandle\n" + ".type sceKernelGetExtLibcHandle @function\n" + "sceKernelGetExtLibcHandle:\n"); + +asm(".global sceKernelGetFakeFinalizeMenuForRcmgr\n" + ".type sceKernelGetFakeFinalizeMenuForRcmgr @function\n" + "sceKernelGetFakeFinalizeMenuForRcmgr:\n"); + +asm(".global sceKernelGetFirstImageAddr\n" + ".type sceKernelGetFirstImageAddr @function\n" + "sceKernelGetFirstImageAddr:\n"); + +asm(".global sceKernelGetFlagedUpdaterForRcmgr\n" + ".type sceKernelGetFlagedUpdaterForRcmgr @function\n" + "sceKernelGetFlagedUpdaterForRcmgr:\n"); + +asm(".global sceKernelGetForceUpdateModeForRcmgr\n" + ".type sceKernelGetForceUpdateModeForRcmgr @function\n" + "sceKernelGetForceUpdateModeForRcmgr:\n"); + +asm(".global sceKernelGetFsSandboxRandomWord\n" + ".type sceKernelGetFsSandboxRandomWord @function\n" + "sceKernelGetFsSandboxRandomWord:\n"); + +asm(".global sceKernelGetGPI\n" + ".type sceKernelGetGPI @function\n" + "sceKernelGetGPI:\n"); + +asm(".global sceKernelGetGPO\n" + ".type sceKernelGetGPO @function\n" + "sceKernelGetGPO:\n"); + +asm(".global sceKernelGetGenuineProsperoSystemSwVersion\n" + ".type sceKernelGetGenuineProsperoSystemSwVersion @function\n" + "sceKernelGetGenuineProsperoSystemSwVersion:\n"); + +asm(".global sceKernelGetHwFeatureInfoForDecid\n" + ".type sceKernelGetHwFeatureInfoForDecid @function\n" + "sceKernelGetHwFeatureInfoForDecid:\n"); + +asm(".global sceKernelGetHwModelName\n" + ".type sceKernelGetHwModelName @function\n" + "sceKernelGetHwModelName:\n"); + +asm(".global sceKernelGetHwSerialNumber\n" + ".type sceKernelGetHwSerialNumber @function\n" + "sceKernelGetHwSerialNumber:\n"); + +asm(".global sceKernelGetIdPs\n" + ".type sceKernelGetIdPs @function\n" + "sceKernelGetIdPs:\n"); + +asm(".global sceKernelGetIdTableCurrentCount\n" + ".type sceKernelGetIdTableCurrentCount @function\n" + "sceKernelGetIdTableCurrentCount:\n"); + +asm(".global sceKernelGetIoreq\n" + ".type sceKernelGetIoreq @function\n" + "sceKernelGetIoreq:\n"); + +asm(".global sceKernelGetIpcPath\n" + ".type sceKernelGetIpcPath @function\n" + "sceKernelGetIpcPath:\n"); + +asm(".global sceKernelGetKnobs\n" + ".type sceKernelGetKnobs @function\n" + "sceKernelGetKnobs:\n"); + +asm(".global sceKernelGetKqueueFromEqueue\n" + ".type sceKernelGetKqueueFromEqueue @function\n" + "sceKernelGetKqueueFromEqueue:\n"); + +asm(".global sceKernelGetLibkernelTextLocation\n" + ".type sceKernelGetLibkernelTextLocation @function\n" + "sceKernelGetLibkernelTextLocation:\n"); + +asm(".global sceKernelGetMainSocId\n" + ".type sceKernelGetMainSocId @function\n" + "sceKernelGetMainSocId:\n"); + +asm(".global sceKernelGetMemoryPstate\n" + ".type sceKernelGetMemoryPstate @function\n" + "sceKernelGetMemoryPstate:\n"); + +asm(".global sceKernelGetModuleInfo\n" + ".type sceKernelGetModuleInfo @function\n" + "sceKernelGetModuleInfo:\n"); + +asm(".global sceKernelGetModuleInfo2\n" + ".type sceKernelGetModuleInfo2 @function\n" + "sceKernelGetModuleInfo2:\n"); + +asm(".global sceKernelGetModuleInfoForUnwind\n" + ".type sceKernelGetModuleInfoForUnwind @function\n" + "sceKernelGetModuleInfoForUnwind:\n"); + +asm(".global sceKernelGetModuleInfoFromAddr\n" + ".type sceKernelGetModuleInfoFromAddr @function\n" + "sceKernelGetModuleInfoFromAddr:\n"); + +asm(".global sceKernelGetModuleInfoInternal\n" + ".type sceKernelGetModuleInfoInternal @function\n" + "sceKernelGetModuleInfoInternal:\n"); + +asm(".global sceKernelGetModuleList\n" + ".type sceKernelGetModuleList @function\n" + "sceKernelGetModuleList:\n"); + +asm(".global sceKernelGetModuleList2\n" + ".type sceKernelGetModuleList2 @function\n" + "sceKernelGetModuleList2:\n"); + +asm(".global sceKernelGetModuleListInternal\n" + ".type sceKernelGetModuleListInternal @function\n" + "sceKernelGetModuleListInternal:\n"); + +asm(".global sceKernelGetNandInfo\n" + ".type sceKernelGetNandInfo @function\n" + "sceKernelGetNandInfo:\n"); + +asm(".global sceKernelGetOpenPsId\n" + ".type sceKernelGetOpenPsId @function\n" + "sceKernelGetOpenPsId:\n"); + +asm(".global sceKernelGetOpenPsIdForSystem\n" + ".type sceKernelGetOpenPsIdForSystem @function\n" + "sceKernelGetOpenPsIdForSystem:\n"); + +asm(".global sceKernelGetPageTableStats\n" + ".type sceKernelGetPageTableStats @function\n" + "sceKernelGetPageTableStats:\n"); + +asm(".global sceKernelGetPagingStatsOfAllObjects\n" + ".type sceKernelGetPagingStatsOfAllObjects @function\n" + "sceKernelGetPagingStatsOfAllObjects:\n"); + +asm(".global sceKernelGetPagingStatsOfAllThreads\n" + ".type sceKernelGetPagingStatsOfAllThreads @function\n" + "sceKernelGetPagingStatsOfAllThreads:\n"); + +asm(".global sceKernelGetParentApp\n" + ".type sceKernelGetParentApp @function\n" + "sceKernelGetParentApp:\n"); + +asm(".global sceKernelGetPhysPageSize\n" + ".type sceKernelGetPhysPageSize @function\n" + "sceKernelGetPhysPageSize:\n"); + +asm(".global sceKernelGetPrefixVersion\n" + ".type sceKernelGetPrefixVersion @function\n" + "sceKernelGetPrefixVersion:\n"); + +asm(".global sceKernelGetProcParam\n" + ".type sceKernelGetProcParam @function\n" + "sceKernelGetProcParam:\n"); + +asm(".global sceKernelGetProcessAbiType\n" + ".type sceKernelGetProcessAbiType @function\n" + "sceKernelGetProcessAbiType:\n"); + +asm(".global sceKernelGetProcessName\n" + ".type sceKernelGetProcessName @function\n" + "sceKernelGetProcessName:\n"); + +asm(".global sceKernelGetProcessTime\n" + ".type sceKernelGetProcessTime @function\n" + "sceKernelGetProcessTime:\n"); + +asm(".global sceKernelGetProcessTimeCounter\n" + ".type sceKernelGetProcessTimeCounter @function\n" + "sceKernelGetProcessTimeCounter:\n"); + +asm(".global sceKernelGetProcessTimeCounterFrequency\n" + ".type sceKernelGetProcessTimeCounterFrequency @function\n" + "sceKernelGetProcessTimeCounterFrequency:\n"); + +asm(".global sceKernelGetProcessType\n" + ".type sceKernelGetProcessType @function\n" + "sceKernelGetProcessType:\n"); + +asm(".global sceKernelGetProcessTypeOfBudget\n" + ".type sceKernelGetProcessTypeOfBudget @function\n" + "sceKernelGetProcessTypeOfBudget:\n"); + +asm(".global sceKernelGetProductCode\n" + ".type sceKernelGetProductCode @function\n" + "sceKernelGetProductCode:\n"); + +asm(".global sceKernelGetProductStr\n" + ".type sceKernelGetProductStr @function\n" + "sceKernelGetProductStr:\n"); + +asm(".global sceKernelGetProsperoCompiledSdkVersion\n" + ".type sceKernelGetProsperoCompiledSdkVersion @function\n" + "sceKernelGetProsperoCompiledSdkVersion:\n"); + +asm(".global sceKernelGetProsperoCompiledSdkVersionByPid\n" + ".type sceKernelGetProsperoCompiledSdkVersionByPid @function\n" + "sceKernelGetProsperoCompiledSdkVersionByPid:\n"); + +asm(".global sceKernelGetProsperoSystemSwVersion\n" + ".type sceKernelGetProsperoSystemSwVersion @function\n" + "sceKernelGetProsperoSystemSwVersion:\n"); + +asm(".global sceKernelGetPrtAperture\n" + ".type sceKernelGetPrtAperture @function\n" + "sceKernelGetPrtAperture:\n"); + +asm(".global sceKernelGetPs4CompiledSdkVersion\n" + ".type sceKernelGetPs4CompiledSdkVersion @function\n" + "sceKernelGetPs4CompiledSdkVersion:\n"); + +asm(".global sceKernelGetPs4CompiledSdkVersionByPid\n" + ".type sceKernelGetPs4CompiledSdkVersionByPid @function\n" + "sceKernelGetPs4CompiledSdkVersionByPid:\n"); + +asm(".global sceKernelGetPs4SystemSwVersion\n" + ".type sceKernelGetPs4SystemSwVersion @function\n" + "sceKernelGetPs4SystemSwVersion:\n"); + +asm(".global sceKernelGetPsmIntdevModeForRcmgr\n" + ".type sceKernelGetPsmIntdevModeForRcmgr @function\n" + "sceKernelGetPsmIntdevModeForRcmgr:\n"); + +asm(".global sceKernelGetPsnAccessTraceLogForRcmgr\n" + ".type sceKernelGetPsnAccessTraceLogForRcmgr @function\n" + "sceKernelGetPsnAccessTraceLogForRcmgr:\n"); + +asm(".global sceKernelGetQafExpirationTimeNotafterForRcmgr\n" + ".type sceKernelGetQafExpirationTimeNotafterForRcmgr @function\n" + "sceKernelGetQafExpirationTimeNotafterForRcmgr:\n"); + +asm(".global sceKernelGetQafExpirationTimeNotbeforeForRcmgr\n" + ".type sceKernelGetQafExpirationTimeNotbeforeForRcmgr @function\n" + "sceKernelGetQafExpirationTimeNotbeforeForRcmgr:\n"); + +asm(".global sceKernelGetQafGenerationForRcmgr\n" + ".type sceKernelGetQafGenerationForRcmgr @function\n" + "sceKernelGetQafGenerationForRcmgr:\n"); + +asm(".global sceKernelGetQafNameForRcmgr\n" + ".type sceKernelGetQafNameForRcmgr @function\n" + "sceKernelGetQafNameForRcmgr:\n"); + +asm(".global sceKernelGetRenderingMode\n" + ".type sceKernelGetRenderingMode @function\n" + "sceKernelGetRenderingMode:\n"); + +asm(".global sceKernelGetResidentCount\n" + ".type sceKernelGetResidentCount @function\n" + "sceKernelGetResidentCount:\n"); + +asm(".global sceKernelGetResidentFmemCount\n" + ".type sceKernelGetResidentFmemCount @function\n" + "sceKernelGetResidentFmemCount:\n"); + +asm(".global sceKernelGetResource\n" + ".type sceKernelGetResource @function\n" + "sceKernelGetResource:\n"); + +asm(".global sceKernelGetResourceLimit\n" + ".type sceKernelGetResourceLimit @function\n" + "sceKernelGetResourceLimit:\n"); + +asm(".global sceKernelGetResourceOne\n" + ".type sceKernelGetResourceOne @function\n" + "sceKernelGetResourceOne:\n"); + +asm(".global sceKernelGetSafemode\n" + ".type sceKernelGetSafemode @function\n" + "sceKernelGetSafemode:\n"); + +asm(".global sceKernelGetSanitizerMallocReplace\n" + ".type sceKernelGetSanitizerMallocReplace @function\n" + "sceKernelGetSanitizerMallocReplace:\n"); + +asm(".global sceKernelGetSanitizerMallocReplaceExternal\n" + ".type sceKernelGetSanitizerMallocReplaceExternal @function\n" + "sceKernelGetSanitizerMallocReplaceExternal:\n"); + +asm(".global sceKernelGetSanitizerNewReplace\n" + ".type sceKernelGetSanitizerNewReplace @function\n" + "sceKernelGetSanitizerNewReplace:\n"); + +asm(".global sceKernelGetSanitizerNewReplaceExternal\n" + ".type sceKernelGetSanitizerNewReplaceExternal @function\n" + "sceKernelGetSanitizerNewReplaceExternal:\n"); + +asm(".global sceKernelGetSocClock\n" + ".type sceKernelGetSocClock @function\n" + "sceKernelGetSocClock:\n"); + +asm(".global sceKernelGetSocPowerConsumption\n" + ".type sceKernelGetSocPowerConsumption @function\n" + "sceKernelGetSocPowerConsumption:\n"); + +asm(".global sceKernelGetSocSensorTemperature\n" + ".type sceKernelGetSocSensorTemperature @function\n" + "sceKernelGetSocSensorTemperature:\n"); + +asm(".global sceKernelGetSpecialIForRcmgr\n" + ".type sceKernelGetSpecialIForRcmgr @function\n" + "sceKernelGetSpecialIForRcmgr:\n"); + +asm(".global sceKernelGetSubsysId\n" + ".type sceKernelGetSubsysId @function\n" + "sceKernelGetSubsysId:\n"); + +asm(".global sceKernelGetSubsysSubId\n" + ".type sceKernelGetSubsysSubId @function\n" + "sceKernelGetSubsysSubId:\n"); + +asm(".global sceKernelGetSystemExVersion\n" + ".type sceKernelGetSystemExVersion @function\n" + "sceKernelGetSystemExVersion:\n"); + +asm(".global sceKernelGetSystemLevelDebuggerModeForRcmgr\n" + ".type sceKernelGetSystemLevelDebuggerModeForRcmgr @function\n" + "sceKernelGetSystemLevelDebuggerModeForRcmgr:\n"); + +asm(".global sceKernelGetSystemSwBeta\n" + ".type sceKernelGetSystemSwBeta @function\n" + "sceKernelGetSystemSwBeta:\n"); + +asm(".global sceKernelGetSystemSwVersion\n" + ".type sceKernelGetSystemSwVersion @function\n" + "sceKernelGetSystemSwVersion:\n"); + +asm(".global sceKernelGetThreadName\n" + ".type sceKernelGetThreadName @function\n" + "sceKernelGetThreadName:\n"); + +asm(".global sceKernelGetToolMemoryRange\n" + ".type sceKernelGetToolMemoryRange @function\n" + "sceKernelGetToolMemoryRange:\n"); + +asm(".global sceKernelGetTraceMemoryStats\n" + ".type sceKernelGetTraceMemoryStats @function\n" + "sceKernelGetTraceMemoryStats:\n"); + +asm(".global sceKernelGetTscFrequency\n" + ".type sceKernelGetTscFrequency @function\n" + "sceKernelGetTscFrequency:\n"); + +asm(".global sceKernelGetUniversalMode\n" + ".type sceKernelGetUniversalMode @function\n" + "sceKernelGetUniversalMode:\n"); + +asm(".global sceKernelGetUpdVersion\n" + ".type sceKernelGetUpdVersion @function\n" + "sceKernelGetUpdVersion:\n"); + +asm(".global sceKernelGetUpdatemode\n" + ".type sceKernelGetUpdatemode @function\n" + "sceKernelGetUpdatemode:\n"); + +asm(".global sceKernelGetUtokenDataExecutionForRcmgr\n" + ".type sceKernelGetUtokenDataExecutionForRcmgr @function\n" + "sceKernelGetUtokenDataExecutionForRcmgr:\n"); + +asm(".global sceKernelGetUtokenExpirationTimeNotafterForRcmgr\n" + ".type sceKernelGetUtokenExpirationTimeNotafterForRcmgr @function\n" + "sceKernelGetUtokenExpirationTimeNotafterForRcmgr:\n"); + +asm(".global sceKernelGetUtokenExpirationTimeNotbeforeForRcmgr\n" + ".type sceKernelGetUtokenExpirationTimeNotbeforeForRcmgr @function\n" + "sceKernelGetUtokenExpirationTimeNotbeforeForRcmgr:\n"); + +asm(".global sceKernelGetUtokenFakeSharefactoryForRcmgr\n" + ".type sceKernelGetUtokenFakeSharefactoryForRcmgr @function\n" + "sceKernelGetUtokenFakeSharefactoryForRcmgr:\n"); + +asm(".global sceKernelGetUtokenFlagedUpdaterForRcmgr\n" + ".type sceKernelGetUtokenFlagedUpdaterForRcmgr @function\n" + "sceKernelGetUtokenFlagedUpdaterForRcmgr:\n"); + +asm(".global sceKernelGetUtokenNpEnvSwitchingForRcmgr\n" + ".type sceKernelGetUtokenNpEnvSwitchingForRcmgr @function\n" + "sceKernelGetUtokenNpEnvSwitchingForRcmgr:\n"); + +asm(".global sceKernelGetUtokenSaveDataRepairForRcmgr\n" + ".type sceKernelGetUtokenSaveDataRepairForRcmgr @function\n" + "sceKernelGetUtokenSaveDataRepairForRcmgr:\n"); + +asm(".global sceKernelGetUtokenStoreModeForRcmgr\n" + ".type sceKernelGetUtokenStoreModeForRcmgr @function\n" + "sceKernelGetUtokenStoreModeForRcmgr:\n"); + +asm(".global sceKernelGetUtokenUseSoftwagnerForAcmgr\n" + ".type sceKernelGetUtokenUseSoftwagnerForAcmgr @function\n" + "sceKernelGetUtokenUseSoftwagnerForAcmgr:\n"); + +asm(".global sceKernelGetUtokenUseSoftwagnerForRcmgr\n" + ".type sceKernelGetUtokenUseSoftwagnerForRcmgr @function\n" + "sceKernelGetUtokenUseSoftwagnerForRcmgr:\n"); + +asm(".global sceKernelGetUtokenWeakenedPortRestrictionForRcmgr\n" + ".type sceKernelGetUtokenWeakenedPortRestrictionForRcmgr @function\n" + "sceKernelGetUtokenWeakenedPortRestrictionForRcmgr:\n"); + +asm(".global sceKernelGetVrCaptureSize\n" + ".type sceKernelGetVrCaptureSize @function\n" + "sceKernelGetVrCaptureSize:\n"); + +asm(".global sceKernelGetdents\n" + ".type sceKernelGetdents @function\n" + "sceKernelGetdents:\n"); + +asm(".global sceKernelGetdirentries\n" + ".type sceKernelGetdirentries @function\n" + "sceKernelGetdirentries:\n"); + +asm(".global sceKernelGettimeofday\n" + ".type sceKernelGettimeofday @function\n" + "sceKernelGettimeofday:\n"); + +asm(".global sceKernelGettimezone\n" + ".type sceKernelGettimezone @function\n" + "sceKernelGettimezone:\n"); + +asm(".global sceKernelGiveDirectMemoryToMapper\n" + ".type sceKernelGiveDirectMemoryToMapper @function\n" + "sceKernelGiveDirectMemoryToMapper:\n"); + +asm(".global sceKernelHasNeoMode\n" + ".type sceKernelHasNeoMode @function\n" + "sceKernelHasNeoMode:\n"); + +asm(".global sceKernelHwGetBdDriveInfo\n" + ".type sceKernelHwGetBdDriveInfo @function\n" + "sceKernelHwGetBdDriveInfo:\n"); + +asm(".global sceKernelHwHasOpticalOut\n" + ".type sceKernelHwHasOpticalOut @function\n" + "sceKernelHwHasOpticalOut:\n"); + +asm(".global sceKernelHwHasWlanBt\n" + ".type sceKernelHwHasWlanBt @function\n" + "sceKernelHwHasWlanBt:\n"); + +asm(".global sceKernelIccControlBDPowerState\n" + ".type sceKernelIccControlBDPowerState @function\n" + "sceKernelIccControlBDPowerState:\n"); + +asm(".global sceKernelIccControlUSBPowerState\n" + ".type sceKernelIccControlUSBPowerState @function\n" + "sceKernelIccControlUSBPowerState:\n"); + +asm(".global sceKernelIccGetBDDriveChuckingState\n" + ".type sceKernelIccGetBDDriveChuckingState @function\n" + "sceKernelIccGetBDDriveChuckingState:\n"); + +asm(".global sceKernelIccGetBDPowerState\n" + ".type sceKernelIccGetBDPowerState @function\n" + "sceKernelIccGetBDPowerState:\n"); + +asm(".global sceKernelIccGetBootTimestamp\n" + ".type sceKernelIccGetBootTimestamp @function\n" + "sceKernelIccGetBootTimestamp:\n"); + +asm(".global sceKernelIccGetCPMode\n" + ".type sceKernelIccGetCPMode @function\n" + "sceKernelIccGetCPMode:\n"); + +asm(".global sceKernelIccGetCountTime\n" + ".type sceKernelIccGetCountTime @function\n" + "sceKernelIccGetCountTime:\n"); + +asm(".global sceKernelIccGetCpuInfoBit\n" + ".type sceKernelIccGetCpuInfoBit @function\n" + "sceKernelIccGetCpuInfoBit:\n"); + +asm(".global sceKernelIccGetEmcBtDownload\n" + ".type sceKernelIccGetEmcBtDownload @function\n" + "sceKernelIccGetEmcBtDownload:\n"); + +asm(".global sceKernelIccGetErrLog\n" + ".type sceKernelIccGetErrLog @function\n" + "sceKernelIccGetErrLog:\n"); + +asm(".global sceKernelIccGetFloydVersion\n" + ".type sceKernelIccGetFloydVersion @function\n" + "sceKernelIccGetFloydVersion:\n"); + +asm(".global sceKernelIccGetHwInfo\n" + ".type sceKernelIccGetHwInfo @function\n" + "sceKernelIccGetHwInfo:\n"); + +asm(".global sceKernelIccGetPowerNumberOfBootShutdown\n" + ".type sceKernelIccGetPowerNumberOfBootShutdown @function\n" + "sceKernelIccGetPowerNumberOfBootShutdown:\n"); + +asm(".global sceKernelIccGetPowerOperatingTime\n" + ".type sceKernelIccGetPowerOperatingTime @function\n" + "sceKernelIccGetPowerOperatingTime:\n"); + +asm(".global sceKernelIccGetPowerUpCause\n" + ".type sceKernelIccGetPowerUpCause @function\n" + "sceKernelIccGetPowerUpCause:\n"); + +asm(".global sceKernelIccGetSysEventLog\n" + ".type sceKernelIccGetSysEventLog @function\n" + "sceKernelIccGetSysEventLog:\n"); + +asm(".global sceKernelIccGetThermalAlert\n" + ".type sceKernelIccGetThermalAlert @function\n" + "sceKernelIccGetThermalAlert:\n"); + +asm(".global sceKernelIccGetUSBPowerState\n" + ".type sceKernelIccGetUSBPowerState @function\n" + "sceKernelIccGetUSBPowerState:\n"); + +asm(".global sceKernelIccGetWlanBtGpio\n" + ".type sceKernelIccGetWlanBtGpio @function\n" + "sceKernelIccGetWlanBtGpio:\n"); + +asm(".global sceKernelIccIndicatorBootDone\n" + ".type sceKernelIccIndicatorBootDone @function\n" + "sceKernelIccIndicatorBootDone:\n"); + +asm(".global sceKernelIccIndicatorShutdown\n" + ".type sceKernelIccIndicatorShutdown @function\n" + "sceKernelIccIndicatorShutdown:\n"); + +asm(".global sceKernelIccIndicatorStandby\n" + ".type sceKernelIccIndicatorStandby @function\n" + "sceKernelIccIndicatorStandby:\n"); + +asm(".global sceKernelIccIndicatorStandbyBoot\n" + ".type sceKernelIccIndicatorStandbyBoot @function\n" + "sceKernelIccIndicatorStandbyBoot:\n"); + +asm(".global sceKernelIccIndicatorStandbyShutdown\n" + ".type sceKernelIccIndicatorStandbyShutdown @function\n" + "sceKernelIccIndicatorStandbyShutdown:\n"); + +asm(".global sceKernelIccIsThermalAlert\n" + ".type sceKernelIccIsThermalAlert @function\n" + "sceKernelIccIsThermalAlert:\n"); + +asm(".global sceKernelIccNotifyBootStatus\n" + ".type sceKernelIccNotifyBootStatus @function\n" + "sceKernelIccNotifyBootStatus:\n"); + +asm(".global sceKernelIccNvsFlush\n" + ".type sceKernelIccNvsFlush @function\n" + "sceKernelIccNvsFlush:\n"); + +asm(".global sceKernelIccReadPowerBootMessage\n" + ".type sceKernelIccReadPowerBootMessage @function\n" + "sceKernelIccReadPowerBootMessage:\n"); + +asm(".global sceKernelIccSetBootTimestamp\n" + ".type sceKernelIccSetBootTimestamp @function\n" + "sceKernelIccSetBootTimestamp:\n"); + +asm(".global sceKernelIccSetBuzzer\n" + ".type sceKernelIccSetBuzzer @function\n" + "sceKernelIccSetBuzzer:\n"); + +asm(".global sceKernelIccSetCPMode\n" + ".type sceKernelIccSetCPMode @function\n" + "sceKernelIccSetCPMode:\n"); + +asm(".global sceKernelIccSetCpuInfoBit\n" + ".type sceKernelIccSetCpuInfoBit @function\n" + "sceKernelIccSetCpuInfoBit:\n"); + +asm(".global sceKernelIccSetDownloadMode\n" + ".type sceKernelIccSetDownloadMode @function\n" + "sceKernelIccSetDownloadMode:\n"); + +asm(".global sceKernelIccSetEmcBtDownload\n" + ".type sceKernelIccSetEmcBtDownload @function\n" + "sceKernelIccSetEmcBtDownload:\n"); + +asm(".global sceKernelIccSetPriorityBuzzer\n" + ".type sceKernelIccSetPriorityBuzzer @function\n" + "sceKernelIccSetPriorityBuzzer:\n"); + +asm(".global sceKernelIccSetWlanBtGpio\n" + ".type sceKernelIccSetWlanBtGpio @function\n" + "sceKernelIccSetWlanBtGpio:\n"); + +asm(".global sceKernelIccSetWlanBtManuTestMode\n" + ".type sceKernelIccSetWlanBtManuTestMode @function\n" + "sceKernelIccSetWlanBtManuTestMode:\n"); + +asm(".global sceKernelInstallExceptionHandler\n" + ".type sceKernelInstallExceptionHandler @function\n" + "sceKernelInstallExceptionHandler:\n"); + +asm(".global sceKernelInternalGetKmemStatistics\n" + ".type sceKernelInternalGetKmemStatistics @function\n" + "sceKernelInternalGetKmemStatistics:\n"); + +asm(".global sceKernelInternalGetMapStatistics\n" + ".type sceKernelInternalGetMapStatistics @function\n" + "sceKernelInternalGetMapStatistics:\n"); + +asm(".global sceKernelInternalHeapPrintBacktraceWithModuleInfo\n" + ".type sceKernelInternalHeapPrintBacktraceWithModuleInfo @function\n" + "sceKernelInternalHeapPrintBacktraceWithModuleInfo:\n"); + +asm(".global sceKernelInternalMapDirectMemory\n" + ".type sceKernelInternalMapDirectMemory @function\n" + "sceKernelInternalMapDirectMemory:\n"); + +asm(".global sceKernelInternalMapNamedDirectMemory\n" + ".type sceKernelInternalMapNamedDirectMemory @function\n" + "sceKernelInternalMapNamedDirectMemory:\n"); + +asm(".global sceKernelInternalMemoryGetAvailableSize\n" + ".type sceKernelInternalMemoryGetAvailableSize @function\n" + "sceKernelInternalMemoryGetAvailableSize:\n"); + +asm(".global sceKernelInternalMemoryGetModuleSegmentInfo\n" + ".type sceKernelInternalMemoryGetModuleSegmentInfo @function\n" + "sceKernelInternalMemoryGetModuleSegmentInfo:\n"); + +asm(".global sceKernelInternalResumeDirectMemoryRelease\n" + ".type sceKernelInternalResumeDirectMemoryRelease @function\n" + "sceKernelInternalResumeDirectMemoryRelease:\n"); + +asm(".global sceKernelInternalSuspendDirectMemoryRelease\n" + ".type sceKernelInternalSuspendDirectMemoryRelease @function\n" + "sceKernelInternalSuspendDirectMemoryRelease:\n"); + +asm(".global sceKernelIsAddressSanitizerEnabled\n" + ".type sceKernelIsAddressSanitizerEnabled @function\n" + "sceKernelIsAddressSanitizerEnabled:\n"); + +asm(".global sceKernelIsAllowedToSelectDvdRegion\n" + ".type sceKernelIsAllowedToSelectDvdRegion @function\n" + "sceKernelIsAllowedToSelectDvdRegion:\n"); + +asm(".global sceKernelIsAuthenticNeo\n" + ".type sceKernelIsAuthenticNeo @function\n" + "sceKernelIsAuthenticNeo:\n"); + +asm(".global sceKernelIsCEX\n" + ".type sceKernelIsCEX @function\n" + "sceKernelIsCEX:\n"); + +asm(".global sceKernelIsDebuggerAttached\n" + ".type sceKernelIsDebuggerAttached @function\n" + "sceKernelIsDebuggerAttached:\n"); + +asm(".global sceKernelIsDevKit\n" + ".type sceKernelIsDevKit @function\n" + "sceKernelIsDevKit:\n"); + +asm(".global sceKernelIsExperimentalBeta\n" + ".type sceKernelIsExperimentalBeta @function\n" + "sceKernelIsExperimentalBeta:\n"); + +asm(".global sceKernelIsGenuineCEX\n" + ".type sceKernelIsGenuineCEX @function\n" + "sceKernelIsGenuineCEX:\n"); + +asm(".global sceKernelIsGenuineDevKit\n" + ".type sceKernelIsGenuineDevKit @function\n" + "sceKernelIsGenuineDevKit:\n"); + +asm(".global sceKernelIsGenuineKratosCex\n" + ".type sceKernelIsGenuineKratosCex @function\n" + "sceKernelIsGenuineKratosCex:\n"); + +asm(".global sceKernelIsGenuineN\n" + ".type sceKernelIsGenuineN @function\n" + "sceKernelIsGenuineN:\n"); + +asm(".global sceKernelIsGenuineTestKit\n" + ".type sceKernelIsGenuineTestKit @function\n" + "sceKernelIsGenuineTestKit:\n"); + +asm(".global sceKernelIsInSandbox\n" + ".type sceKernelIsInSandbox @function\n" + "sceKernelIsInSandbox:\n"); + +asm(".global sceKernelIsKratos\n" + ".type sceKernelIsKratos @function\n" + "sceKernelIsKratos:\n"); + +asm(".global sceKernelIsM2DeviceAttached\n" + ".type sceKernelIsM2DeviceAttached @function\n" + "sceKernelIsM2DeviceAttached:\n"); + +asm(".global sceKernelIsMainOnStanbyMode\n" + ".type sceKernelIsMainOnStanbyMode @function\n" + "sceKernelIsMainOnStanbyMode:\n"); + +asm(".global sceKernelIsMainOnStandbyMode\n" + ".type sceKernelIsMainOnStandbyMode @function\n" + "sceKernelIsMainOnStandbyMode:\n"); + +asm(".global sceKernelIsModuleLoaded\n" + ".type sceKernelIsModuleLoaded @function\n" + "sceKernelIsModuleLoaded:\n"); + +asm(".global sceKernelIsNeoMode\n" + ".type sceKernelIsNeoMode @function\n" + "sceKernelIsNeoMode:\n"); + +asm(".global sceKernelIsProspero\n" + ".type sceKernelIsProspero @function\n" + "sceKernelIsProspero:\n"); + +asm(".global sceKernelIsPs4Process\n" + ".type sceKernelIsPs4Process @function\n" + "sceKernelIsPs4Process:\n"); + +asm(".global sceKernelIsStack\n" + ".type sceKernelIsStack @function\n" + "sceKernelIsStack:\n"); + +asm(".global sceKernelIsTestKit\n" + ".type sceKernelIsTestKit @function\n" + "sceKernelIsTestKit:\n"); + +asm(".global sceKernelJitCreateAliasOfSharedMemory\n" + ".type sceKernelJitCreateAliasOfSharedMemory @function\n" + "sceKernelJitCreateAliasOfSharedMemory:\n"); + +asm(".global sceKernelJitCreateSharedMemory\n" + ".type sceKernelJitCreateSharedMemory @function\n" + "sceKernelJitCreateSharedMemory:\n"); + +asm(".global sceKernelJitGetSharedMemoryInfo\n" + ".type sceKernelJitGetSharedMemoryInfo @function\n" + "sceKernelJitGetSharedMemoryInfo:\n"); + +asm(".global sceKernelJitMapSharedMemory\n" + ".type sceKernelJitMapSharedMemory @function\n" + "sceKernelJitMapSharedMemory:\n"); + +asm(".global sceKernelKernelHeapUsage\n" + ".type sceKernelKernelHeapUsage @function\n" + "sceKernelKernelHeapUsage:\n"); + +asm(".global sceKernelLoadStartModule\n" + ".type sceKernelLoadStartModule @function\n" + "sceKernelLoadStartModule:\n"); + +asm(".global sceKernelLoadStartModuleForSysmodule\n" + ".type sceKernelLoadStartModuleForSysmodule @function\n" + "sceKernelLoadStartModuleForSysmodule:\n"); + +asm(".global sceKernelLoadStartModuleInternalForMono\n" + ".type sceKernelLoadStartModuleInternalForMono @function\n" + "sceKernelLoadStartModuleInternalForMono:\n"); + +asm(".global sceKernelLseek\n" + ".type sceKernelLseek @function\n" + "sceKernelLseek:\n"); + +asm(".global sceKernelLwfsAllocateBlock\n" + ".type sceKernelLwfsAllocateBlock @function\n" + "sceKernelLwfsAllocateBlock:\n"); + +asm(".global sceKernelLwfsLseek\n" + ".type sceKernelLwfsLseek @function\n" + "sceKernelLwfsLseek:\n"); + +asm(".global sceKernelLwfsSetAttribute\n" + ".type sceKernelLwfsSetAttribute @function\n" + "sceKernelLwfsSetAttribute:\n"); + +asm(".global sceKernelLwfsTrimBlock\n" + ".type sceKernelLwfsTrimBlock @function\n" + "sceKernelLwfsTrimBlock:\n"); + +asm(".global sceKernelLwfsWrite\n" + ".type sceKernelLwfsWrite @function\n" + "sceKernelLwfsWrite:\n"); + +asm(".global sceKernelMapDirectMemory\n" + ".type sceKernelMapDirectMemory @function\n" + "sceKernelMapDirectMemory:\n"); + +asm(".global sceKernelMapDirectMemory2\n" + ".type sceKernelMapDirectMemory2 @function\n" + "sceKernelMapDirectMemory2:\n"); + +asm(".global sceKernelMapFlexibleMemory\n" + ".type sceKernelMapFlexibleMemory @function\n" + "sceKernelMapFlexibleMemory:\n"); + +asm(".global sceKernelMapNamedDirectMemory\n" + ".type sceKernelMapNamedDirectMemory @function\n" + "sceKernelMapNamedDirectMemory:\n"); + +asm(".global sceKernelMapNamedFlexibleMemory\n" + ".type sceKernelMapNamedFlexibleMemory @function\n" + "sceKernelMapNamedFlexibleMemory:\n"); + +asm(".global sceKernelMapNamedSystemFlexibleMemory\n" + ".type sceKernelMapNamedSystemFlexibleMemory @function\n" + "sceKernelMapNamedSystemFlexibleMemory:\n"); + +asm(".global sceKernelMapSanitizerShadowMemory\n" + ".type sceKernelMapSanitizerShadowMemory @function\n" + "sceKernelMapSanitizerShadowMemory:\n"); + +asm(".global sceKernelMapToolMemory\n" + ".type sceKernelMapToolMemory @function\n" + "sceKernelMapToolMemory:\n"); + +asm(".global sceKernelMapTraceMemory\n" + ".type sceKernelMapTraceMemory @function\n" + "sceKernelMapTraceMemory:\n"); + +asm(".global sceKernelMapperGetParam\n" + ".type sceKernelMapperGetParam @function\n" + "sceKernelMapperGetParam:\n"); + +asm(".global sceKernelMapperGetUsageStatsData\n" + ".type sceKernelMapperGetUsageStatsData @function\n" + "sceKernelMapperGetUsageStatsData:\n"); + +asm(".global sceKernelMapperSetPageTablePoolOccupancyNotificationThreshold\n" + ".type sceKernelMapperSetPageTablePoolOccupancyNotificationThreshold @function\n" + "sceKernelMapperSetPageTablePoolOccupancyNotificationThreshold:\n"); + +asm(".global sceKernelMemoryPoolBatch\n" + ".type sceKernelMemoryPoolBatch @function\n" + "sceKernelMemoryPoolBatch:\n"); + +asm(".global sceKernelMemoryPoolCommit\n" + ".type sceKernelMemoryPoolCommit @function\n" + "sceKernelMemoryPoolCommit:\n"); + +asm(".global sceKernelMemoryPoolDecommit\n" + ".type sceKernelMemoryPoolDecommit @function\n" + "sceKernelMemoryPoolDecommit:\n"); + +asm(".global sceKernelMemoryPoolExpand\n" + ".type sceKernelMemoryPoolExpand @function\n" + "sceKernelMemoryPoolExpand:\n"); + +asm(".global sceKernelMemoryPoolGetBlockStats\n" + ".type sceKernelMemoryPoolGetBlockStats @function\n" + "sceKernelMemoryPoolGetBlockStats:\n"); + +asm(".global sceKernelMemoryPoolMove\n" + ".type sceKernelMemoryPoolMove @function\n" + "sceKernelMemoryPoolMove:\n"); + +asm(".global sceKernelMemoryPoolReserve\n" + ".type sceKernelMemoryPoolReserve @function\n" + "sceKernelMemoryPoolReserve:\n"); + +asm(".global sceKernelMkdir\n" + ".type sceKernelMkdir @function\n" + "sceKernelMkdir:\n"); + +asm(".global sceKernelMlock\n" + ".type sceKernelMlock @function\n" + "sceKernelMlock:\n"); + +asm(".global sceKernelMlockall\n" + ".type sceKernelMlockall @function\n" + "sceKernelMlockall:\n"); + +asm(".global sceKernelMmap\n" + ".type sceKernelMmap @function\n" + "sceKernelMmap:\n"); + +asm(".global sceKernelMprotect\n" + ".type sceKernelMprotect @function\n" + "sceKernelMprotect:\n"); + +asm(".global sceKernelMsync\n" + ".type sceKernelMsync @function\n" + "sceKernelMsync:\n"); + +asm(".global sceKernelMtypeprotect\n" + ".type sceKernelMtypeprotect @function\n" + "sceKernelMtypeprotect:\n"); + +asm(".global sceKernelMunlock\n" + ".type sceKernelMunlock @function\n" + "sceKernelMunlock:\n"); + +asm(".global sceKernelMunlockall\n" + ".type sceKernelMunlockall @function\n" + "sceKernelMunlockall:\n"); + +asm(".global sceKernelMunmap\n" + ".type sceKernelMunmap @function\n" + "sceKernelMunmap:\n"); + +asm(".global sceKernelNanosleep\n" + ".type sceKernelNanosleep @function\n" + "sceKernelNanosleep:\n"); + +asm(".global sceKernelNormalizePath\n" + ".type sceKernelNormalizePath @function\n" + "sceKernelNormalizePath:\n"); + +asm(".global sceKernelNotifyAppEvent\n" + ".type sceKernelNotifyAppEvent @function\n" + "sceKernelNotifyAppEvent:\n"); + +asm(".global sceKernelNotifyAppStateChanged\n" + ".type sceKernelNotifyAppStateChanged @function\n" + "sceKernelNotifyAppStateChanged:\n"); + +asm(".global sceKernelNotifySystemSuspendResumeProgress\n" + ".type sceKernelNotifySystemSuspendResumeProgress @function\n" + "sceKernelNotifySystemSuspendResumeProgress:\n"); + +asm(".global sceKernelNotifySystemSuspendStart\n" + ".type sceKernelNotifySystemSuspendStart @function\n" + "sceKernelNotifySystemSuspendStart:\n"); + +asm(".global sceKernelOpen\n" + ".type sceKernelOpen @function\n" + "sceKernelOpen:\n"); + +asm(".global sceKernelOpenEport\n" + ".type sceKernelOpenEport @function\n" + "sceKernelOpenEport:\n"); + +asm(".global sceKernelOpenEventFlag\n" + ".type sceKernelOpenEventFlag @function\n" + "sceKernelOpenEventFlag:\n"); + +asm(".global sceKernelOpenInternal\n" + ".type sceKernelOpenInternal @function\n" + "sceKernelOpenInternal:\n"); + +asm(".global sceKernelOpenSema\n" + ".type sceKernelOpenSema @function\n" + "sceKernelOpenSema:\n"); + +asm(".global sceKernelPollEventFlag\n" + ".type sceKernelPollEventFlag @function\n" + "sceKernelPollEventFlag:\n"); + +asm(".global sceKernelPollSema\n" + ".type sceKernelPollSema @function\n" + "sceKernelPollSema:\n"); + +asm(".global sceKernelPread\n" + ".type sceKernelPread @function\n" + "sceKernelPread:\n"); + +asm(".global sceKernelPreadv\n" + ".type sceKernelPreadv @function\n" + "sceKernelPreadv:\n"); + +asm(".global sceKernelPrepareDirectMemorySwap\n" + ".type sceKernelPrepareDirectMemorySwap @function\n" + "sceKernelPrepareDirectMemorySwap:\n"); + +asm(".global sceKernelPrepareToResumeProcess\n" + ".type sceKernelPrepareToResumeProcess @function\n" + "sceKernelPrepareToResumeProcess:\n"); + +asm(".global sceKernelPrepareToSuspendProcess\n" + ".type sceKernelPrepareToSuspendProcess @function\n" + "sceKernelPrepareToSuspendProcess:\n"); + +asm(".global sceKernelPrintBacktraceWithModuleInfo\n" + ".type sceKernelPrintBacktraceWithModuleInfo @function\n" + "sceKernelPrintBacktraceWithModuleInfo:\n"); + +asm(".global sceKernelProtectDirectMemory\n" + ".type sceKernelProtectDirectMemory @function\n" + "sceKernelProtectDirectMemory:\n"); + +asm(".global sceKernelProtectDirectMemoryForPID\n" + ".type sceKernelProtectDirectMemoryForPID @function\n" + "sceKernelProtectDirectMemoryForPID:\n"); + +asm(".global sceKernelPwrite\n" + ".type sceKernelPwrite @function\n" + "sceKernelPwrite:\n"); + +asm(".global sceKernelPwritev\n" + ".type sceKernelPwritev @function\n" + "sceKernelPwritev:\n"); + +asm(".global sceKernelQueryMemoryProtection\n" + ".type sceKernelQueryMemoryProtection @function\n" + "sceKernelQueryMemoryProtection:\n"); + +asm(".global sceKernelQueryToolMemory\n" + ".type sceKernelQueryToolMemory @function\n" + "sceKernelQueryToolMemory:\n"); + +asm(".global sceKernelQueryTraceMemory\n" + ".type sceKernelQueryTraceMemory @function\n" + "sceKernelQueryTraceMemory:\n"); + +asm(".global sceKernelRaiseException\n" + ".type sceKernelRaiseException @function\n" + "sceKernelRaiseException:\n"); + +asm(".global sceKernelRandomizedPath\n" + ".type sceKernelRandomizedPath @function\n" + "sceKernelRandomizedPath:\n"); + +asm(".global sceKernelRdup\n" + ".type sceKernelRdup @function\n" + "sceKernelRdup:\n"); + +asm(".global sceKernelRead\n" + ".type sceKernelRead @function\n" + "sceKernelRead:\n"); + +asm(".global sceKernelReadTsc\n" + ".type sceKernelReadTsc @function\n" + "sceKernelReadTsc:\n"); + +asm(".global sceKernelReadv\n" + ".type sceKernelReadv @function\n" + "sceKernelReadv:\n"); + +asm(".global sceKernelReboot\n" + ".type sceKernelReboot @function\n" + "sceKernelReboot:\n"); + +asm(".global sceKernelReleaseDirectMemory\n" + ".type sceKernelReleaseDirectMemory @function\n" + "sceKernelReleaseDirectMemory:\n"); + +asm(".global sceKernelReleaseFlexibleMemory\n" + ".type sceKernelReleaseFlexibleMemory @function\n" + "sceKernelReleaseFlexibleMemory:\n"); + +asm(".global sceKernelReleaseToolMemory\n" + ".type sceKernelReleaseToolMemory @function\n" + "sceKernelReleaseToolMemory:\n"); + +asm(".global sceKernelReleaseTraceDirectMemory\n" + ".type sceKernelReleaseTraceDirectMemory @function\n" + "sceKernelReleaseTraceDirectMemory:\n"); + +asm(".global sceKernelRemoveExceptionHandler\n" + ".type sceKernelRemoveExceptionHandler @function\n" + "sceKernelRemoveExceptionHandler:\n"); + +asm(".global sceKernelRename\n" + ".type sceKernelRename @function\n" + "sceKernelRename:\n"); + +asm(".global sceKernelReportUnpatchedFunctionCall\n" + ".type sceKernelReportUnpatchedFunctionCall @function\n" + "sceKernelReportUnpatchedFunctionCall:\n"); + +asm(".global sceKernelReserve2mbPage\n" + ".type sceKernelReserve2mbPage @function\n" + "sceKernelReserve2mbPage:\n"); + +asm(".global sceKernelReserveSystemDirectMemory\n" + ".type sceKernelReserveSystemDirectMemory @function\n" + "sceKernelReserveSystemDirectMemory:\n"); + +asm(".global sceKernelReserveVirtualRange\n" + ".type sceKernelReserveVirtualRange @function\n" + "sceKernelReserveVirtualRange:\n"); + +asm(".global sceKernelRestoreApp\n" + ".type sceKernelRestoreApp @function\n" + "sceKernelRestoreApp:\n"); + +asm(".global sceKernelResumeDirectMemoryRelease\n" + ".type sceKernelResumeDirectMemoryRelease @function\n" + "sceKernelResumeDirectMemoryRelease:\n"); + +asm(".global sceKernelResumeProcess\n" + ".type sceKernelResumeProcess @function\n" + "sceKernelResumeProcess:\n"); + +asm(".global sceKernelRmdir\n" + ".type sceKernelRmdir @function\n" + "sceKernelRmdir:\n"); + +asm(".global sceKernelRtldControl\n" + ".type sceKernelRtldControl @function\n" + "sceKernelRtldControl:\n"); + +asm(".global sceKernelSandboxPath\n" + ".type sceKernelSandboxPath @function\n" + "sceKernelSandboxPath:\n"); + +asm(".global sceKernelSaveApp\n" + ".type sceKernelSaveApp @function\n" + "sceKernelSaveApp:\n"); + +asm(".global sceKernelSendNotificationRequest\n" + ".type sceKernelSendNotificationRequest @function\n" + "sceKernelSendNotificationRequest:\n"); + +asm(".global sceKernelSetAppInfo\n" + ".type sceKernelSetAppInfo @function\n" + "sceKernelSetAppInfo:\n"); + +asm(".global sceKernelSetAppState\n" + ".type sceKernelSetAppState @function\n" + "sceKernelSetAppState:\n"); + +asm(".global sceKernelSetBackupRestoreMode\n" + ".type sceKernelSetBackupRestoreMode @function\n" + "sceKernelSetBackupRestoreMode:\n"); + +asm(".global sceKernelSetBaseModeClock\n" + ".type sceKernelSetBaseModeClock @function\n" + "sceKernelSetBaseModeClock:\n"); + +asm(".global sceKernelSetBesteffort\n" + ".type sceKernelSetBesteffort @function\n" + "sceKernelSetBesteffort:\n"); + +asm(".global sceKernelSetBootReqNotify\n" + ".type sceKernelSetBootReqNotify @function\n" + "sceKernelSetBootReqNotify:\n"); + +asm(".global sceKernelSetBudget\n" + ".type sceKernelSetBudget @function\n" + "sceKernelSetBudget:\n"); + +asm(".global sceKernelSetCallRecord\n" + ".type sceKernelSetCallRecord @function\n" + "sceKernelSetCallRecord:\n"); + +asm(".global sceKernelSetCompressionAttribute\n" + ".type sceKernelSetCompressionAttribute @function\n" + "sceKernelSetCompressionAttribute:\n"); + +asm(".global sceKernelSetCoredumpAppInfo\n" + ".type sceKernelSetCoredumpAppInfo @function\n" + "sceKernelSetCoredumpAppInfo:\n"); + +asm(".global sceKernelSetCpumodeGame\n" + ".type sceKernelSetCpumodeGame @function\n" + "sceKernelSetCpumodeGame:\n"); + +asm(".global sceKernelSetDataTransferMode\n" + ".type sceKernelSetDataTransferMode @function\n" + "sceKernelSetDataTransferMode:\n"); + +asm(".global sceKernelSetEmergencyErrorLog\n" + ".type sceKernelSetEmergencyErrorLog @function\n" + "sceKernelSetEmergencyErrorLog:\n"); + +asm(".global sceKernelSetEventFlag\n" + ".type sceKernelSetEventFlag @function\n" + "sceKernelSetEventFlag:\n"); + +asm(".global sceKernelSetFsstParam\n" + ".type sceKernelSetFsstParam @function\n" + "sceKernelSetFsstParam:\n"); + +asm(".global sceKernelSetGPI\n" + ".type sceKernelSetGPI @function\n" + "sceKernelSetGPI:\n"); + +asm(".global sceKernelSetGPO\n" + ".type sceKernelSetGPO @function\n" + "sceKernelSetGPO:\n"); + +asm(".global sceKernelSetGameDirectMemoryLimit\n" + ".type sceKernelSetGameDirectMemoryLimit @function\n" + "sceKernelSetGameDirectMemoryLimit:\n"); + +asm(".global sceKernelSetGpuCu\n" + ".type sceKernelSetGpuCu @function\n" + "sceKernelSetGpuCu:\n"); + +asm(".global sceKernelSetIoreq\n" + ".type sceKernelSetIoreq @function\n" + "sceKernelSetIoreq:\n"); + +asm(".global sceKernelSetKnobs\n" + ".type sceKernelSetKnobs @function\n" + "sceKernelSetKnobs:\n"); + +asm(".global sceKernelSetMemoryPstate\n" + ".type sceKernelSetMemoryPstate @function\n" + "sceKernelSetMemoryPstate:\n"); + +asm(".global sceKernelSetNeoModeClock\n" + ".type sceKernelSetNeoModeClock @function\n" + "sceKernelSetNeoModeClock:\n"); + +asm(".global sceKernelSetPackageInfo\n" + ".type sceKernelSetPackageInfo @function\n" + "sceKernelSetPackageInfo:\n"); + +asm(".global sceKernelSetPhysFmemLimit\n" + ".type sceKernelSetPhysFmemLimit @function\n" + "sceKernelSetPhysFmemLimit:\n"); + +asm(".global sceKernelSetProcessName\n" + ".type sceKernelSetProcessName @function\n" + "sceKernelSetProcessName:\n"); + +asm(".global sceKernelSetProcessProperty\n" + ".type sceKernelSetProcessProperty @function\n" + "sceKernelSetProcessProperty:\n"); + +asm(".global sceKernelSetProcessPropertyString\n" + ".type sceKernelSetProcessPropertyString @function\n" + "sceKernelSetProcessPropertyString:\n"); + +asm(".global sceKernelSetPrtAperture\n" + ".type sceKernelSetPrtAperture @function\n" + "sceKernelSetPrtAperture:\n"); + +asm(".global sceKernelSetSafemode\n" + ".type sceKernelSetSafemode @function\n" + "sceKernelSetSafemode:\n"); + +asm(".global sceKernelSetSafemodeDirect\n" + ".type sceKernelSetSafemodeDirect @function\n" + "sceKernelSetSafemodeDirect:\n"); + +asm(".global sceKernelSetSuspendState\n" + ".type sceKernelSetSuspendState @function\n" + "sceKernelSetSuspendState:\n"); + +asm(".global sceKernelSetTimezoneInfo\n" + ".type sceKernelSetTimezoneInfo @function\n" + "sceKernelSetTimezoneInfo:\n"); + +asm(".global sceKernelSetUpdatemode\n" + ".type sceKernelSetUpdatemode @function\n" + "sceKernelSetUpdatemode:\n"); + +asm(".global sceKernelSetVirtualRangeName\n" + ".type sceKernelSetVirtualRangeName @function\n" + "sceKernelSetVirtualRangeName:\n"); + +asm(".global sceKernelSetVmContainer\n" + ".type sceKernelSetVmContainer @function\n" + "sceKernelSetVmContainer:\n"); + +asm(".global sceKernelSettimeofday\n" + ".type sceKernelSettimeofday @function\n" + "sceKernelSettimeofday:\n"); + +asm(".global sceKernelSflashGetWritePrio\n" + ".type sceKernelSflashGetWritePrio @function\n" + "sceKernelSflashGetWritePrio:\n"); + +asm(".global sceKernelSflashSetWritePrio\n" + ".type sceKernelSflashSetWritePrio @function\n" + "sceKernelSflashSetWritePrio:\n"); + +asm(".global sceKernelSignalSema\n" + ".type sceKernelSignalSema @function\n" + "sceKernelSignalSema:\n"); + +asm(".global sceKernelSleep\n" + ".type sceKernelSleep @function\n" + "sceKernelSleep:\n"); + +asm(".global sceKernelSlvNotifyError\n" + ".type sceKernelSlvNotifyError @function\n" + "sceKernelSlvNotifyError:\n"); + +asm(".global sceKernelSpawn\n" + ".type sceKernelSpawn @function\n" + "sceKernelSpawn:\n"); + +asm(".global sceKernelStat\n" + ".type sceKernelStat @function\n" + "sceKernelStat:\n"); + +asm(".global sceKernelStopUnloadModule\n" + ".type sceKernelStopUnloadModule @function\n" + "sceKernelStopUnloadModule:\n"); + +asm(".global sceKernelStreamWriteActivate\n" + ".type sceKernelStreamWriteActivate @function\n" + "sceKernelStreamWriteActivate:\n"); + +asm(".global sceKernelStreamWriteCreate\n" + ".type sceKernelStreamWriteCreate @function\n" + "sceKernelStreamWriteCreate:\n"); + +asm(".global sceKernelStreamWriteDeactivate\n" + ".type sceKernelStreamWriteDeactivate @function\n" + "sceKernelStreamWriteDeactivate:\n"); + +asm(".global sceKernelStreamWriteDelete\n" + ".type sceKernelStreamWriteDelete @function\n" + "sceKernelStreamWriteDelete:\n"); + +asm(".global sceKernelStreamWriteRead\n" + ".type sceKernelStreamWriteRead @function\n" + "sceKernelStreamWriteRead:\n"); + +asm(".global sceKernelStreamWriteStat\n" + ".type sceKernelStreamWriteStat @function\n" + "sceKernelStreamWriteStat:\n"); + +asm(".global sceKernelStreamWriteWrite\n" + ".type sceKernelStreamWriteWrite @function\n" + "sceKernelStreamWriteWrite:\n"); + +asm(".global sceKernelSuspendDirectMemoryRelease\n" + ".type sceKernelSuspendDirectMemoryRelease @function\n" + "sceKernelSuspendDirectMemoryRelease:\n"); + +asm(".global sceKernelSuspendProcess\n" + ".type sceKernelSuspendProcess @function\n" + "sceKernelSuspendProcess:\n"); + +asm(".global sceKernelSuspendSystem\n" + ".type sceKernelSuspendSystem @function\n" + "sceKernelSuspendSystem:\n"); + +asm(".global sceKernelSwitchToBaseMode\n" + ".type sceKernelSwitchToBaseMode @function\n" + "sceKernelSwitchToBaseMode:\n"); + +asm(".global sceKernelSwitchToNativeMode\n" + ".type sceKernelSwitchToNativeMode @function\n" + "sceKernelSwitchToNativeMode:\n"); + +asm(".global sceKernelSwitchToNeoMode\n" + ".type sceKernelSwitchToNeoMode @function\n" + "sceKernelSwitchToNeoMode:\n"); + +asm(".global sceKernelSync\n" + ".type sceKernelSync @function\n" + "sceKernelSync:\n"); + +asm(".global sceKernelTerminateProcess\n" + ".type sceKernelTerminateProcess @function\n" + "sceKernelTerminateProcess:\n"); + +asm(".global sceKernelTerminateSysCore\n" + ".type sceKernelTerminateSysCore @function\n" + "sceKernelTerminateSysCore:\n"); + +asm(".global sceKernelTitleWorkaroundIsEnabled\n" + ".type sceKernelTitleWorkaroundIsEnabled @function\n" + "sceKernelTitleWorkaroundIsEnabled:\n"); + +asm(".global sceKernelTitleWorkdaroundIsEnabled\n" + ".type sceKernelTitleWorkdaroundIsEnabled @function\n" + "sceKernelTitleWorkdaroundIsEnabled:\n"); + +asm(".global sceKernelTraceMemoryTypeProtect\n" + ".type sceKernelTraceMemoryTypeProtect @function\n" + "sceKernelTraceMemoryTypeProtect:\n"); + +asm(".global sceKernelTriggerEport\n" + ".type sceKernelTriggerEport @function\n" + "sceKernelTriggerEport:\n"); + +asm(".global sceKernelTriggerUserEvent\n" + ".type sceKernelTriggerUserEvent @function\n" + "sceKernelTriggerUserEvent:\n"); + +asm(".global sceKernelTruncate\n" + ".type sceKernelTruncate @function\n" + "sceKernelTruncate:\n"); + +asm(".global sceKernelUnlink\n" + ".type sceKernelUnlink @function\n" + "sceKernelUnlink:\n"); + +asm(".global sceKernelUsleep\n" + ".type sceKernelUsleep @function\n" + "sceKernelUsleep:\n"); + +asm(".global sceKernelUtimes\n" + ".type sceKernelUtimes @function\n" + "sceKernelUtimes:\n"); + +asm(".global sceKernelUuidCreate\n" + ".type sceKernelUuidCreate @function\n" + "sceKernelUuidCreate:\n"); + +asm(".global sceKernelVirtualQuery\n" + ".type sceKernelVirtualQuery @function\n" + "sceKernelVirtualQuery:\n"); + +asm(".global sceKernelVirtualQueryAll\n" + ".type sceKernelVirtualQueryAll @function\n" + "sceKernelVirtualQueryAll:\n"); + +asm(".global sceKernelWaitCommandBufferCompletion\n" + ".type sceKernelWaitCommandBufferCompletion @function\n" + "sceKernelWaitCommandBufferCompletion:\n"); + +asm(".global sceKernelWaitEqueue\n" + ".type sceKernelWaitEqueue @function\n" + "sceKernelWaitEqueue:\n"); + +asm(".global sceKernelWaitEventFlag\n" + ".type sceKernelWaitEventFlag @function\n" + "sceKernelWaitEventFlag:\n"); + +asm(".global sceKernelWaitSema\n" + ".type sceKernelWaitSema @function\n" + "sceKernelWaitSema:\n"); + +asm(".global sceKernelWrite\n" + ".type sceKernelWrite @function\n" + "sceKernelWrite:\n"); + +asm(".global sceKernelWriteEventQueueOnCompletionCommand\n" + ".type sceKernelWriteEventQueueOnCompletionCommand @function\n" + "sceKernelWriteEventQueueOnCompletionCommand:\n"); + +asm(".global sceKernelWriteMapCommand\n" + ".type sceKernelWriteMapCommand @function\n" + "sceKernelWriteMapCommand:\n"); + +asm(".global sceKernelWriteMapCommand2\n" + ".type sceKernelWriteMapCommand2 @function\n" + "sceKernelWriteMapCommand2:\n"); + +asm(".global sceKernelWriteMapDirectCommand\n" + ".type sceKernelWriteMapDirectCommand @function\n" + "sceKernelWriteMapDirectCommand:\n"); + +asm(".global sceKernelWriteMapDirectWithGpuMaskIdCommand\n" + ".type sceKernelWriteMapDirectWithGpuMaskIdCommand @function\n" + "sceKernelWriteMapDirectWithGpuMaskIdCommand:\n"); + +asm(".global sceKernelWriteMapWithGpuMaskIdCommand\n" + ".type sceKernelWriteMapWithGpuMaskIdCommand @function\n" + "sceKernelWriteMapWithGpuMaskIdCommand:\n"); + +asm(".global sceKernelWriteModifyMtypeProtectCommand\n" + ".type sceKernelWriteModifyMtypeProtectCommand @function\n" + "sceKernelWriteModifyMtypeProtectCommand:\n"); + +asm(".global sceKernelWriteModifyMtypeProtectWithGpuMaskIdCommand\n" + ".type sceKernelWriteModifyMtypeProtectWithGpuMaskIdCommand @function\n" + "sceKernelWriteModifyMtypeProtectWithGpuMaskIdCommand:\n"); + +asm(".global sceKernelWriteModifyProtectCommand\n" + ".type sceKernelWriteModifyProtectCommand @function\n" + "sceKernelWriteModifyProtectCommand:\n"); + +asm(".global sceKernelWriteModifyProtectWithGpuMaskIdCommand\n" + ".type sceKernelWriteModifyProtectWithGpuMaskIdCommand @function\n" + "sceKernelWriteModifyProtectWithGpuMaskIdCommand:\n"); + +asm(".global sceKernelWriteMultiMapCommand\n" + ".type sceKernelWriteMultiMapCommand @function\n" + "sceKernelWriteMultiMapCommand:\n"); + +asm(".global sceKernelWriteMultiMapWithGpuMaskIdCommand\n" + ".type sceKernelWriteMultiMapWithGpuMaskIdCommand @function\n" + "sceKernelWriteMultiMapWithGpuMaskIdCommand:\n"); + +asm(".global sceKernelWriteRemapCommand\n" + ".type sceKernelWriteRemapCommand @function\n" + "sceKernelWriteRemapCommand:\n"); + +asm(".global sceKernelWriteRemapWithGpuMaskIdCommand\n" + ".type sceKernelWriteRemapWithGpuMaskIdCommand @function\n" + "sceKernelWriteRemapWithGpuMaskIdCommand:\n"); + +asm(".global sceKernelWriteSdkEventLog\n" + ".type sceKernelWriteSdkEventLog @function\n" + "sceKernelWriteSdkEventLog:\n"); + +asm(".global sceKernelWriteSdkEventLogV\n" + ".type sceKernelWriteSdkEventLogV @function\n" + "sceKernelWriteSdkEventLogV:\n"); + +asm(".global sceKernelWriteUnmapCommand\n" + ".type sceKernelWriteUnmapCommand @function\n" + "sceKernelWriteUnmapCommand:\n"); + +asm(".global sceKernelWriteWaitOnAddressCommand\n" + ".type sceKernelWriteWaitOnAddressCommand @function\n" + "sceKernelWriteWaitOnAddressCommand:\n"); + +asm(".global sceKernelWriteWaitOnCounterCommand\n" + ".type sceKernelWriteWaitOnCounterCommand @function\n" + "sceKernelWriteWaitOnCounterCommand:\n"); + +asm(".global sceKernelWriteWriteAddressCommand\n" + ".type sceKernelWriteWriteAddressCommand @function\n" + "sceKernelWriteWriteAddressCommand:\n"); + +asm(".global sceKernelWriteWriteCounterCommand\n" + ".type sceKernelWriteWriteCounterCommand @function\n" + "sceKernelWriteWriteCounterCommand:\n"); + +asm(".global sceKernelWritev\n" + ".type sceKernelWritev @function\n" + "sceKernelWritev:\n"); + +asm(".global sceKernelYieldCpumode\n" + ".type sceKernelYieldCpumode @function\n" + "sceKernelYieldCpumode:\n"); + +asm(".global sceLibcMspaceCreateForMonoMutex\n" + ".type sceLibcMspaceCreateForMonoMutex @function\n" + "sceLibcMspaceCreateForMonoMutex:\n"); + +asm(".global scePthreadAtfork\n" + ".type scePthreadAtfork @function\n" + "scePthreadAtfork:\n"); + +asm(".global scePthreadAttrDestroy\n" + ".type scePthreadAttrDestroy @function\n" + "scePthreadAttrDestroy:\n"); + +asm(".global scePthreadAttrGet\n" + ".type scePthreadAttrGet @function\n" + "scePthreadAttrGet:\n"); + +asm(".global scePthreadAttrGetaffinity\n" + ".type scePthreadAttrGetaffinity @function\n" + "scePthreadAttrGetaffinity:\n"); + +asm(".global scePthreadAttrGetdetachstate\n" + ".type scePthreadAttrGetdetachstate @function\n" + "scePthreadAttrGetdetachstate:\n"); + +asm(".global scePthreadAttrGetguardsize\n" + ".type scePthreadAttrGetguardsize @function\n" + "scePthreadAttrGetguardsize:\n"); + +asm(".global scePthreadAttrGetinheritsched\n" + ".type scePthreadAttrGetinheritsched @function\n" + "scePthreadAttrGetinheritsched:\n"); + +asm(".global scePthreadAttrGetschedparam\n" + ".type scePthreadAttrGetschedparam @function\n" + "scePthreadAttrGetschedparam:\n"); + +asm(".global scePthreadAttrGetschedpolicy\n" + ".type scePthreadAttrGetschedpolicy @function\n" + "scePthreadAttrGetschedpolicy:\n"); + +asm(".global scePthreadAttrGetscope\n" + ".type scePthreadAttrGetscope @function\n" + "scePthreadAttrGetscope:\n"); + +asm(".global scePthreadAttrGetsolosched\n" + ".type scePthreadAttrGetsolosched @function\n" + "scePthreadAttrGetsolosched:\n"); + +asm(".global scePthreadAttrGetstack\n" + ".type scePthreadAttrGetstack @function\n" + "scePthreadAttrGetstack:\n"); + +asm(".global scePthreadAttrGetstackaddr\n" + ".type scePthreadAttrGetstackaddr @function\n" + "scePthreadAttrGetstackaddr:\n"); + +asm(".global scePthreadAttrGetstacksize\n" + ".type scePthreadAttrGetstacksize @function\n" + "scePthreadAttrGetstacksize:\n"); + +asm(".global scePthreadAttrInit\n" + ".type scePthreadAttrInit @function\n" + "scePthreadAttrInit:\n"); + +asm(".global scePthreadAttrSetaffinity\n" + ".type scePthreadAttrSetaffinity @function\n" + "scePthreadAttrSetaffinity:\n"); + +asm(".global scePthreadAttrSetcreatesuspend\n" + ".type scePthreadAttrSetcreatesuspend @function\n" + "scePthreadAttrSetcreatesuspend:\n"); + +asm(".global scePthreadAttrSetdetachstate\n" + ".type scePthreadAttrSetdetachstate @function\n" + "scePthreadAttrSetdetachstate:\n"); + +asm(".global scePthreadAttrSetguardsize\n" + ".type scePthreadAttrSetguardsize @function\n" + "scePthreadAttrSetguardsize:\n"); + +asm(".global scePthreadAttrSetinheritsched\n" + ".type scePthreadAttrSetinheritsched @function\n" + "scePthreadAttrSetinheritsched:\n"); + +asm(".global scePthreadAttrSetschedparam\n" + ".type scePthreadAttrSetschedparam @function\n" + "scePthreadAttrSetschedparam:\n"); + +asm(".global scePthreadAttrSetschedpolicy\n" + ".type scePthreadAttrSetschedpolicy @function\n" + "scePthreadAttrSetschedpolicy:\n"); + +asm(".global scePthreadAttrSetscope\n" + ".type scePthreadAttrSetscope @function\n" + "scePthreadAttrSetscope:\n"); + +asm(".global scePthreadAttrSetsolosched\n" + ".type scePthreadAttrSetsolosched @function\n" + "scePthreadAttrSetsolosched:\n"); + +asm(".global scePthreadAttrSetstack\n" + ".type scePthreadAttrSetstack @function\n" + "scePthreadAttrSetstack:\n"); + +asm(".global scePthreadAttrSetstackaddr\n" + ".type scePthreadAttrSetstackaddr @function\n" + "scePthreadAttrSetstackaddr:\n"); + +asm(".global scePthreadAttrSetstacksize\n" + ".type scePthreadAttrSetstacksize @function\n" + "scePthreadAttrSetstacksize:\n"); + +asm(".global scePthreadBarrierDestroy\n" + ".type scePthreadBarrierDestroy @function\n" + "scePthreadBarrierDestroy:\n"); + +asm(".global scePthreadBarrierInit\n" + ".type scePthreadBarrierInit @function\n" + "scePthreadBarrierInit:\n"); + +asm(".global scePthreadBarrierWait\n" + ".type scePthreadBarrierWait @function\n" + "scePthreadBarrierWait:\n"); + +asm(".global scePthreadBarrierattrDestroy\n" + ".type scePthreadBarrierattrDestroy @function\n" + "scePthreadBarrierattrDestroy:\n"); + +asm(".global scePthreadBarrierattrGetpshared\n" + ".type scePthreadBarrierattrGetpshared @function\n" + "scePthreadBarrierattrGetpshared:\n"); + +asm(".global scePthreadBarrierattrInit\n" + ".type scePthreadBarrierattrInit @function\n" + "scePthreadBarrierattrInit:\n"); + +asm(".global scePthreadBarrierattrSetpshared\n" + ".type scePthreadBarrierattrSetpshared @function\n" + "scePthreadBarrierattrSetpshared:\n"); + +asm(".global scePthreadCancel\n" + ".type scePthreadCancel @function\n" + "scePthreadCancel:\n"); + +asm(".global scePthreadCondBroadcast\n" + ".type scePthreadCondBroadcast @function\n" + "scePthreadCondBroadcast:\n"); + +asm(".global scePthreadCondDestroy\n" + ".type scePthreadCondDestroy @function\n" + "scePthreadCondDestroy:\n"); + +asm(".global scePthreadCondInit\n" + ".type scePthreadCondInit @function\n" + "scePthreadCondInit:\n"); + +asm(".global scePthreadCondSignal\n" + ".type scePthreadCondSignal @function\n" + "scePthreadCondSignal:\n"); + +asm(".global scePthreadCondSignalto\n" + ".type scePthreadCondSignalto @function\n" + "scePthreadCondSignalto:\n"); + +asm(".global scePthreadCondTimedwait\n" + ".type scePthreadCondTimedwait @function\n" + "scePthreadCondTimedwait:\n"); + +asm(".global scePthreadCondWait\n" + ".type scePthreadCondWait @function\n" + "scePthreadCondWait:\n"); + +asm(".global scePthreadCondattrDestroy\n" + ".type scePthreadCondattrDestroy @function\n" + "scePthreadCondattrDestroy:\n"); + +asm(".global scePthreadCondattrGetclock\n" + ".type scePthreadCondattrGetclock @function\n" + "scePthreadCondattrGetclock:\n"); + +asm(".global scePthreadCondattrGetpshared\n" + ".type scePthreadCondattrGetpshared @function\n" + "scePthreadCondattrGetpshared:\n"); + +asm(".global scePthreadCondattrInit\n" + ".type scePthreadCondattrInit @function\n" + "scePthreadCondattrInit:\n"); + +asm(".global scePthreadCondattrSetclock\n" + ".type scePthreadCondattrSetclock @function\n" + "scePthreadCondattrSetclock:\n"); + +asm(".global scePthreadCondattrSetpshared\n" + ".type scePthreadCondattrSetpshared @function\n" + "scePthreadCondattrSetpshared:\n"); + +asm(".global scePthreadCreate\n" + ".type scePthreadCreate @function\n" + "scePthreadCreate:\n"); + +asm(".global scePthreadDetach\n" + ".type scePthreadDetach @function\n" + "scePthreadDetach:\n"); + +asm(".global scePthreadEqual\n" + ".type scePthreadEqual @function\n" + "scePthreadEqual:\n"); + +asm(".global scePthreadExit\n" + ".type scePthreadExit @function\n" + "scePthreadExit:\n"); + +asm(".global scePthreadGetaffinity\n" + ".type scePthreadGetaffinity @function\n" + "scePthreadGetaffinity:\n"); + +asm(".global scePthreadGetconcurrency\n" + ".type scePthreadGetconcurrency @function\n" + "scePthreadGetconcurrency:\n"); + +asm(".global scePthreadGetcpuclockid\n" + ".type scePthreadGetcpuclockid @function\n" + "scePthreadGetcpuclockid:\n"); + +asm(".global scePthreadGetname\n" + ".type scePthreadGetname @function\n" + "scePthreadGetname:\n"); + +asm(".global scePthreadGetprio\n" + ".type scePthreadGetprio @function\n" + "scePthreadGetprio:\n"); + +asm(".global scePthreadGetschedparam\n" + ".type scePthreadGetschedparam @function\n" + "scePthreadGetschedparam:\n"); + +asm(".global scePthreadGetspecific\n" + ".type scePthreadGetspecific @function\n" + "scePthreadGetspecific:\n"); + +asm(".global scePthreadGetthreadid\n" + ".type scePthreadGetthreadid @function\n" + "scePthreadGetthreadid:\n"); + +asm(".global scePthreadJoin\n" + ".type scePthreadJoin @function\n" + "scePthreadJoin:\n"); + +asm(".global scePthreadKeyCreate\n" + ".type scePthreadKeyCreate @function\n" + "scePthreadKeyCreate:\n"); + +asm(".global scePthreadKeyDelete\n" + ".type scePthreadKeyDelete @function\n" + "scePthreadKeyDelete:\n"); + +asm(".global scePthreadMain\n" + ".type scePthreadMain @function\n" + "scePthreadMain:\n"); + +asm(".global scePthreadMulti\n" + ".type scePthreadMulti @function\n" + "scePthreadMulti:\n"); + +asm(".global scePthreadMutexDestroy\n" + ".type scePthreadMutexDestroy @function\n" + "scePthreadMutexDestroy:\n"); + +asm(".global scePthreadMutexGetprioceiling\n" + ".type scePthreadMutexGetprioceiling @function\n" + "scePthreadMutexGetprioceiling:\n"); + +asm(".global scePthreadMutexGetspinloops\n" + ".type scePthreadMutexGetspinloops @function\n" + "scePthreadMutexGetspinloops:\n"); + +asm(".global scePthreadMutexGetyieldloops\n" + ".type scePthreadMutexGetyieldloops @function\n" + "scePthreadMutexGetyieldloops:\n"); + +asm(".global scePthreadMutexInit\n" + ".type scePthreadMutexInit @function\n" + "scePthreadMutexInit:\n"); + +asm(".global scePthreadMutexInitForInternalLibc\n" + ".type scePthreadMutexInitForInternalLibc @function\n" + "scePthreadMutexInitForInternalLibc:\n"); + +asm(".global scePthreadMutexIsowned\n" + ".type scePthreadMutexIsowned @function\n" + "scePthreadMutexIsowned:\n"); + +asm(".global scePthreadMutexLock\n" + ".type scePthreadMutexLock @function\n" + "scePthreadMutexLock:\n"); + +asm(".global scePthreadMutexSetprioceiling\n" + ".type scePthreadMutexSetprioceiling @function\n" + "scePthreadMutexSetprioceiling:\n"); + +asm(".global scePthreadMutexSetspinloops\n" + ".type scePthreadMutexSetspinloops @function\n" + "scePthreadMutexSetspinloops:\n"); + +asm(".global scePthreadMutexSetyieldloops\n" + ".type scePthreadMutexSetyieldloops @function\n" + "scePthreadMutexSetyieldloops:\n"); + +asm(".global scePthreadMutexTimedlock\n" + ".type scePthreadMutexTimedlock @function\n" + "scePthreadMutexTimedlock:\n"); + +asm(".global scePthreadMutexTrylock\n" + ".type scePthreadMutexTrylock @function\n" + "scePthreadMutexTrylock:\n"); + +asm(".global scePthreadMutexUnlock\n" + ".type scePthreadMutexUnlock @function\n" + "scePthreadMutexUnlock:\n"); + +asm(".global scePthreadMutexattrDestroy\n" + ".type scePthreadMutexattrDestroy @function\n" + "scePthreadMutexattrDestroy:\n"); + +asm(".global scePthreadMutexattrGetgen\n" + ".type scePthreadMutexattrGetgen @function\n" + "scePthreadMutexattrGetgen:\n"); + +asm(".global scePthreadMutexattrGetkind\n" + ".type scePthreadMutexattrGetkind @function\n" + "scePthreadMutexattrGetkind:\n"); + +asm(".global scePthreadMutexattrGetprioceiling\n" + ".type scePthreadMutexattrGetprioceiling @function\n" + "scePthreadMutexattrGetprioceiling:\n"); + +asm(".global scePthreadMutexattrGetprotocol\n" + ".type scePthreadMutexattrGetprotocol @function\n" + "scePthreadMutexattrGetprotocol:\n"); + +asm(".global scePthreadMutexattrGetpshared\n" + ".type scePthreadMutexattrGetpshared @function\n" + "scePthreadMutexattrGetpshared:\n"); + +asm(".global scePthreadMutexattrGettype\n" + ".type scePthreadMutexattrGettype @function\n" + "scePthreadMutexattrGettype:\n"); + +asm(".global scePthreadMutexattrInit\n" + ".type scePthreadMutexattrInit @function\n" + "scePthreadMutexattrInit:\n"); + +asm(".global scePthreadMutexattrInitForInternalLibc\n" + ".type scePthreadMutexattrInitForInternalLibc @function\n" + "scePthreadMutexattrInitForInternalLibc:\n"); + +asm(".global scePthreadMutexattrSetgen\n" + ".type scePthreadMutexattrSetgen @function\n" + "scePthreadMutexattrSetgen:\n"); + +asm(".global scePthreadMutexattrSetkind\n" + ".type scePthreadMutexattrSetkind @function\n" + "scePthreadMutexattrSetkind:\n"); + +asm(".global scePthreadMutexattrSetprioceiling\n" + ".type scePthreadMutexattrSetprioceiling @function\n" + "scePthreadMutexattrSetprioceiling:\n"); + +asm(".global scePthreadMutexattrSetprotocol\n" + ".type scePthreadMutexattrSetprotocol @function\n" + "scePthreadMutexattrSetprotocol:\n"); + +asm(".global scePthreadMutexattrSetpshared\n" + ".type scePthreadMutexattrSetpshared @function\n" + "scePthreadMutexattrSetpshared:\n"); + +asm(".global scePthreadMutexattrSettype\n" + ".type scePthreadMutexattrSettype @function\n" + "scePthreadMutexattrSettype:\n"); + +asm(".global scePthreadOnce\n" + ".type scePthreadOnce @function\n" + "scePthreadOnce:\n"); + +asm(".global scePthreadRegisterThreadDeathHook\n" + ".type scePthreadRegisterThreadDeathHook @function\n" + "scePthreadRegisterThreadDeathHook:\n"); + +asm(".global scePthreadRename\n" + ".type scePthreadRename @function\n" + "scePthreadRename:\n"); + +asm(".global scePthreadResume\n" + ".type scePthreadResume @function\n" + "scePthreadResume:\n"); + +asm(".global scePthreadResumeAll\n" + ".type scePthreadResumeAll @function\n" + "scePthreadResumeAll:\n"); + +asm(".global scePthreadRwlockDestroy\n" + ".type scePthreadRwlockDestroy @function\n" + "scePthreadRwlockDestroy:\n"); + +asm(".global scePthreadRwlockInit\n" + ".type scePthreadRwlockInit @function\n" + "scePthreadRwlockInit:\n"); + +asm(".global scePthreadRwlockRdlock\n" + ".type scePthreadRwlockRdlock @function\n" + "scePthreadRwlockRdlock:\n"); + +asm(".global scePthreadRwlockTimedrdlock\n" + ".type scePthreadRwlockTimedrdlock @function\n" + "scePthreadRwlockTimedrdlock:\n"); + +asm(".global scePthreadRwlockTimedwrlock\n" + ".type scePthreadRwlockTimedwrlock @function\n" + "scePthreadRwlockTimedwrlock:\n"); + +asm(".global scePthreadRwlockTryrdlock\n" + ".type scePthreadRwlockTryrdlock @function\n" + "scePthreadRwlockTryrdlock:\n"); + +asm(".global scePthreadRwlockTrywrlock\n" + ".type scePthreadRwlockTrywrlock @function\n" + "scePthreadRwlockTrywrlock:\n"); + +asm(".global scePthreadRwlockUnlock\n" + ".type scePthreadRwlockUnlock @function\n" + "scePthreadRwlockUnlock:\n"); + +asm(".global scePthreadRwlockWrlock\n" + ".type scePthreadRwlockWrlock @function\n" + "scePthreadRwlockWrlock:\n"); + +asm(".global scePthreadRwlockattrDestroy\n" + ".type scePthreadRwlockattrDestroy @function\n" + "scePthreadRwlockattrDestroy:\n"); + +asm(".global scePthreadRwlockattrGetpshared\n" + ".type scePthreadRwlockattrGetpshared @function\n" + "scePthreadRwlockattrGetpshared:\n"); + +asm(".global scePthreadRwlockattrGettype\n" + ".type scePthreadRwlockattrGettype @function\n" + "scePthreadRwlockattrGettype:\n"); + +asm(".global scePthreadRwlockattrInit\n" + ".type scePthreadRwlockattrInit @function\n" + "scePthreadRwlockattrInit:\n"); + +asm(".global scePthreadRwlockattrSetpshared\n" + ".type scePthreadRwlockattrSetpshared @function\n" + "scePthreadRwlockattrSetpshared:\n"); + +asm(".global scePthreadRwlockattrSettype\n" + ".type scePthreadRwlockattrSettype @function\n" + "scePthreadRwlockattrSettype:\n"); + +asm(".global scePthreadSelf\n" + ".type scePthreadSelf @function\n" + "scePthreadSelf:\n"); + +asm(".global scePthreadSemDestroy\n" + ".type scePthreadSemDestroy @function\n" + "scePthreadSemDestroy:\n"); + +asm(".global scePthreadSemGetvalue\n" + ".type scePthreadSemGetvalue @function\n" + "scePthreadSemGetvalue:\n"); + +asm(".global scePthreadSemInit\n" + ".type scePthreadSemInit @function\n" + "scePthreadSemInit:\n"); + +asm(".global scePthreadSemPost\n" + ".type scePthreadSemPost @function\n" + "scePthreadSemPost:\n"); + +asm(".global scePthreadSemTimedwait\n" + ".type scePthreadSemTimedwait @function\n" + "scePthreadSemTimedwait:\n"); + +asm(".global scePthreadSemTrywait\n" + ".type scePthreadSemTrywait @function\n" + "scePthreadSemTrywait:\n"); + +asm(".global scePthreadSemWait\n" + ".type scePthreadSemWait @function\n" + "scePthreadSemWait:\n"); + +asm(".global scePthreadSetBesteffort\n" + ".type scePthreadSetBesteffort @function\n" + "scePthreadSetBesteffort:\n"); + +asm(".global scePthreadSetDefaultstacksize\n" + ".type scePthreadSetDefaultstacksize @function\n" + "scePthreadSetDefaultstacksize:\n"); + +asm(".global scePthreadSetName\n" + ".type scePthreadSetName @function\n" + "scePthreadSetName:\n"); + +asm(".global scePthreadSetaffinity\n" + ".type scePthreadSetaffinity @function\n" + "scePthreadSetaffinity:\n"); + +asm(".global scePthreadSetcancelstate\n" + ".type scePthreadSetcancelstate @function\n" + "scePthreadSetcancelstate:\n"); + +asm(".global scePthreadSetcanceltype\n" + ".type scePthreadSetcanceltype @function\n" + "scePthreadSetcanceltype:\n"); + +asm(".global scePthreadSetconcurrency\n" + ".type scePthreadSetconcurrency @function\n" + "scePthreadSetconcurrency:\n"); + +asm(".global scePthreadSetprio\n" + ".type scePthreadSetprio @function\n" + "scePthreadSetprio:\n"); + +asm(".global scePthreadSetschedparam\n" + ".type scePthreadSetschedparam @function\n" + "scePthreadSetschedparam:\n"); + +asm(".global scePthreadSetspecific\n" + ".type scePthreadSetspecific @function\n" + "scePthreadSetspecific:\n"); + +asm(".global scePthreadSingle\n" + ".type scePthreadSingle @function\n" + "scePthreadSingle:\n"); + +asm(".global scePthreadSuspend\n" + ".type scePthreadSuspend @function\n" + "scePthreadSuspend:\n"); + +asm(".global scePthreadSuspendAll\n" + ".type scePthreadSuspendAll @function\n" + "scePthreadSuspendAll:\n"); + +asm(".global scePthreadTestcancel\n" + ".type scePthreadTestcancel @function\n" + "scePthreadTestcancel:\n"); + +asm(".global scePthreadTimedjoin\n" + ".type scePthreadTimedjoin @function\n" + "scePthreadTimedjoin:\n"); + +asm(".global scePthreadYield\n" + ".type scePthreadYield @function\n" + "scePthreadYield:\n"); + +asm(".global sched_get_priority_max\n" + ".type sched_get_priority_max @function\n" + "sched_get_priority_max:\n"); + +asm(".global sched_get_priority_min\n" + ".type sched_get_priority_min @function\n" + "sched_get_priority_min:\n"); + +asm(".global sched_getparam\n" + ".type sched_getparam @function\n" + "sched_getparam:\n"); + +asm(".global sched_getscheduler\n" + ".type sched_getscheduler @function\n" + "sched_getscheduler:\n"); + +asm(".global sched_rr_get_interval\n" + ".type sched_rr_get_interval @function\n" + "sched_rr_get_interval:\n"); + +asm(".global sched_setparam\n" + ".type sched_setparam @function\n" + "sched_setparam:\n"); + +asm(".global sched_setscheduler\n" + ".type sched_setscheduler @function\n" + "sched_setscheduler:\n"); + +asm(".global sched_yield\n" + ".type sched_yield @function\n" + "sched_yield:\n"); + +asm(".global select\n" + ".type select @function\n" + "select:\n"); + +asm(".global sem_close\n" + ".type sem_close @function\n" + "sem_close:\n"); + +asm(".global sem_destroy\n" + ".type sem_destroy @function\n" + "sem_destroy:\n"); + +asm(".global sem_getvalue\n" + ".type sem_getvalue @function\n" + "sem_getvalue:\n"); + +asm(".global sem_init\n" + ".type sem_init @function\n" + "sem_init:\n"); + +asm(".global sem_open\n" + ".type sem_open @function\n" + "sem_open:\n"); + +asm(".global sem_post\n" + ".type sem_post @function\n" + "sem_post:\n"); + +asm(".global sem_reltimedwait_np\n" + ".type sem_reltimedwait_np @function\n" + "sem_reltimedwait_np:\n"); + +asm(".global sem_setname\n" + ".type sem_setname @function\n" + "sem_setname:\n"); + +asm(".global sem_timedwait\n" + ".type sem_timedwait @function\n" + "sem_timedwait:\n"); + +asm(".global sem_trywait\n" + ".type sem_trywait @function\n" + "sem_trywait:\n"); + +asm(".global sem_unlink\n" + ".type sem_unlink @function\n" + "sem_unlink:\n"); + +asm(".global sem_wait\n" + ".type sem_wait @function\n" + "sem_wait:\n"); + +asm(".global send\n" + ".type send @function\n" + "send:\n"); + +asm(".global sendfile\n" + ".type sendfile @function\n" + "sendfile:\n"); + +asm(".global sendmsg\n" + ".type sendmsg @function\n" + "sendmsg:\n"); + +asm(".global sendto\n" + ".type sendto @function\n" + "sendto:\n"); + +asm(".global set_phys_fmem_limit\n" + ".type set_phys_fmem_limit @function\n" + "set_phys_fmem_limit:\n"); + +asm(".global setcontext\n" + ".type setcontext @function\n" + "setcontext:\n"); + +asm(".global setegid\n" + ".type setegid @function\n" + "setegid:\n"); + +asm(".global seteuid\n" + ".type seteuid @function\n" + "seteuid:\n"); + +asm(".global setgroups\n" + ".type setgroups @function\n" + "setgroups:\n"); + +asm(".global setitimer\n" + ".type setitimer @function\n" + "setitimer:\n"); + +asm(".global setlogin\n" + ".type setlogin @function\n" + "setlogin:\n"); + +asm(".global setpgid\n" + ".type setpgid @function\n" + "setpgid:\n"); + +asm(".global setpriority\n" + ".type setpriority @function\n" + "setpriority:\n"); + +asm(".global setregid\n" + ".type setregid @function\n" + "setregid:\n"); + +asm(".global setreuid\n" + ".type setreuid @function\n" + "setreuid:\n"); + +asm(".global setrlimit\n" + ".type setrlimit @function\n" + "setrlimit:\n"); + +asm(".global setsid\n" + ".type setsid @function\n" + "setsid:\n"); + +asm(".global setsockopt\n" + ".type setsockopt @function\n" + "setsockopt:\n"); + +asm(".global settimeofday\n" + ".type settimeofday @function\n" + "settimeofday:\n"); + +asm(".global setuid\n" + ".type setuid @function\n" + "setuid:\n"); + +asm(".global shm_open\n" + ".type shm_open @function\n" + "shm_open:\n"); + +asm(".global shm_unlink\n" + ".type shm_unlink @function\n" + "shm_unlink:\n"); + +asm(".global shutdown\n" + ".type shutdown @function\n" + "shutdown:\n"); + +asm(".global sigaction\n" + ".type sigaction @function\n" + "sigaction:\n"); + +asm(".global sigaddset\n" + ".type sigaddset @function\n" + "sigaddset:\n"); + +asm(".global sigaltstack\n" + ".type sigaltstack @function\n" + "sigaltstack:\n"); + +asm(".global sigdelset\n" + ".type sigdelset @function\n" + "sigdelset:\n"); + +asm(".global sigemptyset\n" + ".type sigemptyset @function\n" + "sigemptyset:\n"); + +asm(".global sigfillset\n" + ".type sigfillset @function\n" + "sigfillset:\n"); + +asm(".global sigismember\n" + ".type sigismember @function\n" + "sigismember:\n"); + +asm(".global siglongjmp\n" + ".type siglongjmp @function\n" + "siglongjmp:\n"); + +asm(".global signal\n" + ".type signal @function\n" + "signal:\n"); + +asm(".global sigpending\n" + ".type sigpending @function\n" + "sigpending:\n"); + +asm(".global sigprocmask\n" + ".type sigprocmask @function\n" + "sigprocmask:\n"); + +asm(".global sigqueue\n" + ".type sigqueue @function\n" + "sigqueue:\n"); + +asm(".global sigreturn\n" + ".type sigreturn @function\n" + "sigreturn:\n"); + +asm(".global sigsetjmp\n" + ".type sigsetjmp @function\n" + "sigsetjmp:\n"); + +asm(".global sigsuspend\n" + ".type sigsuspend @function\n" + "sigsuspend:\n"); + +asm(".global sigtimedwait\n" + ".type sigtimedwait @function\n" + "sigtimedwait:\n"); + +asm(".global sigwait\n" + ".type sigwait @function\n" + "sigwait:\n"); + +asm(".global sigwaitinfo\n" + ".type sigwaitinfo @function\n" + "sigwaitinfo:\n"); + +asm(".global sleep\n" + ".type sleep @function\n" + "sleep:\n"); + +asm(".global socket\n" + ".type socket @function\n" + "socket:\n"); + +asm(".global socketpair\n" + ".type socketpair @function\n" + "socketpair:\n"); + +asm(".global stat\n" + ".type stat @function\n" + "stat:\n"); + +asm(".global statfs\n" + ".type statfs @function\n" + "statfs:\n"); + +asm(".global swapcontext\n" + ".type swapcontext @function\n" + "swapcontext:\n"); + +asm(".global swapon\n" + ".type swapon @function\n" + "swapon:\n"); + +asm(".global symlink\n" + ".type symlink @function\n" + "symlink:\n"); + +asm(".global symlinkat\n" + ".type symlinkat @function\n" + "symlinkat:\n"); + +asm(".global sync\n" + ".type sync @function\n" + "sync:\n"); + +asm(".global sysKernelGetIntdevModeForInternalLibc\n" + ".type sysKernelGetIntdevModeForInternalLibc @function\n" + "sysKernelGetIntdevModeForInternalLibc:\n"); + +asm(".global sysKernelGetIntdevModeForRcmgr\n" + ".type sysKernelGetIntdevModeForRcmgr @function\n" + "sysKernelGetIntdevModeForRcmgr:\n"); + +asm(".global sysKernelGetLowerLimitSysexVersion\n" + ".type sysKernelGetLowerLimitSysexVersion @function\n" + "sysKernelGetLowerLimitSysexVersion:\n"); + +asm(".global sysKernelGetLowerLimitUpdVersion\n" + ".type sysKernelGetLowerLimitUpdVersion @function\n" + "sysKernelGetLowerLimitUpdVersion:\n"); + +asm(".global sysKernelGetManufacturingMode\n" + ".type sysKernelGetManufacturingMode @function\n" + "sysKernelGetManufacturingMode:\n"); + +asm(".global sysKernelGetUpdVersion\n" + ".type sysKernelGetUpdVersion @function\n" + "sysKernelGetUpdVersion:\n"); + +asm(".global sysarch\n" + ".type sysarch @function\n" + "sysarch:\n"); + +asm(".global sysc_e00\n" + ".type sysc_e00 @function\n" + "sysc_e00:\n"); + +asm(".global sysc_m00\n" + ".type sysc_m00 @function\n" + "sysc_m00:\n"); + +asm(".global sysc_s00\n" + ".type sysc_s00 @function\n" + "sysc_s00:\n"); + +asm(".global sysconf\n" + ".type sysconf @function\n" + "sysconf:\n"); + +asm(".global sysctl\n" + ".type sysctl @function\n" + "sysctl:\n"); + +asm(".global sysctlbyname\n" + ".type sysctlbyname @function\n" + "sysctlbyname:\n"); + +asm(".global sysctlnametomib\n" + ".type sysctlnametomib @function\n" + "sysctlnametomib:\n"); + +asm(".global system\n" + ".type system @function\n" + "system:\n"); + +asm(".global tcdrain\n" + ".type tcdrain @function\n" + "tcdrain:\n"); + +asm(".global tcflow\n" + ".type tcflow @function\n" + "tcflow:\n"); + +asm(".global tcflush\n" + ".type tcflush @function\n" + "tcflush:\n"); + +asm(".global tcgetattr\n" + ".type tcgetattr @function\n" + "tcgetattr:\n"); + +asm(".global tcgetpgrp\n" + ".type tcgetpgrp @function\n" + "tcgetpgrp:\n"); + +asm(".global tcgetsid\n" + ".type tcgetsid @function\n" + "tcgetsid:\n"); + +asm(".global tcsendbreak\n" + ".type tcsendbreak @function\n" + "tcsendbreak:\n"); + +asm(".global tcsetattr\n" + ".type tcsetattr @function\n" + "tcsetattr:\n"); + +asm(".global tcsetpgrp\n" + ".type tcsetpgrp @function\n" + "tcsetpgrp:\n"); + +asm(".global tcsetsid\n" + ".type tcsetsid @function\n" + "tcsetsid:\n"); + +asm(".global truncate\n" + ".type truncate @function\n" + "truncate:\n"); + +asm(".global umask\n" + ".type umask @function\n" + "umask:\n"); + +asm(".global unlink\n" + ".type unlink @function\n" + "unlink:\n"); + +asm(".global unlinkat\n" + ".type unlinkat @function\n" + "unlinkat:\n"); + +asm(".global unmount\n" + ".type unmount @function\n" + "unmount:\n"); + +asm(".global usleep\n" + ".type usleep @function\n" + "usleep:\n"); + +asm(".global utimes\n" + ".type utimes @function\n" + "utimes:\n"); + +asm(".global utrace\n" + ".type utrace @function\n" + "utrace:\n"); + +asm(".global uuidgen\n" + ".type uuidgen @function\n" + "uuidgen:\n"); + +asm(".global vfork\n" + ".type vfork @function\n" + "vfork:\n"); + +asm(".global wait\n" + ".type wait @function\n" + "wait:\n"); + +asm(".global wait3\n" + ".type wait3 @function\n" + "wait3:\n"); + +asm(".global wait4\n" + ".type wait4 @function\n" + "wait4:\n"); + +asm(".global waitpid\n" + ".type waitpid @function\n" + "waitpid:\n"); + +asm(".global write\n" + ".type write @function\n" + "write:\n"); + +asm(".global writev\n" + ".type writev @function\n" + "writev:\n"); + +asm(".global __progname\n" + ".type __progname, @object\n" + "__progname:\n"); + +asm(".global __stack_chk_guard\n" + ".type __stack_chk_guard, @object\n" + "__stack_chk_guard:\n"); + +asm(".global _sigintr\n" + ".type _sigintr, @object\n" + "_sigintr:\n"); + +asm(".global environ\n" + ".type environ, @object\n" + "environ:\n"); + +asm(".global errno\n" + ".type errno, @object\n" + "errno:\n"); diff --git a/web/index.html b/web/index.html index b8d6472..c863dee 100644 --- a/web/index.html +++ b/web/index.html @@ -509,6 +509,7 @@

Settings

+ @@ -673,6 +674,7 @@

Debug log

updateFakelibEmulators: "Update game fakelib emulators", autoUpdateAmpr: "Update AMPR emulator from GitHub", autoRemoveMissingGames: "Remove unavailable app icons", + pkgInstallEnabled: "Install standalone PKG files", autoRemoveDelay: "Removal delay (seconds)", allowLanAccess: "Allow local network access", fanTemperature: "Fan target", @@ -847,6 +849,7 @@

Debug log

updateFakelibEmulators: "Обновлять эмуляторы в fakelib игр", autoUpdateAmpr: "Обновлять эмулятор AMPR с GitHub", autoRemoveMissingGames: "Удалять иконки недоступных приложений", + pkgInstallEnabled: "Устанавливать отдельные PKG-файлы", autoRemoveDelay: "Задержка удаления (секунды)", allowLanAccess: "Разрешить доступ из локальной сети", fanTemperature: "Целевая температура", @@ -1563,6 +1566,7 @@

Debug log

$("fakelibDefaultMode").value = settings.fakelib_default_mode || "full"; $("autoUpdateAmpr").checked = Boolean(settings.auto_update_ampr); $("autoRemoveMissingGames").checked = Boolean(settings.auto_remove_missing_games); + $("pkgInstallEnabled").checked = Boolean(settings.pkg_install_enabled); $("autoRemoveMissingDelay").value = String(settings.auto_remove_missing_delay_seconds || 300); syncAutoRemoveControls(); $("allowLanAccess").checked = Boolean(settings.allow_lan_access); @@ -1605,6 +1609,7 @@

Debug log

fakelib_default_mode: $("fakelibDefaultMode").value, auto_update_ampr: $("autoUpdateAmpr").checked, auto_remove_missing_games: $("autoRemoveMissingGames").checked, + pkg_install_enabled: $("pkgInstallEnabled").checked, auto_remove_missing_delay_seconds: Number($("autoRemoveMissingDelay").value), allow_lan_access: $("allowLanAccess").checked, fan_target_temperature: Number($("fanTemperature").value),