hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp
changeset 35537 bed5e2dc57a1
parent 35154 a9b3c1984a01
child 35540 e001ad24dcdb
equal deleted inserted replaced
35161:2429124c1755 35537:bed5e2dc57a1
  2800     address start = __ pc();
  2800     address start = __ pc();
  2801     const Register from        = rsi;      // source array address
  2801     const Register from        = rsi;      // source array address
  2802     const Register to          = rdx;      // destination array address
  2802     const Register to          = rdx;      // destination array address
  2803     const Register key         = rcx;      // key array address
  2803     const Register key         = rcx;      // key array address
  2804     const Register counter     = rdi;      // counter byte array initialized from initvector array address
  2804     const Register counter     = rdi;      // counter byte array initialized from initvector array address
  2805 
  2805                                            // and updated with the incremented counter in the end
  2806     // and left with the results of the last encryption block
       
  2807     const Register len_reg     = rbx;
  2806     const Register len_reg     = rbx;
  2808     const Register pos         = rax;
  2807     const Register pos         = rax;
  2809 
  2808 
  2810     __ enter(); // required for proper stackwalking of RuntimeStub frame
  2809     __ enter(); // required for proper stackwalking of RuntimeStub frame
  2811     handleSOERegisters(true /*saving*/); // save rbx, rsi, rdi
  2810     handleSOERegisters(true /*saving*/); // save rbx, rsi, rdi
  2827     const Address  saved_counter_param(rbp, 8 + 20);
  2826     const Address  saved_counter_param(rbp, 8 + 20);
  2828     const Address  used_addr_param(rbp, 8 + 24);
  2827     const Address  used_addr_param(rbp, 8 + 24);
  2829 
  2828 
  2830     __ movptr(from , from_param);
  2829     __ movptr(from , from_param);
  2831     __ movptr(to   , to_param);
  2830     __ movptr(to   , to_param);
  2832     //__ movptr(key, key_param);
       
  2833     //__ movptr(counter, rvec_param);
       
  2834     __ movptr(len_reg , len_param);
  2831     __ movptr(len_reg , len_param);
  2835     //__ movptr(pos, 0);
       
  2836 
  2832 
  2837     // Use the partially used encrpyted counter from last invocation
  2833     // Use the partially used encrpyted counter from last invocation
  2838     Label L_exit_preLoop, L_preLoop_start;
  2834     Label L_exit_preLoop, L_preLoop_start;
  2839 
  2835 
  2840     // Use the registers 'counter' and 'key' here in this preloop
  2836     // Use the registers 'counter' and 'key' here in this preloop
  3005         __ movdqu(Address(to, pos, Address::times_1, 0 * AESBlockSize), xmm_result0);
  3001         __ movdqu(Address(to, pos, Address::times_1, 0 * AESBlockSize), xmm_result0);
  3006         __ addptr(pos, AESBlockSize);
  3002         __ addptr(pos, AESBlockSize);
  3007         __ subptr(len_reg, AESBlockSize);
  3003         __ subptr(len_reg, AESBlockSize);
  3008         __ jmp(L_singleBlockLoopTop[k]);
  3004         __ jmp(L_singleBlockLoopTop[k]);
  3009 
  3005 
  3010       __ BIND(L_processTail_insr[k]);
  3006       __ BIND(L_processTail_insr[k]);                                               // Process the tail part of the input array
  3011         __ addptr(pos, len_reg);
  3007         __ addptr(pos, len_reg);                                                    // 1. Insert bytes from src array into xmm_from0 register
  3012         __ testptr(len_reg, 8);
  3008         __ testptr(len_reg, 8);
  3013         __ jcc(Assembler::zero, L_processTail_4_insr[k]);
  3009         __ jcc(Assembler::zero, L_processTail_4_insr[k]);
  3014           __ subptr(pos,8);
  3010           __ subptr(pos,8);
  3015           __ pinsrd(xmm_from0, Address(from, pos), 0);
  3011           __ pinsrd(xmm_from0, Address(from, pos), 0);
  3016           __ pinsrd(xmm_from0, Address(from, pos, Address::times_1, 4), 1);
  3012           __ pinsrd(xmm_from0, Address(from, pos, Address::times_1, 4), 1);
  3033           __ pslldq(xmm_from0, 1);
  3029           __ pslldq(xmm_from0, 1);
  3034           __ pinsrb(xmm_from0, Address(from, pos), 0);
  3030           __ pinsrb(xmm_from0, Address(from, pos), 0);
  3035         __ BIND(L_processTail_exit_insr[k]);
  3031         __ BIND(L_processTail_exit_insr[k]);
  3036 
  3032 
  3037         __ movptr(saved_encCounter_start, saved_counter_param);
  3033         __ movptr(saved_encCounter_start, saved_counter_param);
  3038         __ movdqu(Address(saved_encCounter_start, 0), xmm_result0);
  3034         __ movdqu(Address(saved_encCounter_start, 0), xmm_result0);               // 2. Perform pxor of the encrypted counter and plaintext Bytes.
  3039         __ pxor(xmm_result0, xmm_from0);
  3035         __ pxor(xmm_result0, xmm_from0);                                          //    Also the encrypted counter is saved for next invocation.
  3040 
  3036 
  3041         __ testptr(len_reg, 8);
  3037         __ testptr(len_reg, 8);
  3042         __ jcc(Assembler::zero, L_processTail_4_extr[k]);
  3038         __ jcc(Assembler::zero, L_processTail_4_extr[k]);                        // 3. Extract bytes from xmm_result0 into the dest. array
  3043           __ pextrd(Address(to, pos), xmm_result0, 0);
  3039           __ pextrd(Address(to, pos), xmm_result0, 0);
  3044           __ pextrd(Address(to, pos, Address::times_1, 4), xmm_result0, 1);
  3040           __ pextrd(Address(to, pos, Address::times_1, 4), xmm_result0, 1);
  3045           __ psrldq(xmm_result0, 8);
  3041           __ psrldq(xmm_result0, 8);
  3046           __ addptr(pos, 8);
  3042           __ addptr(pos, 8);
  3047         __ BIND(L_processTail_4_extr[k]);
  3043         __ BIND(L_processTail_4_extr[k]);