On x86 and x86_64 targets, the process must have the PROCMGR_AID_IO ability enabled, and the calling thread must have I/O privileges, or else it will fault with a SIGSEGV; see procmgr_ability(), and the ThreadCtl() _NTO_TCTL_IO command.
The SIGSEGV would explain the ‘target going down’ on your in32() call.
It would help if you posted some sample code of everything you are doing related to this effort so we can see what’s going on better.