add support for getgroups, getres{u,g}id

x86-64 needs the `getgroups(2)` syscall to pass some tests.  `getresuid(2)` and `getresgid(2)` need to be supported for parity with x86 (presumably for firefox?).

Also added a test to make sure we do the right thing with the 16-bit {u,g}id syscalls.  Not enthused about the x86-64 case, but I'm not sure what we can do better there.