reswitched/libtransistor

Call the NRO entry point in an asm thunk

roblabla opened this issue · 0 comments

Libnx sometimes returns from the entry point with a fucked up stack, which causes segfault and all other kind of goodies : https://github.com/switchbrew/libnx/blob/5b0de6c0546da3aa9af7cb6606fee48e091688d9/nx/source/runtime/env.c#L91

We should call the NRO in an asm thunk that backs up all registers before jumping to the entry point, and restoring the registers before returning.