On Mon, Mar 01, 2010 at 08:39:49AM -1000, Zachary Amsden wrote:
Anything that can generate exceptions is going to need logic toTail call is not what usually happens. Usually emulation goes like this:
handle error cases anyway... the depth can not be that bad.
Especially if you structure it so as to optimize for tail calling.
if (check some conditions) {
queue exception A
return exception queued
}
if (check other conditions) {
queue exception B
return exception queued
}
do some emulation
try to read guest memory
if (read failed) {
queue exception C
return exception queued
}
if (read needs exit to userspace for device emulation)
return please go out and retrieve me the data
continue emulation
try to write guest memory
if (write failed) {
queue exception C
return exception queued
}
if (write needs exit to userspace for device emulation)
return please go out and process the data
emulate some more.
return emulation done