Thanks to a suggestion from Bruno Haible, I solved the problem with registers getting garbled inside __mremap. It appears that this was a problem of Linux 2.3.31; after upgrading to Linux 2.3.39, the problem is gone. Thanks for all your help, Martin