mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
semihosting: create SemihostingConfig structure and semihost.h
Remove semihosting_enabled and semihosting_target and replace them with SemihostingConfig structure containing equivalent fields. The structure is defined in vl.c where it is actually set. Also introduce separate header file include/exec/semihost.h allowing to access semihosting config related stuff from target specific semihosting code. Signed-off-by: Leon Alrae <leon.alrae@imgtec.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1434643256-16858-2-git-send-email-leon.alrae@imgtec.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
b58850e79d
commit
cfe67cef48
9 changed files with 87 additions and 28 deletions
38
vl.c
38
vl.c
|
@ -119,6 +119,7 @@ int main(int argc, char **argv)
|
|||
#include "qapi/opts-visitor.h"
|
||||
#include "qom/object_interfaces.h"
|
||||
#include "qapi-event.h"
|
||||
#include "exec/semihost.h"
|
||||
|
||||
#define MAX_VIRTIO_CONSOLES 1
|
||||
#define MAX_SCLP_CONSOLES 1
|
||||
|
@ -169,7 +170,6 @@ int graphic_rotate = 0;
|
|||
const char *watchdog;
|
||||
QEMUOptionRom option_rom[MAX_OPTION_ROMS];
|
||||
int nb_option_roms;
|
||||
int semihosting_enabled = 0;
|
||||
int old_param = 0;
|
||||
const char *qemu_name;
|
||||
int alt_grab = 0;
|
||||
|
@ -1245,6 +1245,26 @@ static void configure_msg(QemuOpts *opts)
|
|||
enable_timestamp_msg = qemu_opt_get_bool(opts, "timestamp", true);
|
||||
}
|
||||
|
||||
/***********************************************************/
|
||||
/* Semihosting */
|
||||
|
||||
typedef struct SemihostingConfig {
|
||||
bool enabled;
|
||||
SemihostingTarget target;
|
||||
} SemihostingConfig;
|
||||
|
||||
static SemihostingConfig semihosting;
|
||||
|
||||
bool semihosting_enabled(void)
|
||||
{
|
||||
return semihosting.enabled;
|
||||
}
|
||||
|
||||
SemihostingTarget semihosting_get_target(void)
|
||||
{
|
||||
return semihosting.target;
|
||||
}
|
||||
|
||||
/***********************************************************/
|
||||
/* USB devices */
|
||||
|
||||
|
@ -3622,24 +3642,24 @@ int main(int argc, char **argv, char **envp)
|
|||
nb_option_roms++;
|
||||
break;
|
||||
case QEMU_OPTION_semihosting:
|
||||
semihosting_enabled = 1;
|
||||
semihosting_target = SEMIHOSTING_TARGET_AUTO;
|
||||
semihosting.enabled = true;
|
||||
semihosting.target = SEMIHOSTING_TARGET_AUTO;
|
||||
break;
|
||||
case QEMU_OPTION_semihosting_config:
|
||||
semihosting_enabled = 1;
|
||||
semihosting.enabled = true;
|
||||
opts = qemu_opts_parse(qemu_find_opts("semihosting-config"),
|
||||
optarg, 0);
|
||||
if (opts != NULL) {
|
||||
semihosting_enabled = qemu_opt_get_bool(opts, "enable",
|
||||
semihosting.enabled = qemu_opt_get_bool(opts, "enable",
|
||||
true);
|
||||
const char *target = qemu_opt_get(opts, "target");
|
||||
if (target != NULL) {
|
||||
if (strcmp("native", target) == 0) {
|
||||
semihosting_target = SEMIHOSTING_TARGET_NATIVE;
|
||||
semihosting.target = SEMIHOSTING_TARGET_NATIVE;
|
||||
} else if (strcmp("gdb", target) == 0) {
|
||||
semihosting_target = SEMIHOSTING_TARGET_GDB;
|
||||
semihosting.target = SEMIHOSTING_TARGET_GDB;
|
||||
} else if (strcmp("auto", target) == 0) {
|
||||
semihosting_target = SEMIHOSTING_TARGET_AUTO;
|
||||
semihosting.target = SEMIHOSTING_TARGET_AUTO;
|
||||
} else {
|
||||
fprintf(stderr, "Unsupported semihosting-config"
|
||||
" %s\n",
|
||||
|
@ -3647,7 +3667,7 @@ int main(int argc, char **argv, char **envp)
|
|||
exit(1);
|
||||
}
|
||||
} else {
|
||||
semihosting_target = SEMIHOSTING_TARGET_AUTO;
|
||||
semihosting.target = SEMIHOSTING_TARGET_AUTO;
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Unsupported semihosting-config %s\n",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue