1708b6a64SAlex Bennée /* 2708b6a64SAlex Bennée * exit support for qemu 3708b6a64SAlex Bennée * 4708b6a64SAlex Bennée * Copyright (c) 2018 Alex Bennée <alex.bennee@linaro.org> 5708b6a64SAlex Bennée * 6708b6a64SAlex Bennée * This program is free software; you can redistribute it and/or modify 7708b6a64SAlex Bennée * it under the terms of the GNU General Public License as published by 8708b6a64SAlex Bennée * the Free Software Foundation; either version 2 of the License, or 9708b6a64SAlex Bennée * (at your option) any later version. 10708b6a64SAlex Bennée * 11708b6a64SAlex Bennée * This program is distributed in the hope that it will be useful, 12708b6a64SAlex Bennée * but WITHOUT ANY WARRANTY; without even the implied warranty of 13708b6a64SAlex Bennée * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14708b6a64SAlex Bennée * GNU General Public License for more details. 15708b6a64SAlex Bennée * 16708b6a64SAlex Bennée * You should have received a copy of the GNU General Public License 17708b6a64SAlex Bennée * along with this program; if not, see <http://www.gnu.org/licenses/>. 18708b6a64SAlex Bennée */ 19708b6a64SAlex Bennée #include "qemu/osdep.h" 20*327b75a4SIlya Leoshkevich #include "tcg/perf.h" 21c566080cSAlex Bennée #include "gdbstub/syscalls.h" 22708b6a64SAlex Bennée #include "qemu.h" 233b249d26SPeter Maydell #include "user-internals.h" 24720ace24SRichard Henderson #include "qemu/plugin.h" 25708b6a64SAlex Bennée 267781afb4SAlex Bennée #ifdef CONFIG_GCOV 277781afb4SAlex Bennée extern void __gcov_dump(void); 287781afb4SAlex Bennée #endif 297781afb4SAlex Bennée preexit_cleanup(CPUArchState * env,int code)30708b6a64SAlex Bennéevoid preexit_cleanup(CPUArchState *env, int code) 31708b6a64SAlex Bennée { 327781afb4SAlex Bennée #ifdef CONFIG_GCOV 337781afb4SAlex Bennée __gcov_dump(); 347781afb4SAlex Bennée #endif 35ad9dcb20SAlex Bennée gdb_exit(code); 36f7e68c9cSAlex Bennée qemu_plugin_user_exit(); 375584e2dbSIlya Leoshkevich perf_exit(); 38708b6a64SAlex Bennée } 39