xref: /openbmc/qemu/common-user/plugin-api.c.inc (revision 822405b1fea4f0f404df418bd70da0588b9207ce)
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 "qemu.h"
17
18/*
19 * Binary path, start and end locations. Host specific due to TaskState.
20 */
21const char *qemu_plugin_path_to_binary(void)
22{
23    TaskState *ts = get_task_state(current_cpu);
24    return g_strdup(ts->bprm->filename);
25}
26
27uint64_t qemu_plugin_start_code(void)
28{
29    TaskState *ts = get_task_state(current_cpu);
30    return ts->info->start_code;
31}
32
33uint64_t qemu_plugin_end_code(void)
34{
35    TaskState *ts = get_task_state(current_cpu);
36    return ts->info->end_code;
37}
38
39uint64_t qemu_plugin_entry_code(void)
40{
41    TaskState *ts = get_task_state(current_cpu);
42    return ts->info->entry;
43}
44