diff options
| author | root <vishwanatha.hd@ibm.com> | 2023-08-02 09:46:27 +0000 |
|---|---|---|
| committer | Cherry Mui <cherryyz@google.com> | 2023-09-05 16:41:03 +0000 |
| commit | a40404da748f0a9c7da19b077634fd7334ca5802 (patch) | |
| tree | 3b7a218f43e83a99cb66bc5aafc0c2b90f5091b9 /src/cmd/internal/obj | |
| parent | a2647f08f0c4e540540a7ae1b9ba7e668e6fed80 (diff) | |
| download | go-a40404da748f0a9c7da19b077634fd7334ca5802.tar.xz | |
cmd/asm: add KMA and KMCTR instructions on s390x.
This CL is to add assembly instruction mnemonics for the following instructions, mainly used in crypto packages.
* KMA - cipher message with authentication
* KMCTR - cipher message with counter
Fixes #61163
Change-Id: Iff9a69911aeb4fab4bca8755b23a106eaebb2332
Reviewed-on: https://go-review.googlesource.com/c/go/+/515195
Reviewed-by: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/cmd/internal/obj')
| -rw-r--r-- | src/cmd/internal/obj/s390x/a.out.go | 2 | ||||
| -rw-r--r-- | src/cmd/internal/obj/s390x/anames.go | 2 | ||||
| -rw-r--r-- | src/cmd/internal/obj/s390x/asmz.go | 40 |
3 files changed, 44 insertions, 0 deletions
diff --git a/src/cmd/internal/obj/s390x/a.out.go b/src/cmd/internal/obj/s390x/a.out.go index ef02fed283..1c86fe1463 100644 --- a/src/cmd/internal/obj/s390x/a.out.go +++ b/src/cmd/internal/obj/s390x/a.out.go @@ -486,6 +486,8 @@ const ( AKLMD AKIMD AKDSA + AKMA + AKMCTR // vector AVA diff --git a/src/cmd/internal/obj/s390x/anames.go b/src/cmd/internal/obj/s390x/anames.go index 40cc5e6b0d..fa23984332 100644 --- a/src/cmd/internal/obj/s390x/anames.go +++ b/src/cmd/internal/obj/s390x/anames.go @@ -212,6 +212,8 @@ var Anames = []string{ "KLMD", "KIMD", "KDSA", + "KMA", + "KMCTR", "VA", "VAB", "VAH", diff --git a/src/cmd/internal/obj/s390x/asmz.go b/src/cmd/internal/obj/s390x/asmz.go index a744d742cf..0ab492a2a5 100644 --- a/src/cmd/internal/obj/s390x/asmz.go +++ b/src/cmd/internal/obj/s390x/asmz.go @@ -347,6 +347,9 @@ var optab = []Optab{ // KDSA {i: 125, as: AKDSA, a1: C_REG, a6: C_REG}, + // KMA + {i: 126, as: AKMA, a1: C_REG, a2: C_REG, a6: C_REG}, + // vector instructions // VRX store @@ -1492,6 +1495,8 @@ func buildop(ctxt *obj.Link) { opset(AKMC, r) opset(AKLMD, r) opset(AKIMD, r) + case AKMA: + opset(AKMCTR, r) } } } @@ -1896,6 +1901,7 @@ const ( op_KM uint32 = 0xB92E // FORMAT_RRE CIPHER MESSAGE op_KMAC uint32 = 0xB91E // FORMAT_RRE COMPUTE MESSAGE AUTHENTICATION CODE op_KMC uint32 = 0xB92F // FORMAT_RRE CIPHER MESSAGE WITH CHAINING + op_KMA uint32 = 0xB929 // FORMAT_RRF2 CIPHER MESSAGE WITH AUTHENTICATION op_KMCTR uint32 = 0xB92D // FORMAT_RRF2 CIPHER MESSAGE WITH COUNTER op_KMF uint32 = 0xB92A // FORMAT_RRE CIPHER MESSAGE WITH CFB op_KMO uint32 = 0xB92B // FORMAT_RRE CIPHER MESSAGE WITH OFB @@ -4428,6 +4434,40 @@ func (c *ctxtz) asmout(p *obj.Prog, asm *[]byte) { } zRRE(op_KDSA, uint32(p.From.Reg), uint32(p.To.Reg), asm) + case 126: // KMA and KMCTR - CIPHER MESSAGE WITH AUTHENTICATION; CIPHER MESSAGE WITH + var opcode uint32 + switch p.As { + default: + c.ctxt.Diag("unexpected opcode %v", p.As) + case AKMA, AKMCTR: + if p.From.Reg == REG_R0 { + c.ctxt.Diag("input argument must not be R0 in %v", p) + } + if p.From.Reg&1 != 0 { + c.ctxt.Diag("input argument must be even register in %v", p) + } + if p.To.Reg == REG_R0 { + c.ctxt.Diag("output argument must not be R0 in %v", p) + } + if p.To.Reg&1 != 0 { + c.ctxt.Diag("output argument must be an even register in %v", p) + } + if p.Reg == REG_R0 { + c.ctxt.Diag("third argument must not be R0 in %v", p) + } + if p.Reg&1 != 0 { + c.ctxt.Diag("third argument must be even register in %v", p) + } + if p.Reg == p.To.Reg || p.Reg == p.From.Reg { + c.ctxt.Diag("third argument must not be input or output argument registers in %v", p) + } + if p.As == AKMA { + opcode = op_KMA + } else if p.As == AKMCTR { + opcode = op_KMCTR + } + } + zRRF(opcode, uint32(p.From.Reg), 0, uint32(p.Reg), uint32(p.To.Reg), asm) } } |
