diff options
| author | Srinivas Pokala <Pokala.Srinivas@ibm.com> | 2023-07-12 14:47:31 +0200 |
|---|---|---|
| committer | Cherry Mui <cherryyz@google.com> | 2023-08-02 19:58:18 +0000 |
| commit | ed8cbaf6ac58120c7171dadaaa091f031712c6d2 (patch) | |
| tree | 3dc2580ef70446d57f2062359efe062aa9fff03e /src/cmd/internal/obj | |
| parent | fbf9076ee8c8f665f1e8bba08fdc473cc7a2d690 (diff) | |
| download | go-ed8cbaf6ac58120c7171dadaaa091f031712c6d2.tar.xz | |
cmd/asm: add s390x crypto related instructions
This CL add's the following instructions,useful for cipher and
message digest operations:
* KM - cipher message
* KMC - cipher message with chaining
* KLMD - compute last message digest
* KIMD - compute intermediate message digest
Fixes #61163
Change-Id: Ib0636430c3e4888ed61b86c5acae45ee596463ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/509075
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/internal/obj')
| -rw-r--r-- | src/cmd/internal/obj/s390x/a.out.go | 6 | ||||
| -rw-r--r-- | src/cmd/internal/obj/s390x/anames.go | 4 | ||||
| -rw-r--r-- | src/cmd/internal/obj/s390x/asmz.go | 45 |
3 files changed, 55 insertions, 0 deletions
diff --git a/src/cmd/internal/obj/s390x/a.out.go b/src/cmd/internal/obj/s390x/a.out.go index cdfb6ddff3..0b1aa5af16 100644 --- a/src/cmd/internal/obj/s390x/a.out.go +++ b/src/cmd/internal/obj/s390x/a.out.go @@ -480,6 +480,12 @@ const ( // macros ACLEAR + // crypto + AKM + AKMC + AKLMD + AKIMD + // vector AVA AVAB diff --git a/src/cmd/internal/obj/s390x/anames.go b/src/cmd/internal/obj/s390x/anames.go index 3af15a504c..d5f5f343e3 100644 --- a/src/cmd/internal/obj/s390x/anames.go +++ b/src/cmd/internal/obj/s390x/anames.go @@ -207,6 +207,10 @@ var Anames = []string{ "STCKE", "STCKF", "CLEAR", + "KM", + "KMC", + "KLMD", + "KIMD", "VA", "VAB", "VAH", diff --git a/src/cmd/internal/obj/s390x/asmz.go b/src/cmd/internal/obj/s390x/asmz.go index d9f76061ef..81e7a2d62e 100644 --- a/src/cmd/internal/obj/s390x/asmz.go +++ b/src/cmd/internal/obj/s390x/asmz.go @@ -339,6 +339,11 @@ var optab = []Optab{ // 2 byte no-operation {i: 66, as: ANOPH}, + // crypto instructions + + // KM + {i: 124, as: AKM, a1: C_REG, a6: C_REG}, + // vector instructions // VRX store @@ -1480,6 +1485,10 @@ func buildop(ctxt *obj.Link) { opset(AVFMSDB, r) opset(AWFMSDB, r) opset(AVPERM, r) + case AKM: + opset(AKMC, r) + opset(AKLMD, r) + opset(AKIMD, r) } } } @@ -4366,6 +4375,42 @@ func (c *ctxtz) asmout(p *obj.Prog, asm *[]byte) { op, _, _ := vop(p.As) m4 := c.regoff(&p.From) zVRRc(op, uint32(p.To.Reg), uint32(p.Reg), uint32(p.GetFrom3().Reg), 0, 0, uint32(m4), asm) + + case 124: + var opcode uint32 + switch p.As { + default: + c.ctxt.Diag("unexpected opcode %v", p.As) + case AKM, AKMC, AKLMD: + if p.From.Reg == REG_R0 { + c.ctxt.Diag("input must not be R0 in %v", p) + } + if p.From.Reg&1 != 0 { + c.ctxt.Diag("input must be even register in %v", p) + } + if p.To.Reg == REG_R0 { + c.ctxt.Diag("second argument must not be R0 in %v", p) + } + if p.To.Reg&1 != 0 { + c.ctxt.Diag("second argument must be even register in %v", p) + } + if p.As == AKM { + opcode = op_KM + } else if p.As == AKMC { + opcode = op_KMC + } else { + opcode = op_KLMD + } + case AKIMD: + if p.To.Reg == REG_R0 { + c.ctxt.Diag("second argument must not be R0 in %v", p) + } + if p.To.Reg&1 != 0 { + c.ctxt.Diag("second argument must be even register in %v", p) + } + opcode = op_KIMD + } + zRRE(opcode, uint32(p.From.Reg), uint32(p.To.Reg), asm) } } |
