< prev index next >

src/os_cpu/linux_aarch64/vm/assembler_linux_aarch64.cpp

Print this page


   1 /*
   2  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2014, Red Hat Inc. 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.
  23  *
  24  */
  25 
  26 #include "precompiled.hpp"
  27 #include "asm/macroAssembler.hpp"
  28 #include "asm/macroAssembler.inline.hpp"
  29 #include "runtime/os.hpp"
  30 #include "runtime/threadLocalStorage.hpp"
  31 
  32 
  33 // get_thread can be called anywhere inside generated code so we need
  34 // to save whatever non-callee save context might get clobbered by the
  35 // call to the C thread_local lookup call or, indeed, the call setup
  36 // code. x86 appears to save C arg registers.
  37 
  38 void MacroAssembler::get_thread(Register dst) {
  39   // call pthread_getspecific
  40   // void * pthread_getspecific(pthread_key_t key);
  41 
  42   // Save all call-clobbered regs except dst, plus r19 and r20.
  43   RegSet saved_regs = RegSet::range(r0, r20) + lr - dst;
  44   push(saved_regs, sp);
  45   mov(c_rarg0, ThreadLocalStorage::thread_index());
  46   mov(r19, CAST_FROM_FN_PTR(address, pthread_getspecific));
  47   blrt(r19, 1, 0, 1);
  48   if (dst != c_rarg0) {
  49     mov(dst, c_rarg0);
  50   }
  51   // restore pushed registers
  52   pop(saved_regs, sp);
  53 }
  54 
   1 /*
   2  * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2014, Red Hat Inc. 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.
  23  *
  24  */
  25 
  26 // nothing required here




  27 






















  28 
< prev index next >