src/cpu/x86/vm/nativeInst_x86.hpp

changeset 2686
b40d4fa697bf
parent 2314
f95d63e2154a
child 3388
127b3692c168
     1.1 --- a/src/cpu/x86/vm/nativeInst_x86.hpp	Sun Mar 27 00:00:14 2011 -0700
     1.2 +++ b/src/cpu/x86/vm/nativeInst_x86.hpp	Sun Mar 27 13:17:37 2011 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -519,7 +519,11 @@
    1.11  class NativeTstRegMem: public NativeInstruction {
    1.12   public:
    1.13    enum Intel_specific_constants {
    1.14 -    instruction_code_memXregl   = 0x85
    1.15 +    instruction_rex_prefix_mask = 0xF0,
    1.16 +    instruction_rex_prefix      = Assembler::REX,
    1.17 +    instruction_code_memXregl   = 0x85,
    1.18 +    modrm_mask                  = 0x38, // select reg from the ModRM byte
    1.19 +    modrm_reg                   = 0x00  // rax
    1.20    };
    1.21  };
    1.22  
    1.23 @@ -533,12 +537,25 @@
    1.24                                                            (ubyte_at(0) & 0xF0) == 0x70;  /* short jump */ }
    1.25  inline bool NativeInstruction::is_safepoint_poll() {
    1.26  #ifdef AMD64
    1.27 -  if ( ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl &&
    1.28 -       ubyte_at(1) == 0x05 ) { // 00 rax 101
    1.29 -     address fault = addr_at(6) + int_at(2);
    1.30 -     return os::is_poll_address(fault);
    1.31 +  if (Assembler::is_polling_page_far()) {
    1.32 +    // two cases, depending on the choice of the base register in the address.
    1.33 +    if (((ubyte_at(0) & NativeTstRegMem::instruction_rex_prefix_mask) == NativeTstRegMem::instruction_rex_prefix &&
    1.34 +         ubyte_at(1) == NativeTstRegMem::instruction_code_memXregl &&
    1.35 +         (ubyte_at(2) & NativeTstRegMem::modrm_mask) == NativeTstRegMem::modrm_reg) ||
    1.36 +        ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl &&
    1.37 +        (ubyte_at(1) & NativeTstRegMem::modrm_mask) == NativeTstRegMem::modrm_reg) {
    1.38 +      return true;
    1.39 +    } else {
    1.40 +      return false;
    1.41 +    }
    1.42    } else {
    1.43 -    return false;
    1.44 +    if (ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl &&
    1.45 +        ubyte_at(1) == 0x05) { // 00 rax 101
    1.46 +      address fault = addr_at(6) + int_at(2);
    1.47 +      return os::is_poll_address(fault);
    1.48 +    } else {
    1.49 +      return false;
    1.50 +    }
    1.51    }
    1.52  #else
    1.53    return ( ubyte_at(0) == NativeMovRegMem::instruction_code_mem2reg ||

mercurial