linux-user: introduce preexit_cleanup

To avoid repeating ourselves move our preexit clean-up code into a
helper function. I figured the continuing effort to split of the
syscalls made it worthwhile creating a new file for it now.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
Alex Bennée 2018-06-22 17:09:10 +01:00
parent fe8bf5f629
commit 708b6a643c
4 changed files with 39 additions and 9 deletions

View file

@ -8022,10 +8022,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
}
cpu_list_unlock();
#ifdef TARGET_GPROF
_mcleanup();
#endif
gdb_exit(cpu_env, arg1);
preexit_cleanup(cpu_env, arg1);
_exit(arg1);
ret = 0; /* avoid warning */
break;
@ -10131,10 +10128,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#ifdef __NR_exit_group
/* new thread calls */
case TARGET_NR_exit_group:
#ifdef TARGET_GPROF
_mcleanup();
#endif
gdb_exit(cpu_env, arg1);
preexit_cleanup(cpu_env, arg1);
ret = get_errno(exit_group(arg1));
break;
#endif