diff options
| author | Pierrick Bouvier <pierrick.bouvier@linaro.org> | 2025-09-22 10:36:51 +0100 |
|---|---|---|
| committer | Alex Bennée <alex.bennee@linaro.org> | 2025-09-26 09:55:19 +0100 |
| commit | d8028d4ede536bbea82eab8bdebd753378d58b68 (patch) | |
| tree | 8622ac768315d6cd98f3b110910060af361fde50 /semihosting/guestfd.c | |
| parent | 664172404aff3ba11f8ab1fc348d3c860c45f5d3 (diff) | |
| download | focaccia-qemu-d8028d4ede536bbea82eab8bdebd753378d58b68.tar.gz focaccia-qemu-d8028d4ede536bbea82eab8bdebd753378d58b68.zip | |
semihosting/guestfd: compile once for system/user
We move relevant code to semihosting/arm-compat-semi.c, and add functions to query CONFIG_ARM_COMPATIBLE_SEMIHOSTING at runtime. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-ID: <20250822150058.18692-4-pierrick.bouvier@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-ID: <20250922093711.2768983-7-alex.bennee@linaro.org>
Diffstat (limited to 'semihosting/guestfd.c')
| -rw-r--r-- | semihosting/guestfd.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/semihosting/guestfd.c b/semihosting/guestfd.c index d3241434c5..e8f236c690 100644 --- a/semihosting/guestfd.c +++ b/semihosting/guestfd.c @@ -12,35 +12,20 @@ #include "gdbstub/syscalls.h" #include "semihosting/semihost.h" #include "semihosting/guestfd.h" -#ifndef CONFIG_USER_ONLY -#include CONFIG_DEVICES -#endif static GArray *guestfd_array; -#ifdef CONFIG_ARM_COMPATIBLE_SEMIHOSTING -GuestFD console_in_gf; -GuestFD console_out_gf; -#endif - void qemu_semihosting_guestfd_init(void) { /* New entries zero-initialized, i.e. type GuestFDUnused */ guestfd_array = g_array_new(FALSE, TRUE, sizeof(GuestFD)); -#ifdef CONFIG_ARM_COMPATIBLE_SEMIHOSTING - /* For ARM-compat, the console is in a separate namespace. */ - if (use_gdb_syscalls()) { - console_in_gf.type = GuestFDGDB; - console_in_gf.hostfd = 0; - console_out_gf.type = GuestFDGDB; - console_out_gf.hostfd = 2; - } else { - console_in_gf.type = GuestFDConsole; - console_out_gf.type = GuestFDConsole; + if (semihosting_arm_compatible()) { + semihosting_arm_compatible_init(); + return; } -#else - /* Otherwise, the stdio file descriptors apply. */ + + /* Out of ARM, the stdio file descriptors apply. */ guestfd_array = g_array_set_size(guestfd_array, 3); #ifndef CONFIG_USER_ONLY if (!use_gdb_syscalls()) { @@ -54,7 +39,6 @@ void qemu_semihosting_guestfd_init(void) associate_guestfd(0, 0); associate_guestfd(1, 1); associate_guestfd(2, 2); -#endif } /* |