reorg of syscall.c

plus some fixes I don't remember...