< prev index next >

src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp

Print this page
rev 50962 : [mq]: 8207011


 262 # else
 263 #  define context_pc uc_mcontext.__gregs[_REG_EIP]
 264 #  define context_sp uc_mcontext.__gregs[_REG_UESP]
 265 #  define context_fp uc_mcontext.__gregs[_REG_EBP]
 266 #  define context_eip uc_mcontext.__gregs[_REG_EIP]
 267 #  define context_esp uc_mcontext.__gregs[_REG_UESP]
 268 #  define context_eax uc_mcontext.__gregs[_REG_EAX]
 269 #  define context_ebx uc_mcontext.__gregs[_REG_EBX]
 270 #  define context_ecx uc_mcontext.__gregs[_REG_ECX]
 271 #  define context_edx uc_mcontext.__gregs[_REG_EDX]
 272 #  define context_ebp uc_mcontext.__gregs[_REG_EBP]
 273 #  define context_esi uc_mcontext.__gregs[_REG_ESI]
 274 #  define context_edi uc_mcontext.__gregs[_REG_EDI]
 275 #  define context_eflags uc_mcontext.__gregs[_REG_EFL]
 276 #  define context_trapno uc_mcontext.__gregs[_REG_TRAPNO]
 277 # endif
 278 #endif
 279 
 280 address os::current_stack_pointer() {
 281 #if defined(__clang__) || defined(__llvm__)
 282   register void *esp;
 283   __asm__("mov %%" SPELL_REG_SP ", %0":"=r"(esp));
 284   return (address) esp;
 285 #elif defined(SPARC_WORKS)
 286   register void *esp;
 287   __asm__("mov %%" SPELL_REG_SP ", %0":"=r"(esp));
 288   return (address) ((char*)esp + sizeof(long)*2);
 289 #else
 290   register void *esp __asm__ (SPELL_REG_SP);
 291   return (address) esp;
 292 #endif
 293 }
 294 
 295 char* os::non_memory_address_word() {
 296   // Must never look like an address returned by reserve_memory,
 297   // even in its subfields (as defined by the CPU immediate fields,
 298   // if the CPU splits constants across multiple instructions).
 299 
 300   return (char*) -1;
 301 }
 302 
 303 void os::initialize_thread(Thread* thr) {
 304 // Nothing to do.
 305 }
 306 


 398       // has been pushed on the stack
 399       *fr = frame(fr->sp() + 1, fr->fp(), (address)*(fr->sp()));
 400       if (!fr->is_java_frame()) {
 401         // See java_sender() comment above.
 402         *fr = fr->java_sender();
 403       }
 404     }
 405   }
 406   assert(fr->is_java_frame(), "Safety check");
 407   return true;
 408 }
 409 
 410 // By default, gcc always save frame pointer (%ebp/%rbp) on stack. It may get
 411 // turned off by -fomit-frame-pointer,
 412 frame os::get_sender_for_C_frame(frame* fr) {
 413   return frame(fr->sender_sp(), fr->link(), fr->sender_pc());
 414 }
 415 
 416 intptr_t* _get_previous_fp() {
 417 #if defined(SPARC_WORKS) || defined(__clang__) || defined(__llvm__)
 418   register intptr_t **ebp;
 419   __asm__("mov %%" SPELL_REG_FP ", %0":"=r"(ebp));
 420 #else
 421   register intptr_t **ebp __asm__ (SPELL_REG_FP);
 422 #endif
 423   // ebp is for this frame (_get_previous_fp). We want the ebp for the
 424   // caller of os::current_frame*(), so go up two frames. However, for
 425   // optimized builds, _get_previous_fp() will be inlined, so only go
 426   // up 1 frame in that case.
 427 #ifdef _NMT_NOINLINE_
 428   return **(intptr_t***)ebp;
 429 #else
 430   return *ebp;
 431 #endif
 432 }
 433 
 434 
 435 frame os::current_frame() {
 436   intptr_t* fp = _get_previous_fp();
 437   frame myframe((intptr_t*)os::current_stack_pointer(),
 438                 (intptr_t*)fp,




 262 # else
 263 #  define context_pc uc_mcontext.__gregs[_REG_EIP]
 264 #  define context_sp uc_mcontext.__gregs[_REG_UESP]
 265 #  define context_fp uc_mcontext.__gregs[_REG_EBP]
 266 #  define context_eip uc_mcontext.__gregs[_REG_EIP]
 267 #  define context_esp uc_mcontext.__gregs[_REG_UESP]
 268 #  define context_eax uc_mcontext.__gregs[_REG_EAX]
 269 #  define context_ebx uc_mcontext.__gregs[_REG_EBX]
 270 #  define context_ecx uc_mcontext.__gregs[_REG_ECX]
 271 #  define context_edx uc_mcontext.__gregs[_REG_EDX]
 272 #  define context_ebp uc_mcontext.__gregs[_REG_EBP]
 273 #  define context_esi uc_mcontext.__gregs[_REG_ESI]
 274 #  define context_edi uc_mcontext.__gregs[_REG_EDI]
 275 #  define context_eflags uc_mcontext.__gregs[_REG_EFL]
 276 #  define context_trapno uc_mcontext.__gregs[_REG_TRAPNO]
 277 # endif
 278 #endif
 279 
 280 address os::current_stack_pointer() {
 281 #if defined(__clang__) || defined(__llvm__)
 282   void *esp;
 283   __asm__("mov %%" SPELL_REG_SP ", %0":"=r"(esp));
 284   return (address) esp;
 285 #elif defined(SPARC_WORKS)
 286   void *esp;
 287   __asm__("mov %%" SPELL_REG_SP ", %0":"=r"(esp));
 288   return (address) ((char*)esp + sizeof(long)*2);
 289 #else
 290   register void *esp __asm__ (SPELL_REG_SP);
 291   return (address) esp;
 292 #endif
 293 }
 294 
 295 char* os::non_memory_address_word() {
 296   // Must never look like an address returned by reserve_memory,
 297   // even in its subfields (as defined by the CPU immediate fields,
 298   // if the CPU splits constants across multiple instructions).
 299 
 300   return (char*) -1;
 301 }
 302 
 303 void os::initialize_thread(Thread* thr) {
 304 // Nothing to do.
 305 }
 306 


 398       // has been pushed on the stack
 399       *fr = frame(fr->sp() + 1, fr->fp(), (address)*(fr->sp()));
 400       if (!fr->is_java_frame()) {
 401         // See java_sender() comment above.
 402         *fr = fr->java_sender();
 403       }
 404     }
 405   }
 406   assert(fr->is_java_frame(), "Safety check");
 407   return true;
 408 }
 409 
 410 // By default, gcc always save frame pointer (%ebp/%rbp) on stack. It may get
 411 // turned off by -fomit-frame-pointer,
 412 frame os::get_sender_for_C_frame(frame* fr) {
 413   return frame(fr->sender_sp(), fr->link(), fr->sender_pc());
 414 }
 415 
 416 intptr_t* _get_previous_fp() {
 417 #if defined(SPARC_WORKS) || defined(__clang__) || defined(__llvm__)
 418   intptr_t **ebp;
 419   __asm__("mov %%" SPELL_REG_FP ", %0":"=r"(ebp));
 420 #else
 421   register intptr_t **ebp __asm__ (SPELL_REG_FP);
 422 #endif
 423   // ebp is for this frame (_get_previous_fp). We want the ebp for the
 424   // caller of os::current_frame*(), so go up two frames. However, for
 425   // optimized builds, _get_previous_fp() will be inlined, so only go
 426   // up 1 frame in that case.
 427 #ifdef _NMT_NOINLINE_
 428   return **(intptr_t***)ebp;
 429 #else
 430   return *ebp;
 431 #endif
 432 }
 433 
 434 
 435 frame os::current_frame() {
 436   intptr_t* fp = _get_previous_fp();
 437   frame myframe((intptr_t*)os::current_stack_pointer(),
 438                 (intptr_t*)fp,


< prev index next >