Message ID | 20220607204557.658541-50-richard.henderson@linaro.org |
---|---|
State | Accepted |
Commit | 5d77289dac9917db89d56f558bcf7c3a82332222 |
Headers | show |
Series | semihosting cleanup | expand |
On 13:45 Tue 07 Jun , Richard Henderson wrote: > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Luc Michel <lmichel@kalray.eu> > --- > semihosting/arm-compat-semi.c | 20 ++++++++++++++++---- > 1 file changed, 16 insertions(+), 4 deletions(-) > > diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c > index 4c8932ad54..dea5b2de8d 100644 > --- a/semihosting/arm-compat-semi.c > +++ b/semihosting/arm-compat-semi.c > @@ -228,6 +228,15 @@ static void common_semi_cb(CPUState *cs, uint64_t ret, int err) > common_semi_set_ret(cs, ret); > } > > +/* > + * Use 0xdeadbeef as the return value when there isn't a defined > + * return value for the call. > + */ > +static void common_semi_dead_cb(CPUState *cs, uint64_t ret, int err) > +{ > + common_semi_set_ret(cs, 0xdeadbeef); > +} > + > /* > * SYS_READ and SYS_WRITE always return the number of bytes not read/written. > * There is no error condition, other than returning the original length. > @@ -341,8 +350,7 @@ static const uint8_t featurefile_data[] = { > * The specification always says that the "return register" either > * returns a specific value or is corrupted, so we don't need to > * report to our caller whether we are returning a value or trying to > - * leave the register unchanged. We use 0xdeadbeef as the return value > - * when there isn't a defined return value for the call. > + * leave the register unchanged. > */ > void do_common_semihosting(CPUState *cs) > { > @@ -419,8 +427,12 @@ void do_common_semihosting(CPUState *cs) > break; > > case TARGET_SYS_WRITEC: > - qemu_semihosting_console_outc(env, args); > - common_semi_set_ret(cs, 0xdeadbeef); > + /* > + * FIXME: the byte to be written is in a target_ulong slot, > + * which means this is wrong for a big-endian guest. > + */ > + semihost_sys_write_gf(cs, common_semi_dead_cb, > + &console_out_gf, args, 1); > break; > > case TARGET_SYS_WRITE0: > -- > 2.34.1 > > > > > To declare a filtering error, please use the following link : https://www.security-mail.net/reporter.php?mid=1578f.629fd28e.3eb4d.0&r=lmichel%40kalrayinc.com&s=qemu-devel-bounces%2Blmichel%3Dkalrayinc.com%40nongnu.org&o=%5BPATCH+v4+49%2F53%5D+semihosting%3A+Use+console_out_gf+for+SYS_WRITEC&verdict=C&c=9f59ee0c491343fa50053073959ee288e2920868 > --
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c index 4c8932ad54..dea5b2de8d 100644 --- a/semihosting/arm-compat-semi.c +++ b/semihosting/arm-compat-semi.c @@ -228,6 +228,15 @@ static void common_semi_cb(CPUState *cs, uint64_t ret, int err) common_semi_set_ret(cs, ret); } +/* + * Use 0xdeadbeef as the return value when there isn't a defined + * return value for the call. + */ +static void common_semi_dead_cb(CPUState *cs, uint64_t ret, int err) +{ + common_semi_set_ret(cs, 0xdeadbeef); +} + /* * SYS_READ and SYS_WRITE always return the number of bytes not read/written. * There is no error condition, other than returning the original length. @@ -341,8 +350,7 @@ static const uint8_t featurefile_data[] = { * The specification always says that the "return register" either * returns a specific value or is corrupted, so we don't need to * report to our caller whether we are returning a value or trying to - * leave the register unchanged. We use 0xdeadbeef as the return value - * when there isn't a defined return value for the call. + * leave the register unchanged. */ void do_common_semihosting(CPUState *cs) { @@ -419,8 +427,12 @@ void do_common_semihosting(CPUState *cs) break; case TARGET_SYS_WRITEC: - qemu_semihosting_console_outc(env, args); - common_semi_set_ret(cs, 0xdeadbeef); + /* + * FIXME: the byte to be written is in a target_ulong slot, + * which means this is wrong for a big-endian guest. + */ + semihost_sys_write_gf(cs, common_semi_dead_cb, + &console_out_gf, args, 1); break; case TARGET_SYS_WRITE0:
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- semihosting/arm-compat-semi.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)