[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] linux-user: fix wait* syscall status returns
From: |
Alexander Graf |
Subject: |
Re: [Qemu-devel] [PATCH] linux-user: fix wait* syscall status returns |
Date: |
Thu, 24 Nov 2011 00:31:55 +0100 |
On 24.11.2011, at 00:02, Peter Maydell wrote:
> On 23 November 2011 23:00, Alexander Graf <address@hidden> wrote:
>>
>> On 23.11.2011, at 23:34, Peter Maydell wrote:
>>
>>> On 23 November 2011 22:03, Alexander Graf <address@hidden> wrote:
>>>> Yes. Maybe we should add a check if input_state != output_state and
>>>> only then do the conversion?
>>>
>>> I'm not sure this works (unless you go to the effort of implementing
>>> target_to_host_waitstatus() which seems overkill to me) but I'm not
>>> entirely sure what you're proposing to compare to what.
>>
>> It's an integer. If the number is the same before and after the wait
>> syscall, we can safely assume that it's the same thing, so we don't
>> have to convert it, no?
>
> But you don't know whether it's the same before and after because
> wait() didn't write to it [=> don't write to guest memory] or if
> wait() did write to it but happened to write it as the same value
> it had before [=> do write to guest memory].
If it was the same value before, it will still be the same value in guest
memory.
get_guest_s32(status, status_ptr);
old_status = status;
wait(...)
if (old_status != status) {
status = convert_status(status);
put_guest_s32(status, status_ptr);
}
If the values are identical, it's safe to assume that we don't have to convert.
And the value will already be in guest memory :)
Alex