844 void kernel_crc32_1word(Register crc, Register buf, Register len, Register table,
845 Register t0, Register t1, Register t2, Register t3,
846 Register tc0, Register tc1, Register tc2, Register tc3,
847 bool invertCRC);
848 void kernel_crc32_1byte(Register crc, Register buf, Register len, Register table,
849 Register t0, Register t1, Register t2, Register t3,
850 bool invertCRC);
851 void kernel_crc32_1word_vpmsumd(Register crc, Register buf, Register len, Register table,
852 Register constants, Register barretConstants,
853 Register t0, Register t1, Register t2, Register t3, Register t4,
854 bool invertCRC);
855 void kernel_crc32_1word_aligned(Register crc, Register buf, Register len,
856 Register constants, Register barretConstants,
857 Register t0, Register t1, Register t2);
858
859 void kernel_crc32_singleByte(Register crc, Register buf, Register len, Register table, Register tmp,
860 bool invertCRC);
861 void kernel_crc32_singleByteReg(Register crc, Register val, Register table,
862 bool invertCRC);
863
864 //
865 // Debugging
866 //
867
868 // assert on cr0
869 void asm_assert(bool check_equal, const char* msg, int id);
870 void asm_assert_eq(const char* msg, int id) { asm_assert(true, msg, id); }
871 void asm_assert_ne(const char* msg, int id) { asm_assert(false, msg, id); }
872
873 private:
874 void asm_assert_mems_zero(bool check_equal, int size, int mem_offset, Register mem_base,
875 const char* msg, int id);
876
877 public:
878
879 void asm_assert_mem8_is_zero(int mem_offset, Register mem_base, const char* msg, int id) {
880 asm_assert_mems_zero(true, 8, mem_offset, mem_base, msg, id);
881 }
882 void asm_assert_mem8_isnot_zero(int mem_offset, Register mem_base, const char* msg, int id) {
883 asm_assert_mems_zero(false, 8, mem_offset, mem_base, msg, id);
|
844 void kernel_crc32_1word(Register crc, Register buf, Register len, Register table,
845 Register t0, Register t1, Register t2, Register t3,
846 Register tc0, Register tc1, Register tc2, Register tc3,
847 bool invertCRC);
848 void kernel_crc32_1byte(Register crc, Register buf, Register len, Register table,
849 Register t0, Register t1, Register t2, Register t3,
850 bool invertCRC);
851 void kernel_crc32_1word_vpmsumd(Register crc, Register buf, Register len, Register table,
852 Register constants, Register barretConstants,
853 Register t0, Register t1, Register t2, Register t3, Register t4,
854 bool invertCRC);
855 void kernel_crc32_1word_aligned(Register crc, Register buf, Register len,
856 Register constants, Register barretConstants,
857 Register t0, Register t1, Register t2);
858
859 void kernel_crc32_singleByte(Register crc, Register buf, Register len, Register table, Register tmp,
860 bool invertCRC);
861 void kernel_crc32_singleByteReg(Register crc, Register val, Register table,
862 bool invertCRC);
863
864 // SHA-2 auxiliary functions and public interfaces
865 private:
866 void sha256_deque(const VectorRegister src,
867 const VectorRegister dst1, const VectorRegister dst2, const VectorRegister dst3);
868 void sha256_load_h_vec(const VectorRegister a, const VectorRegister e, const Register hptr);
869 void sha256_round(const VectorRegister* hs, const int total_hs, int& h_cnt, const VectorRegister kpw);
870 void sha256_load_w_plus_k_vec(const Register buf_in, const VectorRegister* ws,
871 const int total_ws, const Register k, const VectorRegister* kpws,
872 const int total_kpws);
873 void sha256_calc_4w(const VectorRegister w0, const VectorRegister w1,
874 const VectorRegister w2, const VectorRegister w3, const VectorRegister kpw0,
875 const VectorRegister kpw1, const VectorRegister kpw2, const VectorRegister kpw3,
876 const Register j, const Register k);
877 void sha256_update_sha_state(const VectorRegister a, const VectorRegister b,
878 const VectorRegister c, const VectorRegister d, const VectorRegister e,
879 const VectorRegister f, const VectorRegister g, const VectorRegister h,
880 const Register hptr);
881
882 void sha512_load_w_vec(const Register buf_in, const VectorRegister* ws, const int total_ws);
883 void sha512_update_sha_state(const Register state, const VectorRegister* hs, const int total_hs);
884 void sha512_round(const VectorRegister* hs, const int total_hs, int& h_cnt, const VectorRegister kpw);
885 void sha512_load_h_vec(const Register state, const VectorRegister* hs, const int total_hs);
886 void sha512_calc_2w(const VectorRegister w0, const VectorRegister w1,
887 const VectorRegister w2, const VectorRegister w3,
888 const VectorRegister w4, const VectorRegister w5,
889 const VectorRegister w6, const VectorRegister w7,
890 const VectorRegister kpw0, const VectorRegister kpw1, const Register j,
891 const VectorRegister vRb, const Register k);
892
893 public:
894 void sha256(bool multi_block);
895 void sha512(bool multi_block);
896
897
898 //
899 // Debugging
900 //
901
902 // assert on cr0
903 void asm_assert(bool check_equal, const char* msg, int id);
904 void asm_assert_eq(const char* msg, int id) { asm_assert(true, msg, id); }
905 void asm_assert_ne(const char* msg, int id) { asm_assert(false, msg, id); }
906
907 private:
908 void asm_assert_mems_zero(bool check_equal, int size, int mem_offset, Register mem_base,
909 const char* msg, int id);
910
911 public:
912
913 void asm_assert_mem8_is_zero(int mem_offset, Register mem_base, const char* msg, int id) {
914 asm_assert_mems_zero(true, 8, mem_offset, mem_base, msg, id);
915 }
916 void asm_assert_mem8_isnot_zero(int mem_offset, Register mem_base, const char* msg, int id) {
917 asm_assert_mems_zero(false, 8, mem_offset, mem_base, msg, id);
|