thread: move tid_return() into ipc.c

Its only callsites are there, and with the exception of ExchangeRegisters, the
Ipc syscalls are the only ones that return a global/local TID based on which
space another thread is in.