hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp
author mikael
Tue, 09 Oct 2012 10:09:34 -0700
changeset 13963 e5b53c306fb5
parent 13932 b8d718f01df4
child 14631 526804361522
child 14583 d70ee55535f4
permissions -rw-r--r--
7197424: update copyright year to match last edit in jdk8 hotspot repository Summary: Update copyright year to 2012 for relevant files Reviewed-by: dholmes, coleenp
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
13963
e5b53c306fb5 7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents: 13932
diff changeset
     2
 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3261
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3261
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3261
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    25
// no precompiled headers
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    26
#include "assembler_sparc.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    27
#include "classfile/classLoader.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    28
#include "classfile/systemDictionary.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    29
#include "classfile/vmSymbols.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    30
#include "code/icBuffer.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    31
#include "code/vtableStubs.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    32
#include "interpreter/interpreter.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    33
#include "jvm_solaris.h"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    34
#include "memory/allocation.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    35
#include "mutex_solaris.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    36
#include "nativeInst_sparc.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    37
#include "os_share_solaris.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    38
#include "prims/jniFastGetField.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    39
#include "prims/jvm.h"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    40
#include "prims/jvm_misc.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    41
#include "runtime/arguments.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    42
#include "runtime/extendedPC.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    43
#include "runtime/frame.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    44
#include "runtime/interfaceSupport.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    45
#include "runtime/java.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    46
#include "runtime/javaCalls.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    47
#include "runtime/mutexLocker.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    48
#include "runtime/osThread.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    49
#include "runtime/sharedRuntime.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    50
#include "runtime/stubRoutines.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    51
#include "runtime/timer.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    52
#include "thread_solaris.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    53
#include "utilities/events.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7108
diff changeset
    54
#include "utilities/vmError.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
# include <signal.h>        // needed first to avoid name collision for "std" with SC 5.0
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
// put OS-includes here
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
# include <sys/types.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
# include <sys/mman.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
# include <pthread.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
# include <errno.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
# include <dlfcn.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
# include <stdio.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
# include <unistd.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
# include <sys/resource.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
# include <thread.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
# include <sys/stat.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
# include <sys/time.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
# include <sys/filio.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
# include <sys/utsname.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
# include <sys/systeminfo.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
# include <sys/socket.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
# include <sys/lwp.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
# include <pwd.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
# include <poll.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
# include <sys/lwp.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
# define _STRUCTURED_PROC 1  //  this gets us the new structured proc interfaces of 5.6 & later
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
# include <sys/procfs.h>     //  see comment in <sys/procfs.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
#define MAX_PATH (2 * K)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
// Minimum stack size for the VM.  It's easier to document a constant
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
// but it's different for x86 and sparc because the page sizes are different.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
#ifdef _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
size_t os::Solaris::min_stack_allowed = 128*K;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
size_t os::Solaris::min_stack_allowed = 96*K;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
int os::Solaris::max_register_window_saves_before_flushing() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  // We should detect this at run time. For now, filling
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  // in with a constant.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  return 8;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
static void handle_unflushed_register_windows(gwindows_t *win) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  int restore_count = win->wbcnt;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  int i;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  for(i=0; i<restore_count; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    address sp = ((address)win->spbuf[i]) + STACK_BIAS;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    address reg_win = (address)&win->wbuf[i];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    memcpy(sp,reg_win,sizeof(struct rwindow));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
char* os::non_memory_address_word() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  // Must never look like an address returned by reserve_memory,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  // even in its subfields (as defined by the CPU immediate fields,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  // if the CPU splits constants across multiple instructions).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  // On SPARC, 0 != %hi(any real address), because there is no
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  // allocation in the first 1Kb of the virtual address space.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  return (char*) 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
// Validate a ucontext retrieved from walking a uc_link of a ucontext.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
// There are issues with libthread giving out uc_links for different threads
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
// on the same uc_link chain and bad or circular links.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
bool os::Solaris::valid_ucontext(Thread* thread, ucontext_t* valid, ucontext_t* suspect) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  if (valid >= suspect ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
      valid->uc_stack.ss_flags != suspect->uc_stack.ss_flags ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
      valid->uc_stack.ss_sp    != suspect->uc_stack.ss_sp    ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
      valid->uc_stack.ss_size  != suspect->uc_stack.ss_size) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    DEBUG_ONLY(tty->print_cr("valid_ucontext: failed test 1");)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  if (thread->is_Java_thread()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
    if (!valid_stack_address(thread, (address)suspect)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
      DEBUG_ONLY(tty->print_cr("valid_ucontext: uc_link not in thread stack");)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
      return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    address _sp   = (address)((intptr_t)suspect->uc_mcontext.gregs[REG_SP] + STACK_BIAS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
    if (!valid_stack_address(thread, _sp) ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
        !frame::is_valid_stack_pointer(((JavaThread*)thread)->base_of_stack_pointer(), (intptr_t*)_sp)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
      DEBUG_ONLY(tty->print_cr("valid_ucontext: stackpointer not in thread stack");)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
      return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
// We will only follow one level of uc_link since there are libthread
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
// issues with ucontext linking and it is better to be safe and just
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
// let caller retry later.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
ucontext_t* os::Solaris::get_valid_uc_in_signal_handler(Thread *thread,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  ucontext_t *uc) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  ucontext_t *retuc = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  // Sometimes the topmost register windows are not properly flushed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  // i.e., if the kernel would have needed to take a page fault
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  if (uc != NULL && uc->uc_mcontext.gwins != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
    ::handle_unflushed_register_windows(uc->uc_mcontext.gwins);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  if (uc != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
    if (uc->uc_link == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
      // cannot validate without uc_link so accept current ucontext
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
      retuc = uc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
    } else if (os::Solaris::valid_ucontext(thread, uc, uc->uc_link)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
      // first ucontext is valid so try the next one
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
      uc = uc->uc_link;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
      if (uc->uc_link == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
        // cannot validate without uc_link so accept current ucontext
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
        retuc = uc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
      } else if (os::Solaris::valid_ucontext(thread, uc, uc->uc_link)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
        // the ucontext one level down is also valid so return it
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
        retuc = uc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  return retuc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
// Assumes ucontext is valid
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
ExtendedPC os::Solaris::ucontext_get_ExtendedPC(ucontext_t *uc) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  address pc = (address)uc->uc_mcontext.gregs[REG_PC];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  // set npc to zero to avoid using it for safepoint, good for profiling only
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  return ExtendedPC(pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
// Assumes ucontext is valid
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
intptr_t* os::Solaris::ucontext_get_sp(ucontext_t *uc) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  return (intptr_t*)((intptr_t)uc->uc_mcontext.gregs[REG_SP] + STACK_BIAS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
// Solaris X86 only
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
intptr_t* os::Solaris::ucontext_get_fp(ucontext_t *uc) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
// For Forte Analyzer AsyncGetCallTrace profiling support - thread
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
// is currently interrupted by SIGPROF.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
// ret_fp parameter is only used by Solaris X86.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
// The difference between this and os::fetch_frame_from_context() is that
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
// here we try to skip nested signal frames.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
ExtendedPC os::Solaris::fetch_frame_from_ucontext(Thread* thread,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  assert(thread != NULL, "just checking");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  assert(ret_sp != NULL, "just checking");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  assert(ret_fp == NULL, "just checking");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  ucontext_t *luc = os::Solaris::get_valid_uc_in_signal_handler(thread, uc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  return os::fetch_frame_from_context(luc, ret_sp, ret_fp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
// ret_fp parameter is only used by Solaris X86.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
ExtendedPC os::fetch_frame_from_context(void* ucVoid,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
                    intptr_t** ret_sp, intptr_t** ret_fp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  ExtendedPC  epc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  ucontext_t *uc = (ucontext_t*)ucVoid;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  if (uc != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
    epc = os::Solaris::ucontext_get_ExtendedPC(uc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
    if (ret_sp) *ret_sp = os::Solaris::ucontext_get_sp(uc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
    // construct empty ExtendedPC for return value checking
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
    epc = ExtendedPC(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
    if (ret_sp) *ret_sp = (intptr_t *)NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  return epc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
frame os::fetch_frame_from_context(void* ucVoid) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  intptr_t* sp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  intptr_t* fp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  return frame(sp, frame::unpatchable, epc.pc());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
frame os::get_sender_for_C_frame(frame* fr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  return frame(fr->sender_sp(), frame::unpatchable, fr->sender_pc());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
11961
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 8921
diff changeset
   247
// Returns an estimate of the current stack pointer. Result must be guaranteed to
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 8921
diff changeset
   248
// point into the calling threads stack, and be no lower than the current stack
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 8921
diff changeset
   249
// pointer.
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 8921
diff changeset
   250
address os::current_stack_pointer() {
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 8921
diff changeset
   251
  volatile int dummy;
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 8921
diff changeset
   252
  address sp = (address)&dummy + 8;     // %%%% need to confirm if this is right
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 8921
diff changeset
   253
  return sp;
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 8921
diff changeset
   254
}
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 8921
diff changeset
   255
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
frame os::current_frame() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  intptr_t* sp = StubRoutines::Sparc::flush_callers_register_windows_func()();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  frame myframe(sp, frame::unpatchable,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
                CAST_FROM_FN_PTR(address, os::current_frame));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  if (os::is_first_C_frame(&myframe)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
    // stack is not walkable
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
    return frame(NULL, NULL, NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
    return os::get_sender_for_C_frame(&myframe);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
void GetThreadPC_Callback::execute(OSThread::InterruptArguments *args) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  Thread*     thread = args->thread();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  ucontext_t* uc     = args->ucontext();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  intptr_t* sp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  assert(ProfileVM && thread->is_VM_thread(), "just checking");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
  // Skip the mcontext corruption verification. If if occasionally
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
  // things get corrupt, it is ok for profiling - we will just get an unresolved
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  // function name
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
  ExtendedPC new_addr((address)uc->uc_mcontext.gregs[REG_PC]);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
  _addr = new_addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
static int threadgetstate(thread_t tid, int *flags, lwpid_t *lwp, stack_t *ss, gregset_t rs, lwpstatus_t *lwpstatus) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
  char lwpstatusfile[PROCFILE_LENGTH];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
  int lwpfd, err;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  if (err = os::Solaris::thr_getstate(tid, flags, lwp, ss, rs))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
    return (err);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  if (*flags == TRS_LWPID) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
    sprintf(lwpstatusfile, "/proc/%d/lwp/%d/lwpstatus", getpid(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
            *lwp);
7405
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   293
    if ((lwpfd = ::open(lwpstatusfile, O_RDONLY)) < 0) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
      perror("thr_mutator_status: open lwpstatus");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
      return (EINVAL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
    if (pread(lwpfd, lwpstatus, sizeof (lwpstatus_t), (off_t)0) !=
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
        sizeof (lwpstatus_t)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
      perror("thr_mutator_status: read lwpstatus");
7405
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   300
      (void) ::close(lwpfd);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
      return (EINVAL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
    }
7405
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   303
    (void) ::close(lwpfd);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
  return (0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
bool os::is_allocatable(size_t bytes) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
#ifdef _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
   return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
   return (bytes <= (size_t)3835*M);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
extern "C" void Fetch32PFI () ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
extern "C" void Fetch32Resume () ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
extern "C" void FetchNPFI () ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
extern "C" void FetchNResume () ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
8106
19106a0203fb 6588413: Use -fvisibility=hidden for gcc compiles
coleenp
parents: 7719
diff changeset
   322
extern "C" JNIEXPORT int
19106a0203fb 6588413: Use -fvisibility=hidden for gcc compiles
coleenp
parents: 7719
diff changeset
   323
JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
19106a0203fb 6588413: Use -fvisibility=hidden for gcc compiles
coleenp
parents: 7719
diff changeset
   324
                          int abort_if_unrecognized) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  ucontext_t* uc = (ucontext_t*) ucVoid;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
  Thread* t = ThreadLocalStorage::get_thread_slow();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
  SignalHandlerMark shm(t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
  if(sig == SIGPIPE || sig == SIGXFSZ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
    if (os::Solaris::chained_handler(sig, info, ucVoid)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
      return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
      if (PrintMiscellaneous && (WizardMode || Verbose)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
        char buf[64];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
        warning("Ignoring %s - see 4229104 or 6499219",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
                os::exception_name(sig, buf, sizeof(buf)));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
      return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
  JavaThread* thread = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
  VMThread* vmthread = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
  if (os::Solaris::signal_handlers_are_installed) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
    if (t != NULL ){
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
      if(t->is_Java_thread()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
        thread = (JavaThread*)t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
      else if(t->is_VM_thread()){
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
        vmthread = (VMThread *)t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
  guarantee(sig != os::Solaris::SIGinterrupt(), "Can not chain VM interrupt signal, try -XX:+UseAltSigs");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
  if (sig == os::Solaris::SIGasync()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
    if (thread) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
      OSThread::InterruptArguments args(thread, uc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
      thread->osthread()->do_interrupt_callbacks_at_interrupt(&args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
      return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
    } else if (vmthread) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
      OSThread::InterruptArguments args(vmthread, uc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
      vmthread->osthread()->do_interrupt_callbacks_at_interrupt(&args);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
      return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
    } else if (os::Solaris::chained_handler(sig, info, ucVoid)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
      return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
      // If os::Solaris::SIGasync not chained, and this is a non-vm and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
      // non-java thread
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
      return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
  if (info == NULL || info->si_code <= 0 || info->si_code == SI_NOINFO) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
    // can't decode this kind of signal
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
    info = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
    assert(sig == info->si_signo, "bad siginfo");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
  // decide if this trap can be handled by a stub
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
  address stub = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
  address pc          = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
  address npc         = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
  //%note os_trap_1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
  if (info != NULL && uc != NULL && thread != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
    // factor me: getPCfromContext
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
    pc  = (address) uc->uc_mcontext.gregs[REG_PC];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
    npc = (address) uc->uc_mcontext.gregs[REG_nPC];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
    // SafeFetch() support
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
    // Implemented with either a fixed set of addresses such
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
    // as Fetch32*, or with Thread._OnTrap.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
    if (uc->uc_mcontext.gregs[REG_PC] == intptr_t(Fetch32PFI)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
      uc->uc_mcontext.gregs [REG_PC]  = intptr_t(Fetch32Resume) ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
      uc->uc_mcontext.gregs [REG_nPC] = intptr_t(Fetch32Resume) + 4 ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
      return true ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
    if (uc->uc_mcontext.gregs[REG_PC] == intptr_t(FetchNPFI)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
      uc->uc_mcontext.gregs [REG_PC]  = intptr_t(FetchNResume) ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
      uc->uc_mcontext.gregs [REG_nPC] = intptr_t(FetchNResume) + 4 ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
      return true ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
    // Handle ALL stack overflow variations here
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
    if (sig == SIGSEGV && info->si_code == SEGV_ACCERR) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
      address addr = (address) info->si_addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
      if (thread->in_stack_yellow_zone(addr)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
        thread->disable_stack_yellow_zone();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
        // Sometimes the register windows are not properly flushed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
        if(uc->uc_mcontext.gwins != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
          ::handle_unflushed_register_windows(uc->uc_mcontext.gwins);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
        if (thread->thread_state() == _thread_in_Java) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
          // Throw a stack overflow exception.  Guard pages will be reenabled
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
          // while unwinding the stack.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
          stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
          // Thread was in the vm or native code.  Return and try to finish.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
          return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
      } else if (thread->in_stack_red_zone(addr)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
        // Fatal red zone violation.  Disable the guard pages and fall through
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
        // to handle_unexpected_exception way down below.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
        thread->disable_stack_red_zone();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
        tty->print_raw_cr("An irrecoverable stack overflow has occurred.");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
        // Sometimes the register windows are not properly flushed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
        if(uc->uc_mcontext.gwins != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
          ::handle_unflushed_register_windows(uc->uc_mcontext.gwins);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
    if (thread->thread_state() == _thread_in_vm) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
      if (sig == SIGBUS && info->si_code == BUS_OBJERR && thread->doing_unsafe_access()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
        stub = StubRoutines::handler_for_unsafe_access();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
    else if (thread->thread_state() == _thread_in_Java) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
      // Java thread running in Java code => find exception handler if any
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
      // a fault inside compiled code, the interpreter, or a stub
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
      // Support Safepoint Polling
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
      if ( sig == SIGSEGV && (address)info->si_addr == os::get_polling_page() ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
        stub = SharedRuntime::get_poll_stub(pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
      // Not needed on x86 solaris because verify_oops doesn't generate
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
      // SEGV/BUS like sparc does.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
      if ( (sig == SIGSEGV || sig == SIGBUS)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
           && pc >= MacroAssembler::_verify_oop_implicit_branch[0]
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
           && pc <  MacroAssembler::_verify_oop_implicit_branch[1] ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
        stub     =  MacroAssembler::_verify_oop_implicit_branch[2];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
        warning("fixed up memory fault in +VerifyOops at address " INTPTR_FORMAT, info->si_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
      // This is not factored because on x86 solaris the patching for
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
      // zombies does not generate a SEGV.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
      else if (sig == SIGSEGV && nativeInstruction_at(pc)->is_zombie()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
        // zombie method (ld [%g0],%o7 instruction)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
        stub = SharedRuntime::get_handle_wrong_method_stub();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
        // At the stub it needs to look like a call from the caller of this
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
        // method (not a call from the segv site).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
        pc = (address)uc->uc_mcontext.gregs[REG_O7];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
      else if (sig == SIGBUS && info->si_code == BUS_OBJERR) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
        // BugId 4454115: A read from a MappedByteBuffer can fault
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
        // here if the underlying file has been truncated.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
        // Do not crash the VM in such a case.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
        CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
        nmethod* nm = cb->is_nmethod() ? (nmethod*)cb : NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
        if (nm != NULL && nm->has_unsafe_access()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
          stub = StubRoutines::handler_for_unsafe_access();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
      else if (sig == SIGFPE && info->si_code == FPE_INTDIV) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
        // integer divide by zero
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
        stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_DIVIDE_BY_ZERO);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
      else if (sig == SIGFPE && info->si_code == FPE_FLTDIV) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
        // floating-point divide by zero
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
        stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_DIVIDE_BY_ZERO);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
#ifdef COMPILER2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
      else if (sig == SIGILL && nativeInstruction_at(pc)->is_ic_miss_trap()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
  #ifdef TIERED
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
        CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
        assert(cb->is_compiled_by_c2(), "Wrong compiler");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
  #endif // TIERED
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
#endif // ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
        // Inline cache missed and user trap "Tne G0+ST_RESERVED_FOR_USER_0+2" taken.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
        stub = SharedRuntime::get_ic_miss_stub();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
        // At the stub it needs to look like a call from the caller of this
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
        // method (not a call from the segv site).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
        pc = (address)uc->uc_mcontext.gregs[REG_O7];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
#endif  // COMPILER2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
      else if (sig == SIGSEGV && info->si_code > 0 && !MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
        // Determination of interpreter/vtable stub/compiled code null exception
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
        stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
    // jni_fast_Get<Primitive>Field can trap at certain pc's if a GC kicks in
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
    // and the heap gets shrunk before the field access.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
    if ((sig == SIGSEGV) || (sig == SIGBUS)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
      address addr = JNI_FastGetField::find_slowcase_pc(pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
      if (addr != (address)-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
        stub = addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
    // Check to see if we caught the safepoint code in the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
    // process of write protecting the memory serialization page.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
    // It write enables the page immediately after protecting it
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
    // so just return.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
    if ((sig == SIGSEGV) &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
        os::is_memory_serialize_page(thread, (address)info->si_addr)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
      // Block current thread until the memory serialize page permission restored.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
      os::block_on_serialize_page_trap();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
      return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
  if (stub != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
    // save all thread context in case we need to restore it
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
    thread->set_saved_exception_pc(pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   541
    thread->set_saved_exception_npc(npc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   542
489c9b5090e2 Initial load
duke
parents:
diff changeset
   543
    // simulate a branch to the stub (a "call" in the safepoint stub case)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   544
    // factor me: setPC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
    uc->uc_mcontext.gregs[REG_PC ] = (greg_t)stub;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   546
    uc->uc_mcontext.gregs[REG_nPC] = (greg_t)(stub + 4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   547
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
    if (TraceJumps) thread->record_jump(stub, NULL, __FILE__, __LINE__);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   550
#endif /* PRODUCT */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
489c9b5090e2 Initial load
duke
parents:
diff changeset
   552
    return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   553
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   554
489c9b5090e2 Initial load
duke
parents:
diff changeset
   555
  // signal-chaining
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
  if (os::Solaris::chained_handler(sig, info, ucVoid)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
    return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
  if (!abort_if_unrecognized) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
    // caller wants another chance, so give it to him
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
    return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   563
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
489c9b5090e2 Initial load
duke
parents:
diff changeset
   565
  if (!os::Solaris::libjsig_is_loaded) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
    struct sigaction oldAct;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
    sigaction(sig, (struct sigaction *)0, &oldAct);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
    if (oldAct.sa_sigaction != signalHandler) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
      void* sighand = oldAct.sa_sigaction ? CAST_FROM_FN_PTR(void*, oldAct.sa_sigaction)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
                                          : CAST_FROM_FN_PTR(void*, oldAct.sa_handler);
2131
98f9cef66a34 6810672: Comment typos
twisti
parents: 1
diff changeset
   571
      warning("Unexpected Signal %d occurred under user-defined signal handler " INTPTR_FORMAT, sig, (intptr_t)sighand);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   572
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
  if (pc == NULL && uc != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
    pc = (address) uc->uc_mcontext.gregs[REG_PC];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
7108
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   579
  // Sometimes the register windows are not properly flushed.
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   580
  if(uc->uc_mcontext.gwins != NULL) {
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   581
    ::handle_unflushed_register_windows(uc->uc_mcontext.gwins);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   582
  }
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   583
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   584
  // unmask current signal
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
  sigset_t newset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
  sigemptyset(&newset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
  sigaddset(&newset, sig);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
  sigprocmask(SIG_UNBLOCK, &newset, NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   589
7719
ef138e2849eb 6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents: 7405
diff changeset
   590
  // Determine which sort of error to throw.  Out of swap may signal
ef138e2849eb 6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents: 7405
diff changeset
   591
  // on the thread stack, which could get a mapping error when touched.
ef138e2849eb 6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents: 7405
diff changeset
   592
  address addr = (address) info->si_addr;
ef138e2849eb 6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents: 7405
diff changeset
   593
  if (sig == SIGBUS && info->si_code == BUS_OBJERR && info->si_errno == ENOMEM) {
ef138e2849eb 6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents: 7405
diff changeset
   594
    vm_exit_out_of_memory(0, "Out of swap space to map in thread stack.");
ef138e2849eb 6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents: 7405
diff changeset
   595
  }
ef138e2849eb 6302804: Hotspot VM dies ungraceful death when C heap is exhausted in various places.
coleenp
parents: 7405
diff changeset
   596
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   597
  VMError err(t, sig, pc, info, ucVoid);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   598
  err.report_and_die();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   599
489c9b5090e2 Initial load
duke
parents:
diff changeset
   600
  ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   601
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   602
489c9b5090e2 Initial load
duke
parents:
diff changeset
   603
void os::print_context(outputStream *st, void *context) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   604
  if (context == NULL) return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   605
489c9b5090e2 Initial load
duke
parents:
diff changeset
   606
  ucontext_t *uc = (ucontext_t*)context;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   607
  st->print_cr("Registers:");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   608
7108
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   609
  st->print_cr(" G1=" INTPTR_FORMAT " G2=" INTPTR_FORMAT
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   610
               " G3=" INTPTR_FORMAT " G4=" INTPTR_FORMAT,
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   611
            uc->uc_mcontext.gregs[REG_G1],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   612
            uc->uc_mcontext.gregs[REG_G2],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   613
            uc->uc_mcontext.gregs[REG_G3],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   614
            uc->uc_mcontext.gregs[REG_G4]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   615
  st->print_cr(" G5=" INTPTR_FORMAT " G6=" INTPTR_FORMAT
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   616
               " G7=" INTPTR_FORMAT " Y=" INTPTR_FORMAT,
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   617
            uc->uc_mcontext.gregs[REG_G5],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   618
            uc->uc_mcontext.gregs[REG_G6],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   619
            uc->uc_mcontext.gregs[REG_G7],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   620
            uc->uc_mcontext.gregs[REG_Y]);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
  st->print_cr(" O0=" INTPTR_FORMAT " O1=" INTPTR_FORMAT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
               " O2=" INTPTR_FORMAT " O3=" INTPTR_FORMAT,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
                 uc->uc_mcontext.gregs[REG_O0],
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
                 uc->uc_mcontext.gregs[REG_O1],
489c9b5090e2 Initial load
duke
parents:
diff changeset
   625
                 uc->uc_mcontext.gregs[REG_O2],
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
                 uc->uc_mcontext.gregs[REG_O3]);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
  st->print_cr(" O4=" INTPTR_FORMAT " O5=" INTPTR_FORMAT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
               " O6=" INTPTR_FORMAT " O7=" INTPTR_FORMAT,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
            uc->uc_mcontext.gregs[REG_O4],
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
            uc->uc_mcontext.gregs[REG_O5],
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
            uc->uc_mcontext.gregs[REG_O6],
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
            uc->uc_mcontext.gregs[REG_O7]);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
7108
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   634
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   635
  intptr_t *sp = (intptr_t *)os::Solaris::ucontext_get_sp(uc);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   636
  st->print_cr(" L0=" INTPTR_FORMAT " L1=" INTPTR_FORMAT
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   637
               " L2=" INTPTR_FORMAT " L3=" INTPTR_FORMAT,
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   638
               sp[L0->sp_offset_in_saved_window()],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   639
               sp[L1->sp_offset_in_saved_window()],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   640
               sp[L2->sp_offset_in_saved_window()],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   641
               sp[L3->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   642
  st->print_cr(" L4=" INTPTR_FORMAT " L5=" INTPTR_FORMAT
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   643
               " L6=" INTPTR_FORMAT " L7=" INTPTR_FORMAT,
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   644
               sp[L4->sp_offset_in_saved_window()],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   645
               sp[L5->sp_offset_in_saved_window()],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   646
               sp[L6->sp_offset_in_saved_window()],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   647
               sp[L7->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   648
  st->print_cr(" I0=" INTPTR_FORMAT " I1=" INTPTR_FORMAT
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   649
               " I2=" INTPTR_FORMAT " I3=" INTPTR_FORMAT,
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   650
               sp[I0->sp_offset_in_saved_window()],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   651
               sp[I1->sp_offset_in_saved_window()],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   652
               sp[I2->sp_offset_in_saved_window()],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   653
               sp[I3->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   654
  st->print_cr(" I4=" INTPTR_FORMAT " I5=" INTPTR_FORMAT
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   655
               " I6=" INTPTR_FORMAT " I7=" INTPTR_FORMAT,
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   656
               sp[I4->sp_offset_in_saved_window()],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   657
               sp[I5->sp_offset_in_saved_window()],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   658
               sp[I6->sp_offset_in_saved_window()],
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   659
               sp[I7->sp_offset_in_saved_window()]);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   660
489c9b5090e2 Initial load
duke
parents:
diff changeset
   661
  st->print_cr(" PC=" INTPTR_FORMAT " nPC=" INTPTR_FORMAT,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   662
            uc->uc_mcontext.gregs[REG_PC],
489c9b5090e2 Initial load
duke
parents:
diff changeset
   663
            uc->uc_mcontext.gregs[REG_nPC]);
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   664
  st->cr();
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   665
  st->cr();
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
   666
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   667
  st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   668
  print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   669
  st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   670
489c9b5090e2 Initial load
duke
parents:
diff changeset
   671
  // Note: it may be unsafe to inspect memory near pc. For example, pc may
489c9b5090e2 Initial load
duke
parents:
diff changeset
   672
  // point to garbage if entry point in an nmethod is corrupted. Leave
489c9b5090e2 Initial load
duke
parents:
diff changeset
   673
  // this at the end, and hope for the best.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   674
  ExtendedPC epc = os::Solaris::ucontext_get_ExtendedPC(uc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   675
  address pc = epc.pc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   676
  st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc);
7108
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   677
  print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   678
}
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   679
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   680
void os::print_register_info(outputStream *st, void *context) {
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   681
  if (context == NULL) return;
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   682
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   683
  ucontext_t *uc = (ucontext_t*)context;
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   684
  intptr_t *sp = (intptr_t *)os::Solaris::ucontext_get_sp(uc);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   685
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   686
  st->print_cr("Register to memory mapping:");
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   687
  st->cr();
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   688
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   689
  // this is only for the "general purpose" registers
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   690
  st->print("G1="); print_location(st, uc->uc_mcontext.gregs[REG_G1]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   691
  st->print("G2="); print_location(st, uc->uc_mcontext.gregs[REG_G2]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   692
  st->print("G3="); print_location(st, uc->uc_mcontext.gregs[REG_G3]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   693
  st->print("G4="); print_location(st, uc->uc_mcontext.gregs[REG_G4]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   694
  st->print("G5="); print_location(st, uc->uc_mcontext.gregs[REG_G5]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   695
  st->print("G6="); print_location(st, uc->uc_mcontext.gregs[REG_G6]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   696
  st->print("G7="); print_location(st, uc->uc_mcontext.gregs[REG_G7]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   697
  st->cr();
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   698
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   699
  st->print("O0="); print_location(st, uc->uc_mcontext.gregs[REG_O0]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   700
  st->print("O1="); print_location(st, uc->uc_mcontext.gregs[REG_O1]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   701
  st->print("O2="); print_location(st, uc->uc_mcontext.gregs[REG_O2]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   702
  st->print("O3="); print_location(st, uc->uc_mcontext.gregs[REG_O3]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   703
  st->print("O4="); print_location(st, uc->uc_mcontext.gregs[REG_O4]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   704
  st->print("O5="); print_location(st, uc->uc_mcontext.gregs[REG_O5]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   705
  st->print("O6="); print_location(st, uc->uc_mcontext.gregs[REG_O6]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   706
  st->print("O7="); print_location(st, uc->uc_mcontext.gregs[REG_O7]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   707
  st->cr();
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   708
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   709
  st->print("L0="); print_location(st, sp[L0->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   710
  st->print("L1="); print_location(st, sp[L1->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   711
  st->print("L2="); print_location(st, sp[L2->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   712
  st->print("L3="); print_location(st, sp[L3->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   713
  st->print("L4="); print_location(st, sp[L4->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   714
  st->print("L5="); print_location(st, sp[L5->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   715
  st->print("L6="); print_location(st, sp[L6->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   716
  st->print("L7="); print_location(st, sp[L7->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   717
  st->cr();
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   718
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   719
  st->print("I0="); print_location(st, sp[I0->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   720
  st->print("I1="); print_location(st, sp[I1->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   721
  st->print("I2="); print_location(st, sp[I2->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   722
  st->print("I3="); print_location(st, sp[I3->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   723
  st->print("I4="); print_location(st, sp[I4->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   724
  st->print("I5="); print_location(st, sp[I5->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   725
  st->print("I6="); print_location(st, sp[I6->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   726
  st->print("I7="); print_location(st, sp[I7->sp_offset_in_saved_window()]);
4f87b92f3060 6970683: improvements to hs_err output
never
parents: 6176
diff changeset
   727
  st->cr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   728
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   729
489c9b5090e2 Initial load
duke
parents:
diff changeset
   730
void os::Solaris::init_thread_fpu_state(void) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   731
    // Nothing needed on Sparc.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   732
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   733
489c9b5090e2 Initial load
duke
parents:
diff changeset
   734
#if !defined(COMPILER2) && !defined(_LP64)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   735
489c9b5090e2 Initial load
duke
parents:
diff changeset
   736
// These routines are the initial value of atomic_xchg_entry(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   737
// atomic_cmpxchg_entry(), atomic_add_entry() and fence_entry()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   738
// until initialization is complete.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   739
// TODO - remove when the VM drops support for V8.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   740
489c9b5090e2 Initial load
duke
parents:
diff changeset
   741
typedef jint  xchg_func_t        (jint,  volatile jint*);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   742
typedef jint  cmpxchg_func_t     (jint,  volatile jint*,  jint);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   743
typedef jlong cmpxchg_long_func_t(jlong, volatile jlong*, jlong);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   744
typedef jint  add_func_t         (jint,  volatile jint*);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   745
489c9b5090e2 Initial load
duke
parents:
diff changeset
   746
jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   747
  // try to use the stub:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   748
  xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   749
489c9b5090e2 Initial load
duke
parents:
diff changeset
   750
  if (func != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   751
    os::atomic_xchg_func = func;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   752
    return (*func)(exchange_value, dest);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   753
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   754
  assert(Threads::number_of_threads() == 0, "for bootstrap only");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   755
489c9b5090e2 Initial load
duke
parents:
diff changeset
   756
  jint old_value = *dest;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   757
  *dest = exchange_value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   758
  return old_value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   759
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   760
489c9b5090e2 Initial load
duke
parents:
diff changeset
   761
jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint compare_value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   762
  // try to use the stub:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   763
  cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   764
489c9b5090e2 Initial load
duke
parents:
diff changeset
   765
  if (func != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   766
    os::atomic_cmpxchg_func = func;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   767
    return (*func)(exchange_value, dest, compare_value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   768
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   769
  assert(Threads::number_of_threads() == 0, "for bootstrap only");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   770
489c9b5090e2 Initial load
duke
parents:
diff changeset
   771
  jint old_value = *dest;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   772
  if (old_value == compare_value)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   773
    *dest = exchange_value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   774
  return old_value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   775
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   776
489c9b5090e2 Initial load
duke
parents:
diff changeset
   777
jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* dest, jlong compare_value) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   778
  // try to use the stub:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   779
  cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   780
489c9b5090e2 Initial load
duke
parents:
diff changeset
   781
  if (func != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   782
    os::atomic_cmpxchg_long_func = func;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   783
    return (*func)(exchange_value, dest, compare_value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   784
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   785
  assert(Threads::number_of_threads() == 0, "for bootstrap only");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   786
489c9b5090e2 Initial load
duke
parents:
diff changeset
   787
  jlong old_value = *dest;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   788
  if (old_value == compare_value)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   789
    *dest = exchange_value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   790
  return old_value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   791
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   792
489c9b5090e2 Initial load
duke
parents:
diff changeset
   793
jint os::atomic_add_bootstrap(jint add_value, volatile jint* dest) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   794
  // try to use the stub:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   795
  add_func_t* func = CAST_TO_FN_PTR(add_func_t*, StubRoutines::atomic_add_entry());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   796
489c9b5090e2 Initial load
duke
parents:
diff changeset
   797
  if (func != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   798
    os::atomic_add_func = func;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   799
    return (*func)(add_value, dest);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   800
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   801
  assert(Threads::number_of_threads() == 0, "for bootstrap only");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   802
489c9b5090e2 Initial load
duke
parents:
diff changeset
   803
  return (*dest) += add_value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   804
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   805
489c9b5090e2 Initial load
duke
parents:
diff changeset
   806
xchg_func_t*         os::atomic_xchg_func         = os::atomic_xchg_bootstrap;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   807
cmpxchg_func_t*      os::atomic_cmpxchg_func      = os::atomic_cmpxchg_bootstrap;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   808
cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   809
add_func_t*          os::atomic_add_func          = os::atomic_add_bootstrap;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   810
489c9b5090e2 Initial load
duke
parents:
diff changeset
   811
#endif // !_LP64 && !COMPILER2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   812
489c9b5090e2 Initial load
duke
parents:
diff changeset
   813
#if defined(__sparc) && defined(COMPILER2) && defined(_GNU_SOURCE)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   814
 // See file build/solaris/makefiles/$compiler.make
489c9b5090e2 Initial load
duke
parents:
diff changeset
   815
 // For compiler1 the architecture is v8 and frps isn't present in v8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   816
 extern "C"  void _mark_fpu_nosave() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   817
   __asm__ __volatile__ ("wr %%g0, 0, %%fprs \n\t" : : :);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   818
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   819
#endif //defined(__sparc) && defined(COMPILER2)
11961
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 8921
diff changeset
   820
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 8921
diff changeset
   821
#ifndef PRODUCT
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 8921
diff changeset
   822
void os::verify_stack_alignment() {
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 8921
diff changeset
   823
}
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 8921
diff changeset
   824
#endif