< prev index next >

src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp

Print this page


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


 145 }
 146 
 147 frame os::current_frame() {
 148   intptr_t* sp = StubRoutines::Sparc::flush_callers_register_windows_func()();
 149   frame myframe(sp, frame::unpatchable,
 150                 CAST_FROM_FN_PTR(address, os::current_frame));
 151   if (os::is_first_C_frame(&myframe)) {
 152     // stack is not walkable
 153     return frame(NULL, frame::unpatchable, NULL);
 154   } else {
 155     return os::get_sender_for_C_frame(&myframe);
 156   }
 157 }
 158 
 159 address os::current_stack_pointer() {
 160   register void *sp __asm__ ("sp");
 161   return (address)sp;
 162 }
 163 
 164 static void current_stack_region(address* bottom, size_t* size) {
 165   if (os::Linux::is_initial_thread()) {
 166     // initial thread needs special handling because pthread_getattr_np()
 167     // may return bogus value.
 168     *bottom = os::Linux::initial_thread_stack_bottom();
 169     *size = os::Linux::initial_thread_stack_size();
 170   } else {
 171     pthread_attr_t attr;
 172 
 173     int rslt = pthread_getattr_np(pthread_self(), &attr);
 174 
 175     // JVM needs to know exact stack location, abort if it fails
 176     if (rslt != 0) {
 177       if (rslt == ENOMEM) {
 178         vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
 179       } else {
 180         fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt));
 181       }
 182     }
 183 
 184     if (pthread_attr_getstack(&attr, (void**)bottom, size) != 0) {
 185       fatal("Can not locate current stack attributes!");


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


 145 }
 146 
 147 frame os::current_frame() {
 148   intptr_t* sp = StubRoutines::Sparc::flush_callers_register_windows_func()();
 149   frame myframe(sp, frame::unpatchable,
 150                 CAST_FROM_FN_PTR(address, os::current_frame));
 151   if (os::is_first_C_frame(&myframe)) {
 152     // stack is not walkable
 153     return frame(NULL, frame::unpatchable, NULL);
 154   } else {
 155     return os::get_sender_for_C_frame(&myframe);
 156   }
 157 }
 158 
 159 address os::current_stack_pointer() {
 160   register void *sp __asm__ ("sp");
 161   return (address)sp;
 162 }
 163 
 164 static void current_stack_region(address* bottom, size_t* size) {
 165   if (os::is_primordial_thread()) {
 166     // initial thread needs special handling because pthread_getattr_np()
 167     // may return bogus value.
 168     *bottom = os::Linux::initial_thread_stack_bottom();
 169     *size = os::Linux::initial_thread_stack_size();
 170   } else {
 171     pthread_attr_t attr;
 172 
 173     int rslt = pthread_getattr_np(pthread_self(), &attr);
 174 
 175     // JVM needs to know exact stack location, abort if it fails
 176     if (rslt != 0) {
 177       if (rslt == ENOMEM) {
 178         vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
 179       } else {
 180         fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt));
 181       }
 182     }
 183 
 184     if (pthread_attr_getstack(&attr, (void**)bottom, size) != 0) {
 185       fatal("Can not locate current stack attributes!");


< prev index next >