17520ee7ff226e12e06818561b15741d2575072e3buzbee    /*
2dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     * This handler is a bit odd - it may be called via chaining or
3dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     * from static code and is expected to cause control to flow
4dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     * to the interpreter.  The problem is where to find the Dalvik
5dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     * PC of the next instruction.  When called via chaining, the dPC
6dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     * will be located at *rp.  When called from static code, rPC is
7dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     * valid and rp is a real return pointer (that should be ignored).
8dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     * The Arm target deals with this by using the link register as
9dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     * a flag.  If it is zero, we know we were called from static code.
10dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     * If non-zero, it points to the chain cell containing dPC.
11dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     * For x86, we'll infer the source by looking where rp points.
12dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     * If it points to anywhere within the code cache, we'll assume
13dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     * we got here via chaining.  Otherwise, we'll assume rPC is valid.
147520ee7ff226e12e06818561b15741d2575072e3buzbee     *
157520ee7ff226e12e06818561b15741d2575072e3buzbee     * On entry:
16dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     *    (TOS)<- return pointer or pointer to dPC
177520ee7ff226e12e06818561b15741d2575072e3buzbee     */
189f601a917c8878204482c37aec7005054b6776fabuzbee
199f601a917c8878204482c37aec7005054b6776fabuzbee/*
209f601a917c8878204482c37aec7005054b6776fabuzbee * FIXME - this won't work as-is.  The cache boundaries are not
219f601a917c8878204482c37aec7005054b6776fabuzbee * set up until later.  Perhaps rething this whole thing.  Do we
229f601a917c8878204482c37aec7005054b6776fabuzbee * really need an interpret teplate?
239f601a917c8878204482c37aec7005054b6776fabuzbee */
249f601a917c8878204482c37aec7005054b6776fabuzbee
259f601a917c8878204482c37aec7005054b6776fabuzbee
269f601a917c8878204482c37aec7005054b6776fabuzbee     movl   rSELF,%ecx
27dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     movl   $$.LinterpPunt,%edx
28dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     pop    %eax
299f601a917c8878204482c37aec7005054b6776fabuzbee     /*cmpl   %eax,offThread_jitCacheEnd(%ecx)*/
30dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     ja     1f
319f601a917c8878204482c37aec7005054b6776fabuzbee     /*cmpl   %eax,offThread_jitCacheStart(%ecx)*/
32dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     jb     1f
33dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     movl   %eax,rPC
34dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee1:
35dfd1bbf07d98c82a6072182f705f64a30ebf480bbuzbee     jmp    *(%edx)
367520ee7ff226e12e06818561b15741d2575072e3buzbee
377520ee7ff226e12e06818561b15741d2575072e3buzbee.LinterpPunt:
387520ee7ff226e12e06818561b15741d2575072e3buzbee    .long   dvmJitToInterpPunt
39