src/os_cpu/windows_x86/vm/os_windows_x86.cpp

Thu, 21 Oct 2010 11:55:10 -0700

author
never
date
Thu, 21 Oct 2010 11:55:10 -0700
changeset 2262
1e9a9d2e6509
parent 2103
3e8fbc61cee8
child 2314
f95d63e2154a
permissions
-rw-r--r--

6970683: improvements to hs_err output
Reviewed-by: kvn, jrose, dholmes, coleenp

duke@435 1 /*
twisti@2103 2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 // do not include precompiled header file
duke@435 26 # include "incls/_os_windows_x86.cpp.incl"
duke@435 27 # include "unwind_windows_x86.hpp"
duke@435 28 #undef REG_SP
duke@435 29 #undef REG_FP
duke@435 30 #undef REG_PC
duke@435 31 #ifdef AMD64
duke@435 32 #define REG_SP Rsp
duke@435 33 #define REG_FP Rbp
duke@435 34 #define REG_PC Rip
duke@435 35 #else
duke@435 36 #define REG_SP Esp
duke@435 37 #define REG_FP Ebp
duke@435 38 #define REG_PC Eip
duke@435 39 #endif // AMD64
duke@435 40
duke@435 41 extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* );
duke@435 42
duke@435 43 // Install a win32 structured exception handler around thread.
duke@435 44 void os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread) {
duke@435 45 __try {
duke@435 46
duke@435 47 #ifndef AMD64
duke@435 48 // We store the current thread in this wrapperthread location
duke@435 49 // and determine how far away this address is from the structured
duke@435 50 // execption pointer that FS:[0] points to. This get_thread
duke@435 51 // code can then get the thread pointer via FS.
duke@435 52 //
duke@435 53 // Warning: This routine must NEVER be inlined since we'd end up with
duke@435 54 // multiple offsets.
duke@435 55 //
duke@435 56 volatile Thread* wrapperthread = thread;
duke@435 57
duke@435 58 if ( ThreadLocalStorage::get_thread_ptr_offset() == 0 ) {
duke@435 59 int thread_ptr_offset;
duke@435 60 __asm {
duke@435 61 lea eax, dword ptr wrapperthread;
duke@435 62 sub eax, dword ptr FS:[0H];
duke@435 63 mov thread_ptr_offset, eax
duke@435 64 };
duke@435 65 ThreadLocalStorage::set_thread_ptr_offset(thread_ptr_offset);
duke@435 66 }
duke@435 67 #ifdef ASSERT
duke@435 68 // Verify that the offset hasn't changed since we initally captured
duke@435 69 // it. This might happen if we accidentally ended up with an
duke@435 70 // inlined version of this routine.
duke@435 71 else {
duke@435 72 int test_thread_ptr_offset;
duke@435 73 __asm {
duke@435 74 lea eax, dword ptr wrapperthread;
duke@435 75 sub eax, dword ptr FS:[0H];
duke@435 76 mov test_thread_ptr_offset, eax
duke@435 77 };
duke@435 78 assert(test_thread_ptr_offset == ThreadLocalStorage::get_thread_ptr_offset(),
duke@435 79 "thread pointer offset from SEH changed");
duke@435 80 }
duke@435 81 #endif // ASSERT
duke@435 82 #endif // !AMD64
duke@435 83
duke@435 84 f(value, method, args, thread);
duke@435 85 } __except(topLevelExceptionFilter((_EXCEPTION_POINTERS*)_exception_info())) {
duke@435 86 // Nothing to do.
duke@435 87 }
duke@435 88 }
duke@435 89
duke@435 90 #ifdef AMD64
duke@435 91
duke@435 92 // This is the language specific handler for exceptions
duke@435 93 // originating from dynamically generated code.
duke@435 94 // We call the standard structured exception handler
duke@435 95 // We only expect Continued Execution since we cannot unwind
duke@435 96 // from generated code.
duke@435 97 LONG HandleExceptionFromCodeCache(
duke@435 98 IN PEXCEPTION_RECORD ExceptionRecord,
duke@435 99 IN ULONG64 EstablisherFrame,
duke@435 100 IN OUT PCONTEXT ContextRecord,
duke@435 101 IN OUT PDISPATCHER_CONTEXT DispatcherContext) {
duke@435 102 EXCEPTION_POINTERS ep;
duke@435 103 LONG result;
duke@435 104
duke@435 105 ep.ExceptionRecord = ExceptionRecord;
duke@435 106 ep.ContextRecord = ContextRecord;
duke@435 107
duke@435 108 result = topLevelExceptionFilter(&ep);
duke@435 109
duke@435 110 // We better only get a CONTINUE_EXECUTION from our handler
duke@435 111 // since we don't have unwind information registered.
duke@435 112
duke@435 113 guarantee( result == EXCEPTION_CONTINUE_EXECUTION,
duke@435 114 "Unexpected result from topLevelExceptionFilter");
duke@435 115
duke@435 116 return(ExceptionContinueExecution);
duke@435 117 }
duke@435 118
duke@435 119
duke@435 120 // Structure containing the Windows Data Structures required
duke@435 121 // to register our Code Cache exception handler.
duke@435 122 // We put these in the CodeCache since the API requires
duke@435 123 // all addresses in these structures are relative to the Code
duke@435 124 // area registered with RtlAddFunctionTable.
duke@435 125 typedef struct {
duke@435 126 char ExceptionHandlerInstr[16]; // jmp HandleExceptionFromCodeCache
duke@435 127 RUNTIME_FUNCTION rt;
duke@435 128 UNWIND_INFO_EH_ONLY unw;
duke@435 129 } DynamicCodeData, *pDynamicCodeData;
duke@435 130
duke@435 131 #endif // AMD64
duke@435 132 //
duke@435 133 // Register our CodeCache area with the OS so it will dispatch exceptions
duke@435 134 // to our topLevelExceptionFilter when we take an exception in our
duke@435 135 // dynamically generated code.
duke@435 136 //
duke@435 137 // Arguments: low and high are the address of the full reserved
duke@435 138 // codeCache area
duke@435 139 //
duke@435 140 bool os::register_code_area(char *low, char *high) {
duke@435 141 #ifdef AMD64
duke@435 142
duke@435 143 ResourceMark rm;
duke@435 144
duke@435 145 pDynamicCodeData pDCD;
duke@435 146 PRUNTIME_FUNCTION prt;
duke@435 147 PUNWIND_INFO_EH_ONLY punwind;
duke@435 148
duke@435 149 // If we are using Vectored Exceptions we don't need this registration
duke@435 150 if (UseVectoredExceptions) return true;
duke@435 151
twisti@2103 152 BufferBlob* blob = BufferBlob::create("CodeCache Exception Handler", sizeof(DynamicCodeData));
twisti@2103 153 CodeBuffer cb(blob);
duke@435 154 MacroAssembler* masm = new MacroAssembler(&cb);
duke@435 155 pDCD = (pDynamicCodeData) masm->pc();
duke@435 156
duke@435 157 masm->jump(ExternalAddress((address)&HandleExceptionFromCodeCache));
duke@435 158 masm->flush();
duke@435 159
duke@435 160 // Create an Unwind Structure specifying no unwind info
duke@435 161 // other than an Exception Handler
duke@435 162 punwind = &pDCD->unw;
duke@435 163 punwind->Version = 1;
duke@435 164 punwind->Flags = UNW_FLAG_EHANDLER;
duke@435 165 punwind->SizeOfProlog = 0;
duke@435 166 punwind->CountOfCodes = 0;
duke@435 167 punwind->FrameRegister = 0;
duke@435 168 punwind->FrameOffset = 0;
duke@435 169 punwind->ExceptionHandler = (char *)(&(pDCD->ExceptionHandlerInstr[0])) -
duke@435 170 (char*)low;
duke@435 171 punwind->ExceptionData[0] = 0;
duke@435 172
duke@435 173 // This structure describes the covered dynamic code area.
duke@435 174 // Addresses are relative to the beginning on the code cache area
duke@435 175 prt = &pDCD->rt;
duke@435 176 prt->BeginAddress = 0;
duke@435 177 prt->EndAddress = (ULONG)(high - low);
duke@435 178 prt->UnwindData = ((char *)punwind - low);
duke@435 179
duke@435 180 guarantee(RtlAddFunctionTable(prt, 1, (ULONGLONG)low),
duke@435 181 "Failed to register Dynamic Code Exception Handler with RtlAddFunctionTable");
duke@435 182
duke@435 183 #endif // AMD64
duke@435 184 return true;
duke@435 185 }
duke@435 186
duke@435 187 void os::initialize_thread() {
duke@435 188 // Nothing to do.
duke@435 189 }
duke@435 190
duke@435 191 // Atomics and Stub Functions
duke@435 192
duke@435 193 typedef jint xchg_func_t (jint, volatile jint*);
duke@435 194 typedef intptr_t xchg_ptr_func_t (intptr_t, volatile intptr_t*);
duke@435 195 typedef jint cmpxchg_func_t (jint, volatile jint*, jint);
duke@435 196 typedef jlong cmpxchg_long_func_t (jlong, volatile jlong*, jlong);
duke@435 197 typedef jint add_func_t (jint, volatile jint*);
duke@435 198 typedef intptr_t add_ptr_func_t (intptr_t, volatile intptr_t*);
duke@435 199
duke@435 200 #ifdef AMD64
duke@435 201
duke@435 202 jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) {
duke@435 203 // try to use the stub:
duke@435 204 xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry());
duke@435 205
duke@435 206 if (func != NULL) {
duke@435 207 os::atomic_xchg_func = func;
duke@435 208 return (*func)(exchange_value, dest);
duke@435 209 }
duke@435 210 assert(Threads::number_of_threads() == 0, "for bootstrap only");
duke@435 211
duke@435 212 jint old_value = *dest;
duke@435 213 *dest = exchange_value;
duke@435 214 return old_value;
duke@435 215 }
duke@435 216
duke@435 217 intptr_t os::atomic_xchg_ptr_bootstrap(intptr_t exchange_value, volatile intptr_t* dest) {
duke@435 218 // try to use the stub:
duke@435 219 xchg_ptr_func_t* func = CAST_TO_FN_PTR(xchg_ptr_func_t*, StubRoutines::atomic_xchg_ptr_entry());
duke@435 220
duke@435 221 if (func != NULL) {
duke@435 222 os::atomic_xchg_ptr_func = func;
duke@435 223 return (*func)(exchange_value, dest);
duke@435 224 }
duke@435 225 assert(Threads::number_of_threads() == 0, "for bootstrap only");
duke@435 226
duke@435 227 intptr_t old_value = *dest;
duke@435 228 *dest = exchange_value;
duke@435 229 return old_value;
duke@435 230 }
duke@435 231
duke@435 232
duke@435 233 jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint compare_value) {
duke@435 234 // try to use the stub:
duke@435 235 cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry());
duke@435 236
duke@435 237 if (func != NULL) {
duke@435 238 os::atomic_cmpxchg_func = func;
duke@435 239 return (*func)(exchange_value, dest, compare_value);
duke@435 240 }
duke@435 241 assert(Threads::number_of_threads() == 0, "for bootstrap only");
duke@435 242
duke@435 243 jint old_value = *dest;
duke@435 244 if (old_value == compare_value)
duke@435 245 *dest = exchange_value;
duke@435 246 return old_value;
duke@435 247 }
duke@435 248 #endif // AMD64
duke@435 249
duke@435 250 jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* dest, jlong compare_value) {
duke@435 251 // try to use the stub:
duke@435 252 cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry());
duke@435 253
duke@435 254 if (func != NULL) {
duke@435 255 os::atomic_cmpxchg_long_func = func;
duke@435 256 return (*func)(exchange_value, dest, compare_value);
duke@435 257 }
duke@435 258 assert(Threads::number_of_threads() == 0, "for bootstrap only");
duke@435 259
duke@435 260 jlong old_value = *dest;
duke@435 261 if (old_value == compare_value)
duke@435 262 *dest = exchange_value;
duke@435 263 return old_value;
duke@435 264 }
duke@435 265
duke@435 266 #ifdef AMD64
duke@435 267
duke@435 268 jint os::atomic_add_bootstrap(jint add_value, volatile jint* dest) {
duke@435 269 // try to use the stub:
duke@435 270 add_func_t* func = CAST_TO_FN_PTR(add_func_t*, StubRoutines::atomic_add_entry());
duke@435 271
duke@435 272 if (func != NULL) {
duke@435 273 os::atomic_add_func = func;
duke@435 274 return (*func)(add_value, dest);
duke@435 275 }
duke@435 276 assert(Threads::number_of_threads() == 0, "for bootstrap only");
duke@435 277
duke@435 278 return (*dest) += add_value;
duke@435 279 }
duke@435 280
duke@435 281 intptr_t os::atomic_add_ptr_bootstrap(intptr_t add_value, volatile intptr_t* dest) {
duke@435 282 // try to use the stub:
duke@435 283 add_ptr_func_t* func = CAST_TO_FN_PTR(add_ptr_func_t*, StubRoutines::atomic_add_ptr_entry());
duke@435 284
duke@435 285 if (func != NULL) {
duke@435 286 os::atomic_add_ptr_func = func;
duke@435 287 return (*func)(add_value, dest);
duke@435 288 }
duke@435 289 assert(Threads::number_of_threads() == 0, "for bootstrap only");
duke@435 290
duke@435 291 return (*dest) += add_value;
duke@435 292 }
duke@435 293
duke@435 294 xchg_func_t* os::atomic_xchg_func = os::atomic_xchg_bootstrap;
duke@435 295 xchg_ptr_func_t* os::atomic_xchg_ptr_func = os::atomic_xchg_ptr_bootstrap;
duke@435 296 cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap;
duke@435 297 add_func_t* os::atomic_add_func = os::atomic_add_bootstrap;
duke@435 298 add_ptr_func_t* os::atomic_add_ptr_func = os::atomic_add_ptr_bootstrap;
duke@435 299
duke@435 300 #endif // AMD64
duke@435 301
duke@435 302 cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap;
duke@435 303
duke@435 304 ExtendedPC os::fetch_frame_from_context(void* ucVoid,
duke@435 305 intptr_t** ret_sp, intptr_t** ret_fp) {
duke@435 306
duke@435 307 ExtendedPC epc;
duke@435 308 CONTEXT* uc = (CONTEXT*)ucVoid;
duke@435 309
duke@435 310 if (uc != NULL) {
duke@435 311 epc = ExtendedPC((address)uc->REG_PC);
duke@435 312 if (ret_sp) *ret_sp = (intptr_t*)uc->REG_SP;
duke@435 313 if (ret_fp) *ret_fp = (intptr_t*)uc->REG_FP;
duke@435 314 } else {
duke@435 315 // construct empty ExtendedPC for return value checking
duke@435 316 epc = ExtendedPC(NULL);
duke@435 317 if (ret_sp) *ret_sp = (intptr_t *)NULL;
duke@435 318 if (ret_fp) *ret_fp = (intptr_t *)NULL;
duke@435 319 }
duke@435 320
duke@435 321 return epc;
duke@435 322 }
duke@435 323
duke@435 324 frame os::fetch_frame_from_context(void* ucVoid) {
duke@435 325 intptr_t* sp;
duke@435 326 intptr_t* fp;
duke@435 327 ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
duke@435 328 return frame(sp, fp, epc.pc());
duke@435 329 }
duke@435 330
duke@435 331 // VC++ does not save frame pointer on stack in optimized build. It
duke@435 332 // can be turned off by /Oy-. If we really want to walk C frames,
duke@435 333 // we can use the StackWalk() API.
duke@435 334 frame os::get_sender_for_C_frame(frame* fr) {
duke@435 335 return frame(fr->sender_sp(), fr->link(), fr->sender_pc());
duke@435 336 }
duke@435 337
duke@435 338
duke@435 339 #ifndef AMD64
duke@435 340 intptr_t* _get_previous_fp() {
duke@435 341 intptr_t **frameptr;
duke@435 342 __asm {
duke@435 343 mov frameptr, ebp
duke@435 344 };
duke@435 345 return *frameptr;
duke@435 346 }
duke@435 347 #endif // !AMD64
duke@435 348
duke@435 349 frame os::current_frame() {
duke@435 350
duke@435 351 #ifdef AMD64
duke@435 352 // apparently _asm not supported on windows amd64
duke@435 353 typedef intptr_t* get_fp_func ();
duke@435 354 get_fp_func* func = CAST_TO_FN_PTR(get_fp_func*,
never@739 355 StubRoutines::x86::get_previous_fp_entry());
duke@435 356 if (func == NULL) return frame(NULL, NULL, NULL);
duke@435 357 intptr_t* fp = (*func)();
duke@435 358 #else
duke@435 359 intptr_t* fp = _get_previous_fp();
duke@435 360 #endif // AMD64
duke@435 361
duke@435 362 frame myframe((intptr_t*)os::current_stack_pointer(),
duke@435 363 (intptr_t*)fp,
duke@435 364 CAST_FROM_FN_PTR(address, os::current_frame));
duke@435 365 if (os::is_first_C_frame(&myframe)) {
duke@435 366 // stack is not walkable
duke@435 367 return frame(NULL, NULL, NULL);
duke@435 368 } else {
duke@435 369 return os::get_sender_for_C_frame(&myframe);
duke@435 370 }
duke@435 371 }
duke@435 372
duke@435 373 void os::print_context(outputStream *st, void *context) {
duke@435 374 if (context == NULL) return;
duke@435 375
duke@435 376 CONTEXT* uc = (CONTEXT*)context;
duke@435 377
duke@435 378 st->print_cr("Registers:");
duke@435 379 #ifdef AMD64
bobv@2036 380 st->print( "RAX=" INTPTR_FORMAT, uc->Rax);
bobv@2036 381 st->print(", RBX=" INTPTR_FORMAT, uc->Rbx);
bobv@2036 382 st->print(", RCX=" INTPTR_FORMAT, uc->Rcx);
bobv@2036 383 st->print(", RDX=" INTPTR_FORMAT, uc->Rdx);
duke@435 384 st->cr();
bobv@2036 385 st->print( "RSP=" INTPTR_FORMAT, uc->Rsp);
bobv@2036 386 st->print(", RBP=" INTPTR_FORMAT, uc->Rbp);
bobv@2036 387 st->print(", RSI=" INTPTR_FORMAT, uc->Rsi);
bobv@2036 388 st->print(", RDI=" INTPTR_FORMAT, uc->Rdi);
duke@435 389 st->cr();
never@2262 390 st->print( "R8 =" INTPTR_FORMAT, uc->R8);
never@2262 391 st->print(", R9 =" INTPTR_FORMAT, uc->R9);
bobv@2036 392 st->print(", R10=" INTPTR_FORMAT, uc->R10);
bobv@2036 393 st->print(", R11=" INTPTR_FORMAT, uc->R11);
bobv@2036 394 st->cr();
bobv@2036 395 st->print( "R12=" INTPTR_FORMAT, uc->R12);
bobv@2036 396 st->print(", R13=" INTPTR_FORMAT, uc->R13);
bobv@2036 397 st->print(", R14=" INTPTR_FORMAT, uc->R14);
bobv@2036 398 st->print(", R15=" INTPTR_FORMAT, uc->R15);
bobv@2036 399 st->cr();
bobv@2036 400 st->print( "RIP=" INTPTR_FORMAT, uc->Rip);
duke@435 401 st->print(", EFLAGS=" INTPTR_FORMAT, uc->EFlags);
duke@435 402 #else
duke@435 403 st->print( "EAX=" INTPTR_FORMAT, uc->Eax);
duke@435 404 st->print(", EBX=" INTPTR_FORMAT, uc->Ebx);
duke@435 405 st->print(", ECX=" INTPTR_FORMAT, uc->Ecx);
duke@435 406 st->print(", EDX=" INTPTR_FORMAT, uc->Edx);
duke@435 407 st->cr();
duke@435 408 st->print( "ESP=" INTPTR_FORMAT, uc->Esp);
duke@435 409 st->print(", EBP=" INTPTR_FORMAT, uc->Ebp);
duke@435 410 st->print(", ESI=" INTPTR_FORMAT, uc->Esi);
duke@435 411 st->print(", EDI=" INTPTR_FORMAT, uc->Edi);
duke@435 412 st->cr();
duke@435 413 st->print( "EIP=" INTPTR_FORMAT, uc->Eip);
duke@435 414 st->print(", EFLAGS=" INTPTR_FORMAT, uc->EFlags);
duke@435 415 #endif // AMD64
duke@435 416 st->cr();
duke@435 417 st->cr();
duke@435 418
duke@435 419 intptr_t *sp = (intptr_t *)uc->REG_SP;
duke@435 420 st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp);
duke@435 421 print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t));
duke@435 422 st->cr();
duke@435 423
duke@435 424 // Note: it may be unsafe to inspect memory near pc. For example, pc may
duke@435 425 // point to garbage if entry point in an nmethod is corrupted. Leave
duke@435 426 // this at the end, and hope for the best.
duke@435 427 address pc = (address)uc->REG_PC;
duke@435 428 st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc);
never@2262 429 print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
never@2262 430 st->cr();
never@2262 431 }
never@2262 432
never@2262 433
never@2262 434 void os::print_register_info(outputStream *st, void *context) {
never@2262 435 if (context == NULL) return;
never@2262 436
never@2262 437 CONTEXT* uc = (CONTEXT*)context;
never@2262 438
never@2262 439 st->print_cr("Register to memory mapping:");
never@2262 440 st->cr();
never@2262 441
never@2262 442 // this is only for the "general purpose" registers
never@2262 443
never@2262 444 #ifdef AMD64
never@2262 445 st->print("RAX="); print_location(st, uc->Rax);
never@2262 446 st->print("RBX="); print_location(st, uc->Rbx);
never@2262 447 st->print("RCX="); print_location(st, uc->Rcx);
never@2262 448 st->print("RDX="); print_location(st, uc->Rdx);
never@2262 449 st->print("RSP="); print_location(st, uc->Rsp);
never@2262 450 st->print("RBP="); print_location(st, uc->Rbp);
never@2262 451 st->print("RSI="); print_location(st, uc->Rsi);
never@2262 452 st->print("RDI="); print_location(st, uc->Rdi);
never@2262 453 st->print("R8 ="); print_location(st, uc->R8);
never@2262 454 st->print("R9 ="); print_location(st, uc->R9);
never@2262 455 st->print("R10="); print_location(st, uc->R10);
never@2262 456 st->print("R11="); print_location(st, uc->R11);
never@2262 457 st->print("R12="); print_location(st, uc->R12);
never@2262 458 st->print("R13="); print_location(st, uc->R13);
never@2262 459 st->print("R14="); print_location(st, uc->R14);
never@2262 460 st->print("R15="); print_location(st, uc->R15);
never@2262 461 #else
never@2262 462 st->print("EAX="); print_location(st, uc->Eax);
never@2262 463 st->print("EBX="); print_location(st, uc->Ebx);
never@2262 464 st->print("ECX="); print_location(st, uc->Ecx);
never@2262 465 st->print("EDX="); print_location(st, uc->Edx);
never@2262 466 st->print("ESP="); print_location(st, uc->Esp);
never@2262 467 st->print("EBP="); print_location(st, uc->Ebp);
never@2262 468 st->print("ESI="); print_location(st, uc->Esi);
never@2262 469 st->print("EDI="); print_location(st, uc->Edi);
never@2262 470 #endif
never@2262 471
duke@435 472 st->cr();
duke@435 473 }
duke@435 474
duke@435 475 extern "C" int SafeFetch32 (int * adr, int Err) {
duke@435 476 int rv = Err ;
duke@435 477 _try {
duke@435 478 rv = *((volatile int *) adr) ;
duke@435 479 } __except(EXCEPTION_EXECUTE_HANDLER) {
duke@435 480 }
duke@435 481 return rv ;
duke@435 482 }
duke@435 483
duke@435 484 extern "C" intptr_t SafeFetchN (intptr_t * adr, intptr_t Err) {
duke@435 485 intptr_t rv = Err ;
duke@435 486 _try {
duke@435 487 rv = *((volatile intptr_t *) adr) ;
duke@435 488 } __except(EXCEPTION_EXECUTE_HANDLER) {
duke@435 489 }
duke@435 490 return rv ;
duke@435 491 }
duke@435 492
duke@435 493 extern "C" int SpinPause () {
duke@435 494 #ifdef AMD64
duke@435 495 return 0 ;
duke@435 496 #else
duke@435 497 // pause == rep:nop
duke@435 498 // On systems that don't support pause a rep:nop
duke@435 499 // is executed as a nop. The rep: prefix is ignored.
duke@435 500 _asm {
duke@435 501 pause ;
duke@435 502 };
duke@435 503 return 1 ;
duke@435 504 #endif // AMD64
duke@435 505 }
duke@435 506
duke@435 507
duke@435 508 void os::setup_fpu() {
duke@435 509 #ifndef AMD64
duke@435 510 int fpu_cntrl_word = StubRoutines::fpu_cntrl_wrd_std();
duke@435 511 __asm fldcw fpu_cntrl_word;
duke@435 512 #endif // !AMD64
duke@435 513 }

mercurial