8146581: Minor corrections to the patch submitted for earlier bug id - 8143925

Reviewed-by: kvn
This commit is contained in:
Kishor Kharbas 2016-01-07 14:29:05 -08:00 committed by Vladimir Kozlov
parent 543fcb3a25
commit a8fcb62829
3 changed files with 13 additions and 27 deletions

View File

@ -2802,8 +2802,7 @@ class StubGenerator: public StubCodeGenerator {
const Register to = rdx; // destination array address const Register to = rdx; // destination array address
const Register key = rcx; // key array address const Register key = rcx; // key array address
const Register counter = rdi; // counter byte array initialized from initvector array address const Register counter = rdi; // counter byte array initialized from initvector array address
// and updated with the incremented counter in the end
// and left with the results of the last encryption block
const Register len_reg = rbx; const Register len_reg = rbx;
const Register pos = rax; const Register pos = rax;
@ -2829,10 +2828,7 @@ class StubGenerator: public StubCodeGenerator {
__ movptr(from , from_param); __ movptr(from , from_param);
__ movptr(to , to_param); __ movptr(to , to_param);
//__ movptr(key, key_param);
//__ movptr(counter, rvec_param);
__ movptr(len_reg , len_param); __ movptr(len_reg , len_param);
//__ movptr(pos, 0);
// Use the partially used encrpyted counter from last invocation // Use the partially used encrpyted counter from last invocation
Label L_exit_preLoop, L_preLoop_start; Label L_exit_preLoop, L_preLoop_start;
@ -3007,8 +3003,8 @@ class StubGenerator: public StubCodeGenerator {
__ subptr(len_reg, AESBlockSize); __ subptr(len_reg, AESBlockSize);
__ jmp(L_singleBlockLoopTop[k]); __ jmp(L_singleBlockLoopTop[k]);
__ BIND(L_processTail_insr[k]); __ BIND(L_processTail_insr[k]); // Process the tail part of the input array
__ addptr(pos, len_reg); __ addptr(pos, len_reg); // 1. Insert bytes from src array into xmm_from0 register
__ testptr(len_reg, 8); __ testptr(len_reg, 8);
__ jcc(Assembler::zero, L_processTail_4_insr[k]); __ jcc(Assembler::zero, L_processTail_4_insr[k]);
__ subptr(pos,8); __ subptr(pos,8);
@ -3035,11 +3031,11 @@ class StubGenerator: public StubCodeGenerator {
__ BIND(L_processTail_exit_insr[k]); __ BIND(L_processTail_exit_insr[k]);
__ movptr(saved_encCounter_start, saved_counter_param); __ movptr(saved_encCounter_start, saved_counter_param);
__ movdqu(Address(saved_encCounter_start, 0), xmm_result0); __ movdqu(Address(saved_encCounter_start, 0), xmm_result0); // 2. Perform pxor of the encrypted counter and plaintext Bytes.
__ pxor(xmm_result0, xmm_from0); __ pxor(xmm_result0, xmm_from0); // Also the encrypted counter is saved for next invocation.
__ testptr(len_reg, 8); __ 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), xmm_result0, 0);
__ pextrd(Address(to, pos, Address::times_1, 4), xmm_result0, 1); __ pextrd(Address(to, pos, Address::times_1, 4), xmm_result0, 1);
__ psrldq(xmm_result0, 8); __ psrldq(xmm_result0, 8);

View File

@ -3752,7 +3752,7 @@ class StubGenerator: public StubCodeGenerator {
const Register to = c_rarg1; // destination array address const Register to = c_rarg1; // destination array address
const Register key = c_rarg2; // key array address const Register key = c_rarg2; // key array address
const Register counter = c_rarg3; // counter byte array initialized from counter 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 #ifndef _WIN64
const Register len_reg = c_rarg4; const Register len_reg = c_rarg4;
const Register saved_encCounter_start = c_rarg5; const Register saved_encCounter_start = c_rarg5;
@ -3967,8 +3967,8 @@ class StubGenerator: public StubCodeGenerator {
__ addptr(pos, AESBlockSize); __ addptr(pos, AESBlockSize);
__ subptr(len_reg, AESBlockSize); __ subptr(len_reg, AESBlockSize);
__ jmp(L_singleBlockLoopTop[k]); __ jmp(L_singleBlockLoopTop[k]);
__ BIND(L_processTail_insr[k]); __ BIND(L_processTail_insr[k]); // Process the tail part of the input array
__ addptr(pos, len_reg); __ addptr(pos, len_reg); // 1. Insert bytes from src array into xmm_from0 register
__ testptr(len_reg, 8); __ testptr(len_reg, 8);
__ jcc(Assembler::zero, L_processTail_4_insr[k]); __ jcc(Assembler::zero, L_processTail_4_insr[k]);
__ subptr(pos,8); __ subptr(pos,8);
@ -3993,11 +3993,11 @@ class StubGenerator: public StubCodeGenerator {
__ pinsrb(xmm_from0, Address(from, pos), 0); __ pinsrb(xmm_from0, Address(from, pos), 0);
__ BIND(L_processTail_exit_insr[k]); __ BIND(L_processTail_exit_insr[k]);
__ movdqu(Address(saved_encCounter_start, 0), xmm_result0); __ movdqu(Address(saved_encCounter_start, 0), xmm_result0); // 2. Perform pxor of the encrypted counter and plaintext Bytes.
__ pxor(xmm_result0, xmm_from0); __ pxor(xmm_result0, xmm_from0); // Also the encrypted counter is saved for next invocation.
__ testptr(len_reg, 8); __ 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); __ pextrq(Address(to, pos), xmm_result0, 0);
__ psrldq(xmm_result0, 8); __ psrldq(xmm_result0, 8);
__ addptr(pos, 8); __ addptr(pos, 8);

View File

@ -671,7 +671,7 @@ void VM_Version::get_processor_features() {
} }
// --AES-CTR ends-- // --AES-CTR ends--
} }
} else if (UseAES || UseAESIntrinsics) { } else if (UseAES || UseAESIntrinsics || UseAESCTRIntrinsics) {
if (UseAES && !FLAG_IS_DEFAULT(UseAES)) { if (UseAES && !FLAG_IS_DEFAULT(UseAES)) {
warning("AES instructions are not available on this CPU"); warning("AES instructions are not available on this CPU");
FLAG_SET_DEFAULT(UseAES, false); FLAG_SET_DEFAULT(UseAES, false);
@ -707,16 +707,6 @@ void VM_Version::get_processor_features() {
FLAG_SET_DEFAULT(UseCRC32Intrinsics, false); 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 (supports_sse4_2()) {
if (FLAG_IS_DEFAULT(UseCRC32CIntrinsics)) { if (FLAG_IS_DEFAULT(UseCRC32CIntrinsics)) {
UseCRC32CIntrinsics = true; UseCRC32CIntrinsics = true;