Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-21 Thread Liviu Ionescu
> On 21 May 2015, at 21:35, Maciej W. Rozycki wrote: > > On Thu, 21 May 2015, Liviu Ionescu wrote: > >> p.s. and I think there are major differences between using -append to >> pass arguments to the kernel and passing arguments to semihosting, this >> being one of the reasons for suggesting a

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-21 Thread Maciej W. Rozycki
On Thu, 21 May 2015, Liviu Ionescu wrote: > p.s. and I think there are major differences between using -append to > pass arguments to the kernel and passing arguments to semihosting, this > being one of the reasons for suggesting a new command. Out of curiosity, why do you think there are diff

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-21 Thread Liviu Ionescu
> On 21 May 2015, at 19:56, Peter Maydell wrote: > > ... That's because your code is adding quotes, which I've already > said I think is incorrect. If you took out the addition of > quotes the two would be the same. it might be incorrect for some obscure/broken guest implementations, but my se

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-21 Thread Peter Maydell
On 21 May 2015 at 17:36, Liviu Ionescu wrote: > >> On 21 May 2015, at 18:54, Peter Maydell wrote: >> >> On 21 May 2015 at 16:47, Liviu Ionescu wrote: >>> On 21 May 2015, at 18:29, Peter Maydell wrote: There's no way to not offer the choice. In your syntax this would be

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-21 Thread Liviu Ionescu
> On 21 May 2015, at 18:54, Peter Maydell wrote: > > On 21 May 2015 at 16:47, Liviu Ionescu wrote: >> >>> On 21 May 2015, at 18:29, Peter Maydell wrote: >>> >>> >>> There's no way to not offer the choice. In your syntax >>> this would be >>> --semihosting-cmdline "foo bar baz" >> >> not ex

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-21 Thread Peter Maydell
On 21 May 2015 at 16:47, Liviu Ionescu wrote: > >> On 21 May 2015, at 18:29, Peter Maydell wrote: >> >> >> There's no way to not offer the choice. In your syntax >> this would be >> --semihosting-cmdline "foo bar baz" > > not exactly. in my implementation this would arrive in the guest > code as

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-21 Thread Liviu Ionescu
> On 21 May 2015, at 18:29, Peter Maydell wrote: > > > There's no way to not offer the choice. In your syntax > this would be > --semihosting-cmdline "foo bar baz" not exactly. in my implementation this would arrive in the guest code as argc=1, argv[0]="foo bar baz", which will be understood

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-21 Thread Peter Maydell
On 21 May 2015 at 16:24, Liviu Ionescu wrote: > >> On 21 May 2015, at 18:06, Peter Maydell wrote: >> >> ... >> That's their choice... It is still an array of substrings, >> but if the user only provides one string then we have an >> array of length 1. > > this was my initial point, as long as you

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-21 Thread Liviu Ionescu
> On 21 May 2015, at 18:06, Peter Maydell wrote: > > ... > That's their choice... It is still an array of substrings, > but if the user only provides one string then we have an > array of length 1. this was my initial point, as long as you offer the choice, you no longer have consistent usage

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-21 Thread Peter Maydell
On 21 May 2015 at 15:57, Liviu Ionescu wrote: > >> On 21 May 2015, at 17:33, Peter Maydell wrote: >> >> On 21 May 2015 at 15:28, Liviu Ionescu wrote: >>> from what I understood, for MIPS the emulator must be called with a >>> sequence of ,arg=xxx, while for ARM it needs to be called with a singl

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-21 Thread Liviu Ionescu
> On 21 May 2015, at 17:33, Peter Maydell wrote: > > On 21 May 2015 at 15:28, Liviu Ionescu wrote: >> from what I understood, for MIPS the emulator must be called with a >> sequence of ,arg=xxx, while for ARM it needs to be called with a single >> long string including the entire command line.

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-21 Thread Peter Maydell
On 21 May 2015 at 15:28, Liviu Ionescu wrote: > from what I understood, for MIPS the emulator must be called with a > sequence of ,arg=xxx, while for ARM it needs to be called with a single > long string including the entire command line. You can use a sequence of ,arg=xxx on ARM too. It's just t

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-21 Thread Liviu Ionescu
> On 21 May 2015, at 16:57, Leon Alrae wrote: > > ... pseudo-bootloaders in MALTA and Fulong2e have hardcoded argc to 2 > (-kernel and -append). I don't know the specifics of other emulated platforms, but to me the whole issue looks messy, and the details of using the newly added arg option j

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-21 Thread Leon Alrae
On 21/05/2015 15:01, Peter Maydell wrote: > Well, it will presumably mean that on a MIPS semihosting case > if the user tries -append "some command line" it won't do what > they expect... Yes, but I think the user should use semihosting-config arg, which is more natural in semihosting context, rat

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-21 Thread Peter Maydell
On 21 May 2015 at 14:57, Leon Alrae wrote: > I've been considering that, and I think we are better off without > splitting -append in semihosting mode because this is at least > consistent with MIPS machines in QEMU (in non-semihosting mode) -- > pseudo-bootloaders in MALTA and Fulong2e have hardc

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-21 Thread Leon Alrae
On 20/05/2015 09:54, Peter Maydell wrote: > On 20 May 2015 at 09:11, Leon Alrae wrote: >> Agreed. We could initialize semihosting.argv[0] with -kernel and argv[1] >> with -append string if in semihosting mode and no semihosting args have >> been specified. I'll update it in v4. > > I'm tempted to

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-20 Thread Liviu Ionescu
> On 20 May 2015, at 18:11, Peter Maydell wrote: > > --semihosting-config,arg='program --opt1 "path 1" --opt2 "path 2"' ok, thank you, this seems manageable. Liviu

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-20 Thread Peter Maydell
On 20 May 2015 at 15:59, Liviu Ionescu wrote: > >> On 20 May 2015, at 17:40, Peter Maydell wrote: >> >> ... The ARM semihosting API doesn't mandate any kind of quoting, and we >> can't know what the guest application expects, > > ok (btw, my embedded semihosting code is happy with both quotes or

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-20 Thread Liviu Ionescu
> On 20 May 2015, at 17:40, Peter Maydell wrote: > > ... The ARM semihosting API doesn't mandate any kind of quoting, and we > can't know what the guest application expects, ok (btw, my embedded semihosting code is happy with both quotes or apostrophes) > so the user is going > to have to sup

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-20 Thread Peter Maydell
On 20 May 2015 at 15:31, Liviu Ionescu wrote: > >> On 20 May 2015, at 17:18, Peter Maydell wrote: >> >> PS: the glib function g_strjoinv("", null_terminated_string_array) >> is probably better than reimplementing the string-concatenation >> wheel. > > I'm not familiar with g_strjoinv(), but the a

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-20 Thread Liviu Ionescu
> On 20 May 2015, at 17:18, Peter Maydell wrote: > > PS: the glib function g_strjoinv("", null_terminated_string_array) > is probably better than reimplementing the string-concatenation > wheel. I'm not familiar with g_strjoinv(), but the args concatenate logic should protect args containing s

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-20 Thread Peter Maydell
On 20 May 2015 at 14:49, Liviu Ionescu wrote: > personally I would add a pointer (cmdline?) in the semihosting > structure and a getter (semihosting_get_cmdline()?). at first call, > the getter would concatenate all args and store the result in the > structure (the concatenate function is there),

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-20 Thread Liviu Ionescu
> On 20 May 2015, at 12:31, Leon Alrae wrote: > > ... I’ll update arm-semi.c as well to concatenate all args. you can use parts of my initial patch for the arm semihosting related changes. --- personally I would add a pointer (cmdline?) in the semihosting structure and a getter (semihosting_

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-20 Thread Leon Alrae
On 20/05/2015 12:12, Liviu Ionescu wrote: > yes, that's correct, my comment was related to the above quotes from your > message, in the first part you mention "the path won't be passed to > semihosting", which is not consistent with the actual behaviour, since the > entire kernel path is passed

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-20 Thread Liviu Ionescu
> On 20 May 2015, at 11:51, Leon Alrae wrote: > > On 20/05/2015 09:30, Liviu Ionescu wrote: >> >>> On 20 May 2015, at 11:11, Leon Alrae wrote: >>> >>> like "If both are specified, -kernel/-append are ignored (-kernel is >>> used to load an image, but the path won't be passed to semihosting)"

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-20 Thread Leon Alrae
On 20/05/2015 09:54, Peter Maydell wrote: > Well, with these patches alone we end up with a documented but broken > option. For reasons of consistency (again) I don't want the new > option in the tree without it being supported by ARM, even if the > MIPS code that uses it goes in. Fair enough. I’l

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-20 Thread Peter Maydell
On 20 May 2015 at 09:11, Leon Alrae wrote: > On 18/05/2015 17:18, Peter Maydell wrote: >> You need to say how this interacts with the -kernel/-append option >> (ie what happens if you specify both). > > I don't see any correlation between semihosting options and "-append" > which is described as "

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-20 Thread Leon Alrae
On 20/05/2015 09:30, Liviu Ionescu wrote: > >> On 20 May 2015, at 11:11, Leon Alrae wrote: >> >> like "If both are specified, -kernel/-append are ignored (-kernel is >> used to load an image, but the path won't be passed to semihosting)" > ... >> We could initialize semihosting.argv[0] with -ker

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-20 Thread Liviu Ionescu
> On 20 May 2015, at 11:11, Leon Alrae wrote: > > like "If both are specified, -kernel/-append are ignored (-kernel is > used to load an image, but the path won't be passed to semihosting)" ... > We could initialize semihosting.argv[0] with -kernel here you have a small contradiction, both in

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-20 Thread Leon Alrae
On 18/05/2015 17:18, Peter Maydell wrote: > On 8 May 2015 at 12:41, Leon Alrae wrote: >> Add new "arg" sub-argument to the --semihosting-config allowing to pass >> multiple input argument separately. It is required for example by UHI >> semihosting to construct argc and argv. >> >> Signed-off-by:

Re: [Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-18 Thread Peter Maydell
On 8 May 2015 at 12:41, Leon Alrae wrote: > Add new "arg" sub-argument to the --semihosting-config allowing to pass > multiple input argument separately. It is required for example by UHI > semihosting to construct argc and argv. > > Signed-off-by: Leon Alrae > --- > include/exec/semihost.h | 12

[Qemu-devel] [PATCH v3 2/2] semihosting: add --semihosting-config arg sub-argument

2015-05-08 Thread Leon Alrae
Add new "arg" sub-argument to the --semihosting-config allowing to pass multiple input argument separately. It is required for example by UHI semihosting to construct argc and argv. Signed-off-by: Leon Alrae --- include/exec/semihost.h | 12 qemu-options.hx | 19