Mercurial > hg > truffle
comparison src/cpu/x86/vm/stubGenerator_x86_32.cpp @ 14261:00f5eff62d18
8002074: Support for AES on SPARC
Summary: Add intrinsics/stub routines support for single-block and multi-block (as used by Cipher Block Chaining mode) AES encryption and decryption operations on the SPARC platform.
Reviewed-by: kvn, roland
Contributed-by: shrinivas.joshi@oracle.com
author | kvn |
---|---|
date | Tue, 14 Jan 2014 17:46:48 -0800 |
parents | 740e263c80c6 |
children | d8041d695d19 |
comparison
equal
deleted
inserted
replaced
14260:8cdf3f43f63e | 14261:00f5eff62d18 |
---|---|
2401 // c_rarg1 - destination byte array address | 2401 // c_rarg1 - destination byte array address |
2402 // c_rarg2 - K (key) in little endian int array | 2402 // c_rarg2 - K (key) in little endian int array |
2403 // c_rarg3 - r vector byte array address | 2403 // c_rarg3 - r vector byte array address |
2404 // c_rarg4 - input length | 2404 // c_rarg4 - input length |
2405 // | 2405 // |
2406 // Output: | |
2407 // rax - input length | |
2408 // | |
2406 address generate_cipherBlockChaining_encryptAESCrypt() { | 2409 address generate_cipherBlockChaining_encryptAESCrypt() { |
2407 assert(UseAES, "need AES instructions and misaligned SSE support"); | 2410 assert(UseAES, "need AES instructions and misaligned SSE support"); |
2408 __ align(CodeEntryAlignment); | 2411 __ align(CodeEntryAlignment); |
2409 StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_encryptAESCrypt"); | 2412 StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_encryptAESCrypt"); |
2410 address start = __ pc(); | 2413 address start = __ pc(); |
2481 | 2484 |
2482 __ BIND(L_exit); | 2485 __ BIND(L_exit); |
2483 __ movdqu(Address(rvec, 0), xmm_result); // final value of r stored in rvec of CipherBlockChaining object | 2486 __ movdqu(Address(rvec, 0), xmm_result); // final value of r stored in rvec of CipherBlockChaining object |
2484 | 2487 |
2485 handleSOERegisters(false /*restoring*/); | 2488 handleSOERegisters(false /*restoring*/); |
2486 __ movl(rax, 0); // return 0 (why?) | 2489 __ movptr(rax, len_param); // return length |
2487 __ leave(); // required for proper stackwalking of RuntimeStub frame | 2490 __ leave(); // required for proper stackwalking of RuntimeStub frame |
2488 __ ret(0); | 2491 __ ret(0); |
2489 | 2492 |
2490 __ BIND(L_key_192_256); | 2493 __ BIND(L_key_192_256); |
2491 // here rax = len in ints of AESCrypt.KLE array (52=192, or 60=256) | 2494 // here rax = len in ints of AESCrypt.KLE array (52=192, or 60=256) |
2554 // c_rarg0 - source byte array address | 2557 // c_rarg0 - source byte array address |
2555 // c_rarg1 - destination byte array address | 2558 // c_rarg1 - destination byte array address |
2556 // c_rarg2 - K (key) in little endian int array | 2559 // c_rarg2 - K (key) in little endian int array |
2557 // c_rarg3 - r vector byte array address | 2560 // c_rarg3 - r vector byte array address |
2558 // c_rarg4 - input length | 2561 // c_rarg4 - input length |
2562 // | |
2563 // Output: | |
2564 // rax - input length | |
2559 // | 2565 // |
2560 | 2566 |
2561 address generate_cipherBlockChaining_decryptAESCrypt() { | 2567 address generate_cipherBlockChaining_decryptAESCrypt() { |
2562 assert(UseAES, "need AES instructions and misaligned SSE support"); | 2568 assert(UseAES, "need AES instructions and misaligned SSE support"); |
2563 __ align(CodeEntryAlignment); | 2569 __ align(CodeEntryAlignment); |
2648 __ BIND(L_exit); | 2654 __ BIND(L_exit); |
2649 __ movdqu(xmm_temp, Address(prev_block_cipher_ptr, 0x00)); | 2655 __ movdqu(xmm_temp, Address(prev_block_cipher_ptr, 0x00)); |
2650 __ movptr(rvec , rvec_param); // restore this since used in loop | 2656 __ movptr(rvec , rvec_param); // restore this since used in loop |
2651 __ movdqu(Address(rvec, 0), xmm_temp); // final value of r stored in rvec of CipherBlockChaining object | 2657 __ movdqu(Address(rvec, 0), xmm_temp); // final value of r stored in rvec of CipherBlockChaining object |
2652 handleSOERegisters(false /*restoring*/); | 2658 handleSOERegisters(false /*restoring*/); |
2653 __ movl(rax, 0); // return 0 (why?) | 2659 __ movptr(rax, len_param); // return length |
2654 __ leave(); // required for proper stackwalking of RuntimeStub frame | 2660 __ leave(); // required for proper stackwalking of RuntimeStub frame |
2655 __ ret(0); | 2661 __ ret(0); |
2656 | 2662 |
2657 | 2663 |
2658 __ BIND(L_key_192_256); | 2664 __ BIND(L_key_192_256); |