Changeset 56926 in vbox for trunk/src/libs/xpcom18a4/xpcom/reflect/xptcall
- Timestamp:
- Jul 13, 2015 4:48:46 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_solaris.cpp
r1 r56926 41 41 #include "xptcprivate.h" 42 42 #include "xptc_platforms_unixish_x86.h" 43 #ifdef VBOX 44 # include <iprt/alloca.h> 45 #endif 43 46 44 47 extern "C" { … … 107 110 PRUint32 result; 108 111 PRUint32 n = invoke_count_words (paramCount, params) * 4; 112 int temp1, temp2, temp3; 113 114 # ifdef VBOX 115 /* This is for dealing with gcc 4.5.2 not using registers for 'g' parameters 116 and instead trying to get things like 'that' via %esp after we've changed it. */ 117 # if 1 /* safe version. */ 109 118 void (*fn_copy) (unsigned int, nsXPTCVariant *, PRUint32 *) = invoke_copy_to_stack; 110 int temp1, temp2, temp3; 111 119 struct Combined 120 { 121 PRUint32 that; /* offset: 0 */ 122 PRUint32 pfn; /* offset: 4 */ 123 PRUint32 savedEsp; /* offset: 8 */ 124 PRUint32 paramCount; /* offset: 12 */ 125 PRUint32 params; /* offset: 16 */ 126 } Combined; 127 # ifdef CFRONT_STYLE_THIS_ADJUST 128 struct CFRONTVTE { uintptr_t off, pfn } *pVtab = *(struct CFRONTVTE **)that; 129 Combined.that = (uintptr_t)that + pVtab[methodIndex + 1].off; 130 Combined.pfn = pVtab[methodIndex + 1].pfn; 131 # elif defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ 132 Combined.that = (uintptr_t)that; 133 Combined.pfn = (*(uintptr_t **)that)[methodIndex]; 134 # else /* not G++ V3 ABI */ 135 Combined.that = (uintptr_t)that; 136 Combined.pfn = (*(uintptr_t **)that)[2 + methodIndex]; 137 # endif /* G++ V3 ABI */ 138 Combined.paramCount = paramCount; 139 Combined.params = (uintptr_t)params; 140 141 __asm__ __volatile__( 142 "mov %%esp, 8(%%esi)\n\t" /* savedEsp = %esp */ 143 "subl %1, %%esp\n\t" /* make room for params */ 144 145 /* Call invoke_count_words to copy the parameters. */ 146 "pushl %%esp\n\t" /* arg2: dest */ 147 "pushl 16(%%esi)\n\t" /* arg1: params */ 148 "pushl 12(%%esi)\n\t" /* arg0: paramCount */ 149 "call *%0\n\t" 150 "addl $0xc, %%esp\n\t" 151 152 /* Push the this pointer. */ 153 "pushl (%%esi)\n\t" /* that */ 154 "call *4(%%esi)\n\t" 155 "mov 8(%%esi), %%esp\n\t" 156 : "=a" (result), /* %0 */ 157 "=c" (temp1), /* %1 */ 158 "=d" (temp2) /* %2 */ 159 : "S" (&Combined), /* %3 */ 160 "0" (fn_copy), 161 "1" (n) 162 : "memory" 163 ); 164 165 # else /* Small version; ASSUMES nothing important gets put on the stack after the the alloca. */ 166 uintptr_t *pauStack = (uintptr_t *)alloca(n + sizeof(uintptr_t)); 167 invoke_copy_to_stack(paramCount, params, &pauStack[1]); 168 # ifdef CFRONT_STYLE_THIS_ADJUST 169 struct CFRONTVTE { uintptr_t off, pfn } *pVtab = *(struct CFRONTVTE **)that; 170 pauStack[0] = (uintptr_t)that + pVtab[methodIndex + 1].off; 171 uintptr_t pfn = pVtab[methodIndex + 1].pfn; 172 # elif defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */ 173 pauStack[0] = (uintptr_t)that; 174 uintptr_t pfn = (*(uintptr_t **)that)[methodIndex]; 175 # else /* not G++ V3 ABI */ 176 pauStack[0] = (uintptr_t)that; 177 uintptr_t pfn = (*(uintptr_t **)that)[2 + methodIndex]; 178 # endif /* G++ V3 ABI */ 179 180 __asm__ __volatile__( 181 "xchg %%esp, %3\n\t" /* save+load %esp */ 182 "call *%0\n\t" 183 "xchg %%esp, %3\n\t" /* restore %esp */ 184 : "=a" (result), /* %0 */ 185 "=c" (temp1), /* %1 */ 186 "=d" (temp2) /* %2 */ 187 : "S" (pauStack), /* %3 */ 188 "0" (pfn) 189 : "memory" 190 ); 191 # endif 192 193 # else /* !VBOX */ 194 void (*fn_copy) (unsigned int, nsXPTCVariant *, PRUint32 *) = invoke_copy_to_stack; 112 195 __asm__ __volatile__( 113 196 "subl %8, %%esp\n\t" /* make room for params */ … … 153 236 : "memory" 154 237 ); 238 # endif /* !VBOX */ 155 239 156 240 return result;
Note:
See TracChangeset
for help on using the changeset viewer.