xref: /openbmc/qemu/common-user/plugin-api.c.inc (revision c079d3a31e45093286c65f8ca5350beb3a4404a9)
1/*
2 * QEMU Plugin API - *-user-mode only implementations
3 *
4 * Common user-mode only APIs are in plugins/api-user. These helpers
5 * are only specific to the *-user frontends.
6 *
7 * Copyright (C) 2017, Emilio G. Cota <cota@braap.org>
8 * Copyright (C) 2019-2025, Linaro
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 */
12
13#include "qemu/osdep.h"
14#include "qemu/main-loop.h"
15#include "qemu/plugin.h"
16#include "accel/tcg/vcpu-state.h"
17#include "qemu.h"
18
19/*
20 * Binary path, start and end locations. Host specific due to TaskState.
21 */
22const char *qemu_plugin_path_to_binary(void)
23{
24    TaskState *ts = get_task_state(current_cpu);
25    return g_strdup(ts->bprm->filename);
26}
27
28uint64_t qemu_plugin_start_code(void)
29{
30    TaskState *ts = get_task_state(current_cpu);
31    return ts->info->start_code;
32}
33
34uint64_t qemu_plugin_end_code(void)
35{
36    TaskState *ts = get_task_state(current_cpu);
37    return ts->info->end_code;
38}
39
40uint64_t qemu_plugin_entry_code(void)
41{
42    TaskState *ts = get_task_state(current_cpu);
43    return ts->info->entry;
44}
45