lkml.org 
[lkml]   [2010]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: use of setjmp/longjmp in x86 emulator.
On 03/02/2010 09:28 AM, Gleb Natapov wrote:
> On Mon, Mar 01, 2010 at 02:13:32PM -0500, john cooper wrote:
>
>> Gleb Natapov wrote:
>>
>>
>>> Think about what happens if in the middle of
>>> instruction emulation some data from device emulated in userspace is
>>> needed. Emulator should be able to tell KVM that exit to userspace is
>>> needed and restart instruction emulation when data is available.
>>>
>> setjmp/longjmp are useful constructs in general but
>> IME are better suited for infrequent exceptions vs.
>> routine usage.
>>
> Exception condition during instruction emulation _is_
> infrequent.

Well, with mmio you'd expect it to happen every read access.

> Although setjmp/longjmp that I know about
> are routine usage. See QEMU TCG main loop or userspace
> thread libraries.
>

Agreed, nothing magical about it.

>> If the issue is finding some clean and regular way
>> to back out from (and possibly reeneter) logic
>> expressed within nested function invocations, have
>> you considered turning the problem inside out and
>> using a state machine approach?
>>
> I don't see how state machine will help. But the goal
> is not to rewrite emulator.c (this will no be excepted
> by kvm maintainers), but improve it gradually.
>

That is orthogonal. If we decide a state machine is the best
implementation, then we'll find a way to move over to that. However, I
don't think a state machine is a good representation considering some of
the code paths are very complicated and depend on a many memory accesses
(e.g. hardware task switches).

--
error compiling committee.c: too many arguments to function



\
 
 \ /
  Last update: 2010-03-07 10:03    [W:0.080 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site