mirror of https://github.com/xemu-project/xemu.git
target-arm: default empty semihosting cmdline
If neither explicit semihosting args nor -kernel are used, make SYS_GET_CMDLINE return an empty string. Signed-off-by: Liviu Ionescu <ilg@livius.net> Message-id: AC7B5AFC-06AE-4FAD-9852-B65708E80E09@livius.net Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
ca79373653
commit
f3c2bda216
|
@ -436,12 +436,19 @@ uint32_t do_arm_semihosting(CPUARMState *env)
|
||||||
size_t input_size;
|
size_t input_size;
|
||||||
size_t output_size;
|
size_t output_size;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
|
const char *cmdline;
|
||||||
|
#endif
|
||||||
GET_ARG(0);
|
GET_ARG(0);
|
||||||
GET_ARG(1);
|
GET_ARG(1);
|
||||||
input_size = arg1;
|
input_size = arg1;
|
||||||
/* Compute the size of the output string. */
|
/* Compute the size of the output string. */
|
||||||
#if !defined(CONFIG_USER_ONLY)
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
output_size = strlen(semihosting_get_cmdline()) + 1;
|
cmdline = semihosting_get_cmdline();
|
||||||
|
if (cmdline == NULL) {
|
||||||
|
cmdline = ""; /* Default to an empty line. */
|
||||||
|
}
|
||||||
|
output_size = strlen(cmdline) + 1; /* Count terminating 0. */
|
||||||
#else
|
#else
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
@ -472,7 +479,7 @@ uint32_t do_arm_semihosting(CPUARMState *env)
|
||||||
|
|
||||||
/* Copy the command-line arguments. */
|
/* Copy the command-line arguments. */
|
||||||
#if !defined(CONFIG_USER_ONLY)
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
pstrcpy(output_buffer, output_size, semihosting_get_cmdline());
|
pstrcpy(output_buffer, output_size, cmdline);
|
||||||
#else
|
#else
|
||||||
if (output_size == 1) {
|
if (output_size == 1) {
|
||||||
/* Empty command-line. */
|
/* Empty command-line. */
|
||||||
|
|
Loading…
Reference in New Issue