/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef OS_SOLARIS_VM_OS_SOLARIS_HPP
#define OS_SOLARIS_VM_OS_SOLARIS_HPP
// Solaris_OS defines the interface to Solaris operating systems
class Solaris {
friend class os;
private:
// Support for "new" libthread APIs for getting & setting thread context (2.8)
#define TRS_VALID 0
// _T2_libthread is true if we believe we are running with the newer
// which is a lightweight libthread that also supports all T1
static bool _T2_libthread;
// These refer to new libthread interface functions
// They get intialized if we dynamically detect new libthread
// libthread_init sets the above, if the new functionality is detected
// initialized to libthread or lwp synchronization primitives depending on UseLWPSychronization
static int _mutex_scope;
static int _cond_scope;
typedef int lgrp_rsrc_t;
typedef enum lgrp_view {
} lgrp_view_t;
// Large Page Support--mpss.
static void init_thread_fpu_state(void);
static void try_enable_extended_io();
// For signal-chaining
// preinstalled signal handlers
static struct sigaction *get_preinstalled_handler(int);
static int (*get_libjsig_version)();
static void save_preinstalled_handler(int, struct sigaction&);
static void check_signal_handler(int sig);
// For overridable signals
public:
// Large Page Support--ISM.
ucontext_t* uc);
// ucontext_get_fp() is only used by Solaris X86 (see note below)
// For Analyzer Forte AsyncGetCallTrace profiling support:
// Parameter ret_fp is only used by Solaris X86.
//
// We should have different declarations of this interface in
// os_solaris_i486.hpp and os_solaris_sparc.hpp, but that file
// provides extensions to the os class and not the Solaris class.
// SR_handler
protected:
// Solaris-specific interface goes here
static julong available_memory();
static void initialize_system_info();
static int _dev_zero_fd;
// Workaround for 4352906. thr_stksegment sometimes returns
// a bad value for the primordial thread's stack base when
// it is called more than one time.
// Workaround is to cache the initial value to avoid further
// calls to thr_stksegment.
// It appears that someone (Hotspot?) is trashing the user's
// proc_t structure (note that this is a system struct).
public:
static void libthread_init();
static void synchronization_init();
static bool liblgrp_init();
// Load miscellaneous symbols.
static void misc_sym_init();
// This boolean allows users to forward their own non-matching signals
// to JVM_handle_solaris_signal, harmlessly.
static bool signal_handlers_are_installed;
static void signal_sets_init();
static void install_signal_handlers();
static void init_signal_mem();
static bool is_sig_ignored(int sig);
static void set_our_sigflags(int, int);
static int get_our_sigflags(int);
// For signal-chaining
// signal(), sigset() is loaded
// The following allow us to link against both the old and new libthread (2.8)
// and exploit the new libthread functionality if available.
{ _thr_getstate = func; }
static int thr_setstate(thread_t tid, int flag, gregset_t rs) { return _thr_setstate(tid, flag, rs); }
// Allows us to switch between lwp and thread -based synchronization
{ _cond_timedwait = func; }
static id_t lgrp_home(idtype_t type, id_t id) { return _lgrp_home != NULL ? _lgrp_home(type, id) : -1; }
static lgrp_cookie_t lgrp_init(lgrp_view_t view) { return _lgrp_init != NULL ? _lgrp_init(view) : 0; }
static lgrp_id_t lgrp_root(lgrp_cookie_t cookie) { return _lgrp_root != NULL ? _lgrp_root(cookie) : -1; };
}
lgrp_rsrc_t type) {
return _lgrp_resources != NULL ? _lgrp_resources(cookie, lgrp, lgrp_array, lgrp_array_size, type) : -1;
}
static int lgrp_nlgrps(lgrp_cookie_t cookie) { return _lgrp_nlgrps != NULL ? _lgrp_nlgrps(cookie) : -1; }
}
}
enum {
clear_interrupted = true
};
static JavaThread* setup_interruptible();
// perf counter incrementers used by _INTERRUPTIBLE
static void bump_interrupted_before_count();
static void bump_interrupted_during_count();
#ifdef ASSERT
static JavaThread* setup_interruptible_native();
#endif
static sigset_t* unblocked_signals();
static sigset_t* vm_signals();
static sigset_t* allowdebug_blocked_signals();
// %%% Following should be promoted to os.hpp:
// Trace number of created threads
// Minimum stack size a thread can be created with (allowing
// the VM to completely create the thread and enter user code)
// Stack overflow handling
static int max_register_window_saves_before_flushing();
// Stack repair handling
// none present
};
private:
volatile int _Event ;
int _nParked ;
protected:
// Defining a protected ctor effectively gives us an abstract base class.
// That is, a PlatformEvent can never be instantiated "naked" but only
// as a part of a ParkEvent (recall that ParkEvent extends PlatformEvent).
// TODO-FIXME: make dtor private
PlatformEvent() {
int status;
_Event = 0 ;
_nParked = 0 ;
}
public:
// Exercise caution using reset() and fired() -- they may require MEMBARs
void park () ;
int TryPark () ;
void unpark () ;
} ;
protected:
public: // TODO-FIXME: make dtor private
public:
PlatformParker() {
int status;
}
} ;
#endif // OS_SOLARIS_VM_OS_SOLARIS_HPP