# HG changeset patch # User kvn # Date 1452205745 28800 # Node ID bed5e2dc57a14deac1b117433c89553ec9a8115d # Parent 2429124c17552c3ceb19d8515dbc1b45593ecfca 8146581: Minor corrections to the patch submitted for earlier bug id - 8143925 Reviewed-by: kvn Contributed-by: kishor.kharbas@intel.com diff -r 2429124c1755 -r bed5e2dc57a1 hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp Wed Jan 06 08:02:23 2016 +0100 +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp Thu Jan 07 14:29:05 2016 -0800 @@ -2802,8 +2802,7 @@ const Register to = rdx; // destination array address const Register key = rcx; // key array address const Register counter = rdi; // counter byte array initialized from initvector array address - - // and left with the results of the last encryption block + // and updated with the incremented counter in the end const Register len_reg = rbx; const Register pos = rax; @@ -2829,10 +2828,7 @@ __ movptr(from , from_param); __ movptr(to , to_param); - //__ movptr(key, key_param); - //__ movptr(counter, rvec_param); __ movptr(len_reg , len_param); - //__ movptr(pos, 0); // Use the partially used encrpyted counter from last invocation Label L_exit_preLoop, L_preLoop_start; @@ -3007,8 +3003,8 @@ __ subptr(len_reg, AESBlockSize); __ jmp(L_singleBlockLoopTop[k]); - __ BIND(L_processTail_insr[k]); - __ addptr(pos, len_reg); + __ BIND(L_processTail_insr[k]); // Process the tail part of the input array + __ addptr(pos, len_reg); // 1. Insert bytes from src array into xmm_from0 register __ testptr(len_reg, 8); __ jcc(Assembler::zero, L_processTail_4_insr[k]); __ subptr(pos,8); @@ -3035,11 +3031,11 @@ __ BIND(L_processTail_exit_insr[k]); __ movptr(saved_encCounter_start, saved_counter_param); - __ movdqu(Address(saved_encCounter_start, 0), xmm_result0); - __ pxor(xmm_result0, xmm_from0); + __ movdqu(Address(saved_encCounter_start, 0), xmm_result0); // 2. Perform pxor of the encrypted counter and plaintext Bytes. + __ pxor(xmm_result0, xmm_from0); // Also the encrypted counter is saved for next invocation. __ testptr(len_reg, 8); - __ jcc(Assembler::zero, L_processTail_4_extr[k]); + __ jcc(Assembler::zero, L_processTail_4_extr[k]); // 3. Extract bytes from xmm_result0 into the dest. array __ pextrd(Address(to, pos), xmm_result0, 0); __ pextrd(Address(to, pos, Address::times_1, 4), xmm_result0, 1); __ psrldq(xmm_result0, 8); diff -r 2429124c1755 -r bed5e2dc57a1 hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Wed Jan 06 08:02:23 2016 +0100 +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Thu Jan 07 14:29:05 2016 -0800 @@ -3752,7 +3752,7 @@ const Register to = c_rarg1; // destination array address const Register key = c_rarg2; // key array address const Register counter = c_rarg3; // counter byte array initialized from counter array address - // and left with the results of the last encryption block + // and updated with the incremented counter in the end #ifndef _WIN64 const Register len_reg = c_rarg4; const Register saved_encCounter_start = c_rarg5; @@ -3967,8 +3967,8 @@ __ addptr(pos, AESBlockSize); __ subptr(len_reg, AESBlockSize); __ jmp(L_singleBlockLoopTop[k]); - __ BIND(L_processTail_insr[k]); - __ addptr(pos, len_reg); + __ BIND(L_processTail_insr[k]); // Process the tail part of the input array + __ addptr(pos, len_reg); // 1. Insert bytes from src array into xmm_from0 register __ testptr(len_reg, 8); __ jcc(Assembler::zero, L_processTail_4_insr[k]); __ subptr(pos,8); @@ -3993,11 +3993,11 @@ __ pinsrb(xmm_from0, Address(from, pos), 0); __ BIND(L_processTail_exit_insr[k]); - __ movdqu(Address(saved_encCounter_start, 0), xmm_result0); - __ pxor(xmm_result0, xmm_from0); + __ movdqu(Address(saved_encCounter_start, 0), xmm_result0); // 2. Perform pxor of the encrypted counter and plaintext Bytes. + __ pxor(xmm_result0, xmm_from0); // Also the encrypted counter is saved for next invocation. __ testptr(len_reg, 8); - __ jcc(Assembler::zero, L_processTail_4_extr[k]); + __ jcc(Assembler::zero, L_processTail_4_extr[k]); // 3. Extract bytes from xmm_result0 into the dest. array __ pextrq(Address(to, pos), xmm_result0, 0); __ psrldq(xmm_result0, 8); __ addptr(pos, 8); diff -r 2429124c1755 -r bed5e2dc57a1 hotspot/src/cpu/x86/vm/vm_version_x86.cpp --- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Wed Jan 06 08:02:23 2016 +0100 +++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Thu Jan 07 14:29:05 2016 -0800 @@ -671,7 +671,7 @@ } // --AES-CTR ends-- } - } else if (UseAES || UseAESIntrinsics) { + } else if (UseAES || UseAESIntrinsics || UseAESCTRIntrinsics) { if (UseAES && !FLAG_IS_DEFAULT(UseAES)) { warning("AES instructions are not available on this CPU"); FLAG_SET_DEFAULT(UseAES, false); @@ -707,16 +707,6 @@ FLAG_SET_DEFAULT(UseCRC32Intrinsics, false); } - if (UseAESIntrinsics) { - if (FLAG_IS_DEFAULT(UseAESCTRIntrinsics)) { - UseAESCTRIntrinsics = true; - } - } else if (UseAESCTRIntrinsics) { - if (!FLAG_IS_DEFAULT(UseAESCTRIntrinsics)) - warning("AES/CTR intrinsics are not available on this CPU"); - FLAG_SET_DEFAULT(UseAESCTRIntrinsics, false); - } - if (supports_sse4_2()) { if (FLAG_IS_DEFAULT(UseCRC32CIntrinsics)) { UseCRC32CIntrinsics = true;