blob: 1256ee4bd24955efa32dda3478616109aa42c927 [file] [log] [blame]
buzbee7520ee72010-09-17 16:01:49 -07001/*
2 * This file was generated automatically by gen-template.py for 'ia32'.
3 *
4 * --> DO NOT EDIT <--
5 */
6
7/* File: ia32/header.S */
8/*
Ben Cheng8c9ac9a2010-10-22 10:15:03 -07009 * Copyright (C) 2010 The Android Open Source Project
buzbee7520ee72010-09-17 16:01:49 -070010 *
11 * Licensed under the Apache License, Version 2.0 (the "License");
12 * you may not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
14 *
15 * http://www.apache.org/licenses/LICENSE-2.0
16 *
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
22 */
23
24#if defined(WITH_JIT)
25
buzbeedfd1bbf2010-09-22 16:19:28 -070026/* Subset of defines from mterp/x86/header.S */
27#define rGLUE (%ebp)
28#define rPC %esi
29#define rFP %edi
30#define rINST %ebx
31
buzbee7520ee72010-09-17 16:01:49 -070032/*
33 * This is a #include, not a %include, because we want the C pre-processor
34 * to expand the macros into assembler assignment statements.
35 */
36#include "../../../mterp/common/asm-constants.h"
37
38/* File: ia32/platform.S */
39/*
40 * ===========================================================================
41 * CPU-version-specific defines and utility
42 * ===========================================================================
43 */
44
45
46
47
48 .global dvmCompilerTemplateStart
49 .type dvmCompilerTemplateStart, %function
50 .text
51
52dvmCompilerTemplateStart:
53
54/* ------------------------------ */
55 .balign 4
56 .global dvmCompiler_TEMPLATE_INTERPRET
57dvmCompiler_TEMPLATE_INTERPRET:
58/* File: ia32/TEMPLATE_INTERPRET.S */
59 /*
buzbeedfd1bbf2010-09-22 16:19:28 -070060 * This handler is a bit odd - it may be called via chaining or
61 * from static code and is expected to cause control to flow
62 * to the interpreter. The problem is where to find the Dalvik
63 * PC of the next instruction. When called via chaining, the dPC
64 * will be located at *rp. When called from static code, rPC is
65 * valid and rp is a real return pointer (that should be ignored).
66 * The Arm target deals with this by using the link register as
67 * a flag. If it is zero, we know we were called from static code.
68 * If non-zero, it points to the chain cell containing dPC.
69 * For x86, we'll infer the source by looking where rp points.
70 * If it points to anywhere within the code cache, we'll assume
71 * we got here via chaining. Otherwise, we'll assume rPC is valid.
buzbee7520ee72010-09-17 16:01:49 -070072 *
buzbee7520ee72010-09-17 16:01:49 -070073 * On entry:
buzbeedfd1bbf2010-09-22 16:19:28 -070074 * (TOS)<- return pointer or pointer to dPC
buzbee7520ee72010-09-17 16:01:49 -070075 */
buzbeedfd1bbf2010-09-22 16:19:28 -070076 movl rGLUE,%ecx
77 movl $.LinterpPunt,%edx
78 pop %eax
79 cmpl %eax,offGlue_jitCacheEnd(%ecx)
80 ja 1f
81 cmpl %eax,offGlue_jitCacheStart(%ecx)
82 jb 1f
83 movl %eax,rPC
841:
85 jmp *(%edx)
buzbee7520ee72010-09-17 16:01:49 -070086
87.LinterpPunt:
88 .long dvmJitToInterpPunt
89
90 .size dvmCompilerTemplateStart, .-dvmCompilerTemplateStart
91/* File: ia32/footer.S */
92/*
93 * ===========================================================================
94 * Common subroutines and data
95 * ===========================================================================
96 */
97
98 .text
99 .align 4
100/*
buzbeedfd1bbf2010-09-22 16:19:28 -0700101 * FIXME - verify that we don't need an explicit cache flush
102 * for x86.
buzbee7520ee72010-09-17 16:01:49 -0700103 */
104 .global cacheflush
105cacheflush:
buzbeedfd1bbf2010-09-22 16:19:28 -0700106 ret
buzbee7520ee72010-09-17 16:01:49 -0700107
108
109 .global dmvCompilerTemplateEnd
110dmvCompilerTemplateEnd:
111
112#endif /* WITH_JIT */
113