Browse Source
To move the main api.c to a single build compilation object we need to start splitting out user and system specific code. As we need to grob around host headers we move these particular helpers into the *-user mode directories. The binary/start/end/entry helpers are all NOPs for system mode. While using the plugin-api.c.inc trick means we build for both linux-user and bsd-user the BSD user-mode command line is still missing -plugin. This can be enabled once we have reliable check-tcg tests working for the BSDs. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Warner Losh <imp@bsdimp.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20250304222439.2035603-27-alex.bennee@linaro.org>pull/291/head
8 changed files with 115 additions and 44 deletions
@ -0,0 +1,15 @@ |
|||
/*
|
|||
* QEMU Plugin API - bsd-user-mode only implementations |
|||
* |
|||
* Common user-mode only APIs are in plugins/api-user. These helpers |
|||
* are only specific to bsd-user. |
|||
* |
|||
* Copyright (C) 2017, Emilio G. Cota <cota@braap.org> |
|||
* Copyright (C) 2019-2025, Linaro |
|||
* |
|||
* SPDX-License-Identifier: GPL-2.0-or-later |
|||
*/ |
|||
|
|||
#include "qemu/osdep.h" |
|||
#include "qemu.h" |
|||
#include "common-user/plugin-api.c.inc" |
|||
@ -0,0 +1,43 @@ |
|||
/* |
|||
* QEMU Plugin API - *-user-mode only implementations |
|||
* |
|||
* Common user-mode only APIs are in plugins/api-user. These helpers |
|||
* are only specific to the *-user frontends. |
|||
* |
|||
* Copyright (C) 2017, Emilio G. Cota <cota@braap.org> |
|||
* Copyright (C) 2019-2025, Linaro |
|||
* |
|||
* SPDX-License-Identifier: GPL-2.0-or-later |
|||
*/ |
|||
|
|||
#include "qemu/osdep.h" |
|||
#include "qemu/main-loop.h" |
|||
#include "qemu/plugin.h" |
|||
#include "qemu.h" |
|||
|
|||
/* |
|||
* Binary path, start and end locations. Host specific due to TaskState. |
|||
*/ |
|||
const char *qemu_plugin_path_to_binary(void) |
|||
{ |
|||
TaskState *ts = get_task_state(current_cpu); |
|||
return g_strdup(ts->bprm->filename); |
|||
} |
|||
|
|||
uint64_t qemu_plugin_start_code(void) |
|||
{ |
|||
TaskState *ts = get_task_state(current_cpu); |
|||
return ts->info->start_code; |
|||
} |
|||
|
|||
uint64_t qemu_plugin_end_code(void) |
|||
{ |
|||
TaskState *ts = get_task_state(current_cpu); |
|||
return ts->info->end_code; |
|||
} |
|||
|
|||
uint64_t qemu_plugin_entry_code(void) |
|||
{ |
|||
TaskState *ts = get_task_state(current_cpu); |
|||
return ts->info->entry; |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
/*
|
|||
* QEMU Plugin API - linux-user-mode only implementations |
|||
* |
|||
* Common user-mode only APIs are in plugins/api-user. These helpers |
|||
* are only specific to linux-user. |
|||
* |
|||
* Copyright (C) 2017, Emilio G. Cota <cota@braap.org> |
|||
* Copyright (C) 2019-2025, Linaro |
|||
* |
|||
* SPDX-License-Identifier: GPL-2.0-or-later |
|||
*/ |
|||
|
|||
#include "qemu/osdep.h" |
|||
#include "qemu.h" |
|||
#include "common-user/plugin-api.c.inc" |
|||
@ -0,0 +1,39 @@ |
|||
/*
|
|||
* QEMU Plugin API - System specific implementations |
|||
* |
|||
* This provides the APIs that have a specific system implementation |
|||
* or are only relevant to system-mode. |
|||
* |
|||
* Copyright (C) 2017, Emilio G. Cota <cota@braap.org> |
|||
* Copyright (C) 2019-2025, Linaro |
|||
* |
|||
* SPDX-License-Identifier: GPL-2.0-or-later |
|||
*/ |
|||
|
|||
#include "qemu/osdep.h" |
|||
#include "qemu/main-loop.h" |
|||
#include "qemu/plugin.h" |
|||
|
|||
/*
|
|||
* In system mode we cannot trace the binary being executed so the |
|||
* helpers all return NULL/0. |
|||
*/ |
|||
const char *qemu_plugin_path_to_binary(void) |
|||
{ |
|||
return NULL; |
|||
} |
|||
|
|||
uint64_t qemu_plugin_start_code(void) |
|||
{ |
|||
return 0; |
|||
} |
|||
|
|||
uint64_t qemu_plugin_end_code(void) |
|||
{ |
|||
return 0; |
|||
} |
|||
|
|||
uint64_t qemu_plugin_entry_code(void) |
|||
{ |
|||
return 0; |
|||
} |
|||
Loading…
Reference in new issue