sys/compat/netbsd32 is great at running 32-bit NetBSD on a 64-bit kernel. But with a little tweaking, it could do so much more.
For example, aarch64 will need multiple instances of compat_netbsd32 (one for arm32 eabi, one for arm32 oabi, and possibly one for aarch64 ilp32 unless it can use the arm32 eabi) This requires being able to change the netbsd32_ that starts every function to something unique. Now if we are going that far, with a little more work we can separate out the netbsd32 specific pieces and have a generic "netbsd" on netbsd compat layer. This could be used on ARM or some MIPS, or even PowerPC to run a reverse endian userland (big endian user program on little endian kernel for example). Or improve the efficiency of running ARM OABI programs on an EABI kernel (since much of the netbsd32 compatibility isn’t needed and could be skipped). I have started some effort towards this and have a set of diffs at http://www.netbsd.org/~matt/netbsd32-diff.txt showing how syscalls could be handled. netbsd32_wait.c it the furthest along and being genericized. I particularly like the NETBSDX_SYSCALL(foo) and NETBSDX_COMPAT_SYSCALL(n, foo) macros simplify things.