Fix doesn't fix unicorn itself as it still depends on RWX mappings to work.
No functional change intended for Unicorn itself. Inspired by emulators/keystone and emulators/py-keystone. Tested on NetBSD/amd64.