< prev index next >

src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp

Print this page


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


 493 //    |                        |/
 494 // P2 +------------------------+ Thread::stack_base()
 495 //
 496 // Non-Java thread:
 497 //
 498 //   Low memory addresses
 499 //    +------------------------+
 500 //    |                        |\
 501 //    |  glibc guard page      | - usually 1 page
 502 //    |                        |/
 503 // P1 +------------------------+ Thread::stack_base() - Thread::stack_size()
 504 //    |                        |\
 505 //    |      Normal Stack      | -
 506 //    |                        |/
 507 // P2 +------------------------+ Thread::stack_base()
 508 //
 509 // ** P1 (aka bottom) and size ( P2 = P1 - size) are the address and stack size returned from
 510 //    pthread_attr_getstack()
 511 
 512 static void current_stack_region(address * bottom, size_t * size) {
 513   if (os::Linux::is_initial_thread()) {
 514      // initial thread needs special handling because pthread_getattr_np()
 515      // may return bogus value.
 516     *bottom = os::Linux::initial_thread_stack_bottom();
 517     *size   = os::Linux::initial_thread_stack_size();
 518   } else {
 519     pthread_attr_t attr;
 520 
 521     int rslt = pthread_getattr_np(pthread_self(), &attr);
 522 
 523     // JVM needs to know exact stack location, abort if it fails
 524     if (rslt != 0) {
 525       if (rslt == ENOMEM) {
 526         vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
 527       } else {
 528         fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt));
 529       }
 530     }
 531 
 532     if (pthread_attr_getstack(&attr, (void **)bottom, size) != 0) {
 533       fatal("Can not locate current stack attributes!");


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


 493 //    |                        |/
 494 // P2 +------------------------+ Thread::stack_base()
 495 //
 496 // Non-Java thread:
 497 //
 498 //   Low memory addresses
 499 //    +------------------------+
 500 //    |                        |\
 501 //    |  glibc guard page      | - usually 1 page
 502 //    |                        |/
 503 // P1 +------------------------+ Thread::stack_base() - Thread::stack_size()
 504 //    |                        |\
 505 //    |      Normal Stack      | -
 506 //    |                        |/
 507 // P2 +------------------------+ Thread::stack_base()
 508 //
 509 // ** P1 (aka bottom) and size ( P2 = P1 - size) are the address and stack size returned from
 510 //    pthread_attr_getstack()
 511 
 512 static void current_stack_region(address * bottom, size_t * size) {
 513   if (os::is_primordial_thread()) {
 514      // initial thread needs special handling because pthread_getattr_np()
 515      // may return bogus value.
 516     *bottom = os::Linux::initial_thread_stack_bottom();
 517     *size   = os::Linux::initial_thread_stack_size();
 518   } else {
 519     pthread_attr_t attr;
 520 
 521     int rslt = pthread_getattr_np(pthread_self(), &attr);
 522 
 523     // JVM needs to know exact stack location, abort if it fails
 524     if (rslt != 0) {
 525       if (rslt == ENOMEM) {
 526         vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
 527       } else {
 528         fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt));
 529       }
 530     }
 531 
 532     if (pthread_attr_getstack(&attr, (void **)bottom, size) != 0) {
 533       fatal("Can not locate current stack attributes!");


< prev index next >