asm_s390x.s 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2016 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build s390x,!gccgo,!appengine
  5. #include "textflag.h"
  6. // func hasHWSupport() bool
  7. TEXT ·hasHWSupport(SB),NOSPLIT,$16-1
  8. XOR R0, R0 // set function code to 0 (query)
  9. LA mask-16(SP), R1 // 16-byte stack variable for mask
  10. MOVD $(0x38<<40), R3 // mask for bits 18-20 (big endian)
  11. // check for KM AES functions
  12. WORD $0xB92E0024 // cipher message (KM)
  13. MOVD mask-16(SP), R2
  14. AND R3, R2
  15. CMPBNE R2, R3, notfound
  16. // check for KMC AES functions
  17. WORD $0xB92F0024 // cipher message with chaining (KMC)
  18. MOVD mask-16(SP), R2
  19. AND R3, R2
  20. CMPBNE R2, R3, notfound
  21. // check for KMCTR AES functions
  22. WORD $0xB92D4024 // cipher message with counter (KMCTR)
  23. MOVD mask-16(SP), R2
  24. AND R3, R2
  25. CMPBNE R2, R3, notfound
  26. // check for KIMD GHASH function
  27. WORD $0xB93E0024 // compute intermediate message digest (KIMD)
  28. MOVD mask-8(SP), R2 // bits 64-127
  29. MOVD $(1<<62), R5
  30. AND R5, R2
  31. CMPBNE R2, R5, notfound
  32. MOVB $1, ret+0(FP)
  33. RET
  34. notfound:
  35. MOVB $0, ret+0(FP)
  36. RET