hotspot/src/os/bsd/vm/os_bsd.cpp
changeset 16670 4af09aff4237
parent 16669 fb3397cee116
child 16672 152c041083e1
equal deleted inserted replaced
16669:fb3397cee116 16670:4af09aff4237
   150 
   150 
   151 ////////////////////////////////////////////////////////////////////////////////
   151 ////////////////////////////////////////////////////////////////////////////////
   152 // utility functions
   152 // utility functions
   153 
   153 
   154 static int SR_initialize();
   154 static int SR_initialize();
   155 static int SR_finalize();
       
   156 
   155 
   157 julong os::available_memory() {
   156 julong os::available_memory() {
   158   return Bsd::available_memory();
   157   return Bsd::available_memory();
   159 }
   158 }
   160 
   159 
  2781   // Save signal flag
  2780   // Save signal flag
  2782   os::Bsd::set_our_sigflags(SR_signum, act.sa_flags);
  2781   os::Bsd::set_our_sigflags(SR_signum, act.sa_flags);
  2783   return 0;
  2782   return 0;
  2784 }
  2783 }
  2785 
  2784 
  2786 static int SR_finalize() {
       
  2787   return 0;
       
  2788 }
       
  2789 
       
  2790 
  2785 
  2791 // returns true on success and false on error - really an error is fatal
  2786 // returns true on success and false on error - really an error is fatal
  2792 // but this seems the normal response to library errors
  2787 // but this seems the normal response to library errors
  2793 static bool do_suspend(OSThread* osthread) {
  2788 static bool do_suspend(OSThread* osthread) {
  2794   // mark as suspended and send signal
  2789   // mark as suspended and send signal
  3593 }
  3588 }
  3594 
  3589 
  3595 ////////////////////////////////////////////////////////////////////////////////
  3590 ////////////////////////////////////////////////////////////////////////////////
  3596 // debug support
  3591 // debug support
  3597 
  3592 
  3598 static address same_page(address x, address y) {
       
  3599   int page_bits = -os::vm_page_size();
       
  3600   if ((intptr_t(x) & page_bits) == (intptr_t(y) & page_bits))
       
  3601     return x;
       
  3602   else if (x > y)
       
  3603     return (address)(intptr_t(y) | ~page_bits) + 1;
       
  3604   else
       
  3605     return (address)(intptr_t(y) & page_bits);
       
  3606 }
       
  3607 
       
  3608 bool os::find(address addr, outputStream* st) {
  3593 bool os::find(address addr, outputStream* st) {
  3609   Dl_info dlinfo;
  3594   Dl_info dlinfo;
  3610   memset(&dlinfo, 0, sizeof(dlinfo));
  3595   memset(&dlinfo, 0, sizeof(dlinfo));
  3611   if (dladdr(addr, &dlinfo)) {
  3596   if (dladdr(addr, &dlinfo)) {
  3612     st->print(PTR_FORMAT ": ", addr);
  3597     st->print(PTR_FORMAT ": ", addr);
  3626     }
  3611     }
  3627     st->cr();
  3612     st->cr();
  3628 
  3613 
  3629     if (Verbose) {
  3614     if (Verbose) {
  3630       // decode some bytes around the PC
  3615       // decode some bytes around the PC
  3631       address begin = same_page(addr-40, addr);
  3616       address begin = clamp_address_in_page(addr-40, addr, os::vm_page_size());
  3632       address end   = same_page(addr+40, addr);
  3617       address end   = clamp_address_in_page(addr+40, addr, os::vm_page_size());
  3633       address       lowest = (address) dlinfo.dli_sname;
  3618       address       lowest = (address) dlinfo.dli_sname;
  3634       if (!lowest)  lowest = (address) dlinfo.dli_fbase;
  3619       if (!lowest)  lowest = (address) dlinfo.dli_fbase;
  3635       if (begin < lowest)  begin = lowest;
  3620       if (begin < lowest)  begin = lowest;
  3636       Dl_info dlinfo2;
  3621       Dl_info dlinfo2;
  3637       if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr
  3622       if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr