src/os/solaris/vm/os_solaris.hpp

Print this page
rev 4773 : 8005849: JEP 167: Event-Based JVM Tracing
Reviewed-by: acorn, coleenp, sla
Contributed-by: Karen Kinnear <karen.kinnear@oracle.com>, Bengt Rutisson <bengt.rutisson@oracle.com>, Calvin Cheung <calvin.cheung@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Erik Helin <erik.helin@oracle.com>, Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>, Keith McGuigan <keith.mcguigan@oracle.com>, Mattias Tobiasson <mattias.tobiasson@oracle.com>, Markus Gronlund <markus.gronlund@oracle.com>, Mikael Auno <mikael.auno@oracle.com>, Nils Eliasson <nils.eliasson@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>, Stefan Karlsson <stefan.karlsson@oracle.com>, Yekaterina Kantserova <yekaterina.kantserova@oracle.com>
   1 /*
   2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 110   static bool set_mpss_range(caddr_t start, size_t bytes, size_t align);
 111 
 112   static void init_thread_fpu_state(void);
 113 
 114   static void try_enable_extended_io();
 115 
 116   // For signal-chaining
 117   static unsigned long sigs;                 // mask of signals that have
 118                                              // preinstalled signal handlers
 119   static struct sigaction *(*get_signal_action)(int);
 120   static struct sigaction *get_preinstalled_handler(int);
 121   static int (*get_libjsig_version)();
 122   static void save_preinstalled_handler(int, struct sigaction&);
 123   static void check_signal_handler(int sig);
 124   // For overridable signals
 125   static int _SIGinterrupt;                  // user-overridable INTERRUPT_SIGNAL
 126   static int _SIGasync;                      // user-overridable ASYNC_SIGNAL
 127   static void set_SIGinterrupt(int newsig) { _SIGinterrupt = newsig; }
 128   static void set_SIGasync(int newsig) { _SIGasync = newsig; }
 129 
 130 
 131  public:
 132   // Large Page Support--ISM.
 133   static bool largepage_range(char* addr, size_t size);
 134 
 135   static int SIGinterrupt() { return _SIGinterrupt; }
 136   static int SIGasync() { return _SIGasync; }
 137   static address handler_start, handler_end; // start and end pc of thr_sighndlrinfo
 138 
 139   static bool valid_stack_address(Thread* thread, address sp);
 140   static bool valid_ucontext(Thread* thread, ucontext_t* valid, ucontext_t* suspect);
 141   static ucontext_t* get_valid_uc_in_signal_handler(Thread* thread,
 142     ucontext_t* uc);
 143 
 144   static ExtendedPC  ucontext_get_ExtendedPC(ucontext_t* uc);
 145   static intptr_t*   ucontext_get_sp(ucontext_t* uc);
 146   // ucontext_get_fp() is only used by Solaris X86 (see note below)
 147   static intptr_t*   ucontext_get_fp(ucontext_t* uc);

 148 
 149   // For Analyzer Forte AsyncGetCallTrace profiling support:
 150   // Parameter ret_fp is only used by Solaris X86.
 151   //
 152   // We should have different declarations of this interface in
 153   // os_solaris_i486.hpp and os_solaris_sparc.hpp, but that file
 154   // provides extensions to the os class and not the Solaris class.
 155   static ExtendedPC fetch_frame_from_ucontext(Thread* thread, ucontext_t* uc,
 156     intptr_t** ret_sp, intptr_t** ret_fp);
 157 
 158   static void hotspot_sigmask(Thread* thread);
 159 


 160  protected:
 161   // Solaris-specific interface goes here
 162   static julong available_memory();
 163   static julong physical_memory() { return _physical_memory; }
 164   static julong _physical_memory;
 165   static void initialize_system_info();
 166   static int _dev_zero_fd;
 167   static int get_dev_zero_fd() { return _dev_zero_fd; }
 168   static void set_dev_zero_fd(int fd) { _dev_zero_fd = fd; }
 169   static char* mmap_chunk(char *addr, size_t size, int flags, int prot);
 170   static char* anon_mmap(char* requested_addr, size_t bytes, size_t alignment_hint, bool fixed);
 171   static bool mpss_sanity_check(bool warn, size_t * page_size);
 172   static bool ism_sanity_check (bool warn, size_t * page_size);
 173 
 174   // Workaround for 4352906. thr_stksegment sometimes returns
 175   // a bad value for the primordial thread's stack base when
 176   // it is called more than one time.
 177   // Workaround is to cache the initial value to avoid further
 178   // calls to thr_stksegment.
 179   // It appears that someone (Hotspot?) is trashing the user's


   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 110   static bool set_mpss_range(caddr_t start, size_t bytes, size_t align);
 111 
 112   static void init_thread_fpu_state(void);
 113 
 114   static void try_enable_extended_io();
 115 
 116   // For signal-chaining
 117   static unsigned long sigs;                 // mask of signals that have
 118                                              // preinstalled signal handlers
 119   static struct sigaction *(*get_signal_action)(int);
 120   static struct sigaction *get_preinstalled_handler(int);
 121   static int (*get_libjsig_version)();
 122   static void save_preinstalled_handler(int, struct sigaction&);
 123   static void check_signal_handler(int sig);
 124   // For overridable signals
 125   static int _SIGinterrupt;                  // user-overridable INTERRUPT_SIGNAL
 126   static int _SIGasync;                      // user-overridable ASYNC_SIGNAL
 127   static void set_SIGinterrupt(int newsig) { _SIGinterrupt = newsig; }
 128   static void set_SIGasync(int newsig) { _SIGasync = newsig; }
 129 

 130  public:
 131   // Large Page Support--ISM.
 132   static bool largepage_range(char* addr, size_t size);
 133 
 134   static int SIGinterrupt() { return _SIGinterrupt; }
 135   static int SIGasync() { return _SIGasync; }
 136   static address handler_start, handler_end; // start and end pc of thr_sighndlrinfo
 137 
 138   static bool valid_stack_address(Thread* thread, address sp);
 139   static bool valid_ucontext(Thread* thread, ucontext_t* valid, ucontext_t* suspect);
 140   static ucontext_t* get_valid_uc_in_signal_handler(Thread* thread,
 141     ucontext_t* uc);
 142 
 143   static ExtendedPC  ucontext_get_ExtendedPC(ucontext_t* uc);
 144   static intptr_t*   ucontext_get_sp(ucontext_t* uc);
 145   // ucontext_get_fp() is only used by Solaris X86 (see note below)
 146   static intptr_t*   ucontext_get_fp(ucontext_t* uc);
 147   static address    ucontext_get_pc(ucontext_t* uc);
 148 
 149   // For Analyzer Forte AsyncGetCallTrace profiling support:
 150   // Parameter ret_fp is only used by Solaris X86.
 151   //
 152   // We should have different declarations of this interface in
 153   // os_solaris_i486.hpp and os_solaris_sparc.hpp, but that file
 154   // provides extensions to the os class and not the Solaris class.
 155   static ExtendedPC fetch_frame_from_ucontext(Thread* thread, ucontext_t* uc,
 156     intptr_t** ret_sp, intptr_t** ret_fp);
 157 
 158   static void hotspot_sigmask(Thread* thread);
 159 
 160   // SR_handler
 161   static void SR_handler(Thread* thread, ucontext_t* uc);
 162  protected:
 163   // Solaris-specific interface goes here
 164   static julong available_memory();
 165   static julong physical_memory() { return _physical_memory; }
 166   static julong _physical_memory;
 167   static void initialize_system_info();
 168   static int _dev_zero_fd;
 169   static int get_dev_zero_fd() { return _dev_zero_fd; }
 170   static void set_dev_zero_fd(int fd) { _dev_zero_fd = fd; }
 171   static char* mmap_chunk(char *addr, size_t size, int flags, int prot);
 172   static char* anon_mmap(char* requested_addr, size_t bytes, size_t alignment_hint, bool fixed);
 173   static bool mpss_sanity_check(bool warn, size_t * page_size);
 174   static bool ism_sanity_check (bool warn, size_t * page_size);
 175 
 176   // Workaround for 4352906. thr_stksegment sometimes returns
 177   // a bad value for the primordial thread's stack base when
 178   // it is called more than one time.
 179   // Workaround is to cache the initial value to avoid further
 180   // calls to thr_stksegment.
 181   // It appears that someone (Hotspot?) is trashing the user's