hotspot/src/os_cpu/windows_x86/vm/assembler_windows_x86.cpp
changeset 34633 2a6c7c7b30a7
parent 14837 a75c3082d106
child 36301 cb578d8c6cba
equal deleted inserted replaced
34632:bf3518bba285 34633:2a6c7c7b30a7
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
    26 #include "asm/macroAssembler.hpp"
    26 #include "asm/macroAssembler.hpp"
    27 #include "asm/macroAssembler.inline.hpp"
    27 #include "asm/macroAssembler.inline.hpp"
    28 #include "runtime/os.hpp"
    28 #include "runtime/os.hpp"
    29 #include "runtime/threadLocalStorage.hpp"
       
    30 
       
    31 
    29 
    32 void MacroAssembler::int3() {
    30 void MacroAssembler::int3() {
    33   emit_int8((unsigned char)0xCC);
    31   emit_int8((unsigned char)0xCC);
    34 }
    32 }
    35 
    33 
    56   // can't use ExternalAddress because it can't take NULL
    54   // can't use ExternalAddress because it can't take NULL
    57   AddressLiteral null(0, relocInfo::none);
    55   AddressLiteral null(0, relocInfo::none);
    58 
    56 
    59   prefix(FS_segment);
    57   prefix(FS_segment);
    60   movptr(thread, null);
    58   movptr(thread, null);
    61   assert(ThreadLocalStorage::get_thread_ptr_offset() != 0,
    59   assert(os::win32::get_thread_ptr_offset() != 0,
    62          "Thread Pointer Offset has not been initialized");
    60          "Thread Pointer Offset has not been initialized");
    63   movl(thread, Address(thread, ThreadLocalStorage::get_thread_ptr_offset()));
    61   movl(thread, Address(thread, os::win32::get_thread_ptr_offset()));
    64 }
    62 }
    65 #else
       
    66 // call (Thread*)TlsGetValue(thread_index());
       
    67 void MacroAssembler::get_thread(Register thread) {
       
    68    if (thread != rax) {
       
    69      push(rax);
       
    70    }
       
    71    push(rdi);
       
    72    push(rsi);
       
    73    push(rdx);
       
    74    push(rcx);
       
    75    push(r8);
       
    76    push(r9);
       
    77    push(r10);
       
    78    // XXX
       
    79    mov(r10, rsp);
       
    80    andq(rsp, -16);
       
    81    push(r10);
       
    82    push(r11);
       
    83 
    63 
    84    movl(c_rarg0, ThreadLocalStorage::thread_index());
    64 // #else - use shared x86 implementation in cpu/x86/vm/macroAssembler_x86.cpp
    85    call(RuntimeAddress((address)TlsGetValue));
       
    86 
    65 
    87    pop(r11);
       
    88    pop(rsp);
       
    89    pop(r10);
       
    90    pop(r9);
       
    91    pop(r8);
       
    92    pop(rcx);
       
    93    pop(rdx);
       
    94    pop(rsi);
       
    95    pop(rdi);
       
    96    if (thread != rax) {
       
    97        mov(thread, rax);
       
    98        pop(rax);
       
    99    }
       
   100 }
       
   101 #endif
    66 #endif