| 1 | /* |
| 2 | * QEMU TCG CPU loop API |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 5 | */ |
| 6 | #ifndef ACCEL_TCG_CPU_LOOP_COMMON_H |
| 7 | #define ACCEL_TCG_CPU_LOOP_COMMON_H |
| 8 | |
| 9 | #ifndef CONFIG_TCG |
| 10 | #error Can only include this header with TCG |
| 11 | #endif |
| 12 | |
| 13 | /** |
| 14 | * cpu_exec: |
| 15 | * @cpu: the cpu context |
| 16 | * |
| 17 | * Returns one of the EXCP_* definitions (see "exec/cpu-common.h"). |
| 18 | */ |
| 19 | int cpu_exec(CPUState *cpu); |
| 20 | |
| 21 | void cpu_exec_step_atomic(CPUState *cpu); |
| 22 | |
| 23 | /** |
| 24 | * cpu_unwind_state_data: |
| 25 | * @cpu: the cpu context |
| 26 | * @host_pc: the host pc within the translation |
| 27 | * @data: output data |
| 28 | * |
| 29 | * Attempt to load the unwind state for a host pc occurring in |
| 30 | * translated code. If @host_pc is not in translated code, the |
| 31 | * function returns false; otherwise @data is loaded. |
| 32 | * This is the same unwind info as given to restore_state_to_opc. |
| 33 | */ |
| 34 | bool cpu_unwind_state_data(CPUState *cpu, uintptr_t host_pc, uint64_t *data); |
| 35 | |
| 36 | /** |
| 37 | * cpu_restore_state: |
| 38 | * @cpu: the cpu context |
| 39 | * @host_pc: the host pc within the translation |
| 40 | * @return: true if state was restored, false otherwise |
| 41 | * |
| 42 | * Attempt to restore the state for a fault occurring in translated |
| 43 | * code. If @host_pc is not in translated code no state is |
| 44 | * restored and the function returns false. |
| 45 | */ |
| 46 | bool cpu_restore_state(CPUState *cpu, uintptr_t host_pc); |
| 47 | |
| 48 | /** |
| 49 | * cpu_loop_exit_noexc: |
| 50 | * @cpu: the cpu context |
| 51 | * |
| 52 | * Exit the current TB, but without causing any exception to be raised. |
| 53 | */ |
| 54 | G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu); |
| 55 | |
| 56 | /** |
| 57 | * cpu_loop_exit_restore: |
| 58 | * @cpu: the cpu context |
| 59 | * @host_pc: the host pc within the translation |
| 60 | * |
| 61 | * Attempt to restore the state for a fault occurring in translated |
| 62 | * code. If @host_pc is not in translated code no state is |
| 63 | * restored. Finally, exit the current TB. |
| 64 | */ |
| 65 | G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t host_pc); |
| 66 | G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t host_pc); |
| 67 | |
| 68 | /** |
| 69 | * cpu_loop_exit: |
| 70 | * @cpu: the cpu context |
| 71 | * |
| 72 | * Exit the current TB. |
| 73 | */ |
| 74 | G_NORETURN void cpu_loop_exit(CPUState *cpu); |
| 75 | |
| 76 | #endif |