|
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // e32\include\win32crt.h |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalTechnology |
|
21 */ |
|
22 |
|
23 typedef void (__cdecl *_PVFV)(void); |
|
24 typedef void* HANDLE; |
|
25 |
|
26 |
|
27 // |
|
28 // Static construction / destruction depends on compiler |
|
29 // |
|
30 |
|
31 // GCC creates two lists of functions to call, __CTOR_LIST__ and __DTOR_LIST__ |
|
32 #if defined(__GCC32__) |
|
33 typedef void (*PFV)(); |
|
34 extern PFV __CTOR_LIST__[]; |
|
35 extern PFV __DTOR_LIST__[]; |
|
36 static inline void constructStatics() |
|
37 { |
|
38 TUint _i=1; |
|
39 while (__CTOR_LIST__[_i]) |
|
40 (*__CTOR_LIST__[_i++])(); |
|
41 } |
|
42 static inline void destroyStatics() |
|
43 { |
|
44 TUint _i=1; |
|
45 while (__DTOR_LIST__[_i]) |
|
46 (*__DTOR_LIST__[_i++])(); |
|
47 } |
|
48 |
|
49 // VC puts constructor/destructor function pointers in specially-named sections |
|
50 #else |
|
51 #pragma data_seg(".CRT$XIA") |
|
52 _PVFV __xi_a[] = { NULL }; |
|
53 #pragma data_seg(".CRT$XIZ") |
|
54 _PVFV __xi_z[] = { NULL }; |
|
55 #pragma data_seg(".CRT$XCA") |
|
56 _PVFV __xc_a[] = { NULL }; |
|
57 #pragma data_seg(".CRT$XCZ") |
|
58 _PVFV __xc_z[] = { NULL }; |
|
59 #pragma data_seg(".CRT$XPA") |
|
60 _PVFV __xp_a[] = { NULL }; |
|
61 #pragma data_seg(".CRT$XPZ") |
|
62 _PVFV __xp_z[] = { NULL }; |
|
63 #pragma data_seg(".CRT$XTA") |
|
64 _PVFV __xt_a[] = { NULL }; |
|
65 #pragma data_seg(".CRT$XTZ") |
|
66 _PVFV __xt_z[] = { NULL }; |
|
67 #pragma data_seg() /* reset */ |
|
68 LOCAL_C void invokeTable(_PVFV *aStart,_PVFV *aEnd) |
|
69 { |
|
70 while (aStart<aEnd) |
|
71 { |
|
72 if (*aStart!=NULL) |
|
73 (**aStart)(); |
|
74 aStart++; |
|
75 } |
|
76 } |
|
77 #define constructStatics() invokeTable(__xi_a,__xi_z), invokeTable(__xc_a,__xc_z) |
|
78 #define destroyStatics() invokeTable(__xp_a,__xp_z), invokeTable(__xt_a,__xt_z) |
|
79 #endif |
|
80 |
|
81 #if defined(__VC32__) |
|
82 // |
|
83 // Some symbols generated by the VC++ compiler for floating point stuff. |
|
84 // |
|
85 extern "C" { |
|
86 #ifndef __EPOC32__ |
|
87 #pragma data_seg(".data2") |
|
88 #pragma bss_seg(".data2") |
|
89 GLDEF_D TInt _adj_fdivr_m64; |
|
90 GLDEF_D TInt _adjust_fdiv; |
|
91 GLDEF_D TInt _adj_fdiv_r; |
|
92 GLDEF_D TInt _adj_fdiv_m64; |
|
93 GLDEF_D TInt _adj_fdiv_m32i; |
|
94 GLDEF_D TInt _adj_fdivr_m32i; |
|
95 #ifndef __FLTUSED |
|
96 #define __FLTUSED |
|
97 extern "C" __declspec(selectany) int _fltused=0; |
|
98 #endif //__FLTUSED |
|
99 #pragma data_seg() |
|
100 #pragma bss_seg() |
|
101 #endif // !__EPOC32__ |
|
102 |
|
103 __int64 _ftol(void) |
|
104 { |
|
105 __int64 retval; |
|
106 short tmpcw; |
|
107 short oldcw; |
|
108 |
|
109 _asm fstcw oldcw |
|
110 _asm wait |
|
111 |
|
112 _asm mov ax, oldcw |
|
113 _asm or ah, 0x0c |
|
114 _asm mov tmpcw, ax |
|
115 |
|
116 _asm fldcw tmpcw |
|
117 _asm fistp retval |
|
118 _asm fldcw oldcw |
|
119 |
|
120 return retval; |
|
121 } |
|
122 |
|
123 __declspec(naked) __int64 _ftol2(void) |
|
124 { |
|
125 _asm call _ftol; |
|
126 _asm ret; |
|
127 } |
|
128 |
|
129 __declspec(naked) __int64 _ftol2_sse(void) |
|
130 { |
|
131 _asm call _ftol; |
|
132 _asm ret; |
|
133 } |
|
134 |
|
135 __declspec(naked) __int64 _ftol2_sse_excpt(void) |
|
136 { |
|
137 _asm call _ftol; |
|
138 _asm ret; |
|
139 } |
|
140 |
|
141 __declspec(naked) __int64 _ftol2_pentium4(void) |
|
142 { |
|
143 _asm call _ftol; |
|
144 _asm ret; |
|
145 } |
|
146 |
|
147 } |
|
148 |
|
149 extern "C" |
|
150 void abort() |
|
151 { |
|
152 abort(); |
|
153 } |
|
154 #endif |
|
155 |
|
156 |
|
157 extern "C" |
|
158 int __cdecl _purecall() |
|
159 /* |
|
160 // Gets called for any unreplaced pure virtual methods. |
|
161 */ |
|
162 { |
|
163 return 0; |
|
164 } |