Am 07.02.2010 um 13:50 schrieb Avi Kivity <avi@xxxxxxxxxx>:
On 02/04/2010 05:55 PM, Alexander Graf wrote:
The one big thing about the Gekko is paired singles.
Paired singles are an extension to the instruction set, that adds
32 single
precision floating point registers (qprs), some SPRs to modify the
behavior
of paired singled operations and instructions to deal with qprs to
the
instruction set.
Unfortunately, it also changes semantics of existing operations
that affect
single values in FPRs. In most cases they get mirrored to the
coresponding
QPR.
Thanks to that we need to emulate all FPU operations and all the
new paired
single operations too.
In order to achieve that, we take the guest's instruction, rip out
the
parameters, put in our own and execute the very same instruction,
but also
fix up the QPR values along the way.
That way we can execute paired single FPU operations without
implementing a
soft fpu.
A little frightening. How many instructions are there? Maybe we
can just have an array of all of them followed by a return
instruction, so we don't jit code.
There's all the instructions in the list, most can have the rc
(compare) bit set to modify CC and iirc there were a couple ones with
immediate values.
But maybe you're right. I probably could just always set rc and either
ignore the result or use it. I could maybe find alternatives to
immediate using instructions. Let me check this on the bus trip back
from brussels.
static void call_fpu_inst(u32 inst, u64 *out, u64 *in1, u64 *in2,
u64 *in3,
+ u32 *cr, u32 *fpscr)
+{
+ u32 cr_val = 0;
+ u32 *call_stack;
+ u64 inout[5] = { 0, 0, 0, 0, 0 };
+
+ if (fpscr)
+ inout[0] = *fpscr;
+ if (in1)
+ inout[1] = *in1;
+ if (in2)
+ inout[2] = *in2;
+ if (in3)
+ inout[3] = *in3;
+ if (cr)
+ cr_val = *cr;
+
+ dprintk(KERN_INFO "FPU Emulator 0x%x ( 0x%llx, 0x%llx, 0x
%llx )", inst,
+ inout[1], inout[2], inout[3]);
+
+ call_stack =&kvmppc_call_stack[(smp_processor_id() * 2)];
+ call_stack[0] = inst;
+ /* call_stack[1] is INS_BLR */
+
Would be easier on the cache to do this per-cpu?
It is per-cpu. Or do you mean to actually use the PER_CPU definition?
Is that guaranteed to be executable?
Alex
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html