src/os_cpu/linux_x86/vm/assembler_linux_x86.cpp

Thu, 22 Apr 2010 13:23:15 -0700

author
jcoomes
date
Thu, 22 Apr 2010 13:23:15 -0700
changeset 1845
f03d0a26bf83
parent 739
dc7f315e41f7
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6888954: argument formatting for assert() and friends
Reviewed-by: kvn, twisti, apetrusenko, never, dcubed

     1 /*
     2  * Copyright 1999-2008 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
    21  * have any questions.
    22  *
    23  */
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_assembler_linux_x86.cpp.incl"
    28 #ifndef _LP64
    29 void MacroAssembler::int3() {
    30   call(RuntimeAddress(CAST_FROM_FN_PTR(address, os::breakpoint)));
    31 }
    33 void MacroAssembler::get_thread(Register thread) {
    34   movl(thread, rsp);
    35   shrl(thread, PAGE_SHIFT);
    37   ExternalAddress tls_base((address)ThreadLocalStorage::sp_map_addr());
    38   Address index(noreg, thread, Address::times_4);
    39   ArrayAddress tls(tls_base, index);
    41   movptr(thread, tls);
    42 }
    43 #else
    44 void MacroAssembler::int3() {
    45   call(RuntimeAddress(CAST_FROM_FN_PTR(address, os::breakpoint)));
    46 }
    48 void MacroAssembler::get_thread(Register thread) {
    49   // call pthread_getspecific
    50   // void * pthread_getspecific(pthread_key_t key);
    51    if (thread != rax) {
    52      push(rax);
    53    }
    54    push(rdi);
    55    push(rsi);
    56    push(rdx);
    57    push(rcx);
    58    push(r8);
    59    push(r9);
    60    push(r10);
    61    // XXX
    62    mov(r10, rsp);
    63    andq(rsp, -16);
    64    push(r10);
    65    push(r11);
    67    movl(rdi, ThreadLocalStorage::thread_index());
    68    call(RuntimeAddress(CAST_FROM_FN_PTR(address, pthread_getspecific)));
    70    pop(r11);
    71    pop(rsp);
    72    pop(r10);
    73    pop(r9);
    74    pop(r8);
    75    pop(rcx);
    76    pop(rdx);
    77    pop(rsi);
    78    pop(rdi);
    79    if (thread != rax) {
    80        mov(thread, rax);
    81        pop(rax);
    82    }
    83 }
    84 #endif

mercurial