implement syscall exit and write