Is the Riscose project of any relevance to this? From memory, they were trying something at least superficially similar: emulating SWI calls to enable RISC OS applications to work on top of Linux. If their sources are still available, might they be helpful?