plugin_loader: Make plugin reply timeout configurable (#2183)

This commit is contained in:
PabloMK7 2025-09-26 17:34:31 +02:00 committed by GitHub
parent 456a6b4ad7
commit 407c18e6fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 4 deletions

View File

@ -56,10 +56,12 @@ typedef struct
s32* plgldrEvent; ///< Used for synchronization s32* plgldrEvent; ///< Used for synchronization
s32* plgldrReply; ///< Used for synchronization s32* plgldrReply; ///< Used for synchronization
u8 notifyHomeEvent; u8 notifyHomeEvent;
u8 padding[3]; u8 padding[7];
u32 reserved[23]; u64 waitForReplyTimeout;
u32 reserved[20];
u32 config[32]; u32 config[32];
} PluginHeader; } PluginHeader;
_Static_assert(sizeof(PluginHeader) == 0x100, "Invalid PluginHeader size");
typedef void (*OnPlgLdrEventCb_t)(s32 eventType); typedef void (*OnPlgLdrEventCb_t)(s32 eventType);

View File

@ -270,6 +270,7 @@ bool TryToLoadPlugin(Handle process, bool isHomebrew)
} }
pluginHeader->version = header->version; pluginHeader->version = header->version;
pluginHeader->waitForReplyTimeout = 10000000000ULL;
// Code size must be page aligned // Code size must be page aligned
exeHdr = &header->executable; exeHdr = &header->executable;
pluginHeader->exeSize = (sizeof(PluginHeader) + exeHdr->codeSize + exeHdr->rodataSize + exeHdr->dataSize + exeHdr->bssSize + 0x1000) & ~0xFFF; pluginHeader->exeSize = (sizeof(PluginHeader) + exeHdr->codeSize + exeHdr->rodataSize + exeHdr->dataSize + exeHdr->bssSize + 0x1000) & ~0xFFF;

View File

@ -516,7 +516,7 @@ void PLG__WaitForReply(void)
{ {
if (PluginLoaderCtx.eventsSelfManaged) return; if (PluginLoaderCtx.eventsSelfManaged) return;
__strex__(PluginLoaderCtx.plgReplyPA, PLG_WAIT); __strex__(PluginLoaderCtx.plgReplyPA, PLG_WAIT);
svcArbitrateAddress(PluginLoaderCtx.arbiter, (u32)PluginLoaderCtx.plgReplyPA, ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT, PLG_OK, 10000000000ULL); svcArbitrateAddress(PluginLoaderCtx.arbiter, (u32)PluginLoaderCtx.plgReplyPA, ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT, PLG_OK, MemoryBlock__GetMappedPluginHeader()->waitForReplyTimeout);
} }
void PLG__SetConfigMemoryStatus(u32 status) void PLG__SetConfigMemoryStatus(u32 status)