src/cpu/x86/vm/vm_version_x86.cpp

changeset 6537
0118c8c7b80f
parent 6429
606acabe7b5c
child 6656
1eba0601f0dd
     1.1 --- a/src/cpu/x86/vm/vm_version_x86.cpp	Mon Mar 31 23:49:00 2014 -0400
     1.2 +++ b/src/cpu/x86/vm/vm_version_x86.cpp	Mon Mar 31 13:08:03 2014 -0700
     1.3 @@ -59,9 +59,9 @@
     1.4  static const int stub_size = 600;
     1.5  
     1.6  extern "C" {
     1.7 -  typedef void (*getPsrInfo_stub_t)(void*);
     1.8 +  typedef void (*get_cpu_info_stub_t)(void*);
     1.9  }
    1.10 -static getPsrInfo_stub_t getPsrInfo_stub = NULL;
    1.11 +static get_cpu_info_stub_t get_cpu_info_stub = NULL;
    1.12  
    1.13  
    1.14  class VM_Version_StubGenerator: public StubCodeGenerator {
    1.15 @@ -69,7 +69,7 @@
    1.16  
    1.17    VM_Version_StubGenerator(CodeBuffer *c) : StubCodeGenerator(c) {}
    1.18  
    1.19 -  address generate_getPsrInfo() {
    1.20 +  address generate_get_cpu_info() {
    1.21      // Flags to test CPU type.
    1.22      const uint32_t HS_EFL_AC           = 0x40000;
    1.23      const uint32_t HS_EFL_ID           = 0x200000;
    1.24 @@ -81,13 +81,13 @@
    1.25      Label detect_486, cpu486, detect_586, std_cpuid1, std_cpuid4;
    1.26      Label sef_cpuid, ext_cpuid, ext_cpuid1, ext_cpuid5, ext_cpuid7, done;
    1.27  
    1.28 -    StubCodeMark mark(this, "VM_Version", "getPsrInfo_stub");
    1.29 +    StubCodeMark mark(this, "VM_Version", "get_cpu_info_stub");
    1.30  #   define __ _masm->
    1.31  
    1.32      address start = __ pc();
    1.33  
    1.34      //
    1.35 -    // void getPsrInfo(VM_Version::CpuidInfo* cpuid_info);
    1.36 +    // void get_cpu_info(VM_Version::CpuidInfo* cpuid_info);
    1.37      //
    1.38      // LP64: rcx and rdx are first and second argument registers on windows
    1.39  
    1.40 @@ -385,6 +385,14 @@
    1.41  };
    1.42  
    1.43  
    1.44 +void VM_Version::get_cpu_info_wrapper() {
    1.45 +  get_cpu_info_stub(&_cpuid_info);
    1.46 +}
    1.47 +
    1.48 +#ifndef CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED
    1.49 +  #define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) f()
    1.50 +#endif
    1.51 +
    1.52  void VM_Version::get_processor_features() {
    1.53  
    1.54    _cpu = 4; // 486 by default
    1.55 @@ -395,7 +403,11 @@
    1.56  
    1.57    if (!Use486InstrsOnly) {
    1.58      // Get raw processor info
    1.59 -    getPsrInfo_stub(&_cpuid_info);
    1.60 +
    1.61 +    // Some platforms (like Win*) need a wrapper around here
    1.62 +    // in order to properly handle SEGV for YMM registers test.
    1.63 +    CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(get_cpu_info_wrapper);
    1.64 +
    1.65      assert_is_initialized();
    1.66      _cpu = extended_cpu_family();
    1.67      _model = extended_cpu_model();
    1.68 @@ -986,14 +998,14 @@
    1.69    ResourceMark rm;
    1.70    // Making this stub must be FIRST use of assembler
    1.71  
    1.72 -  stub_blob = BufferBlob::create("getPsrInfo_stub", stub_size);
    1.73 +  stub_blob = BufferBlob::create("get_cpu_info_stub", stub_size);
    1.74    if (stub_blob == NULL) {
    1.75 -    vm_exit_during_initialization("Unable to allocate getPsrInfo_stub");
    1.76 +    vm_exit_during_initialization("Unable to allocate get_cpu_info_stub");
    1.77    }
    1.78    CodeBuffer c(stub_blob);
    1.79    VM_Version_StubGenerator g(&c);
    1.80 -  getPsrInfo_stub = CAST_TO_FN_PTR(getPsrInfo_stub_t,
    1.81 -                                   g.generate_getPsrInfo());
    1.82 +  get_cpu_info_stub = CAST_TO_FN_PTR(get_cpu_info_stub_t,
    1.83 +                                     g.generate_get_cpu_info());
    1.84  
    1.85    get_processor_features();
    1.86  }

mercurial