aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSrinivas Pokala <Pokala.Srinivas@ibm.com>2022-12-14 06:31:50 +0100
committerKeith Randall <khr@golang.org>2023-01-20 05:00:12 +0000
commit3e77efc7204407c5c8882bec42fdcaa88ef40a9b (patch)
tree81273a001366a3c604d93788cb46df2a64693154 /src
parent5c67ebbb31a296ca1593d0229b1d51d5ac73aa6d (diff)
downloadgo-3e77efc7204407c5c8882bec42fdcaa88ef40a9b.tar.xz
cmd/internal/obj/s390x, runtime: fix breakpoint in s390x
Currently runtime.Breakpoint generates SIGSEGV in s390x. The solution to this is add new asm instruction BRRK of type FORMAT_E for the breakpoint exception. Fixes #52103 Change-Id: I8358a56e428849a5d28d5ade141e1d7310bee084 Reviewed-on: https://go-review.googlesource.com/c/go/+/457456 Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/asm/internal/asm/testdata/s390x.s1
-rw-r--r--src/cmd/internal/obj/s390x/a.out.go3
-rw-r--r--src/cmd/internal/obj/s390x/anames.go1
-rw-r--r--src/cmd/internal/obj/s390x/asmz.go7
-rw-r--r--src/runtime/asm_s390x.s2
5 files changed, 13 insertions, 1 deletions
diff --git a/src/cmd/asm/internal/asm/testdata/s390x.s b/src/cmd/asm/internal/asm/testdata/s390x.s
index 7c5d26be33..78ccb96fc1 100644
--- a/src/cmd/asm/internal/asm/testdata/s390x.s
+++ b/src/cmd/asm/internal/asm/testdata/s390x.s
@@ -410,6 +410,7 @@ TEXT main·foo(SB),DUPOK|NOSPLIT,$16-0 // TEXT main.foo(SB), DUPOK|NOSPLIT, $16-
TCDB F15, $4095 // edf00fff0011
UNDEF // 00000000
+ BRRK // 0001
NOPH // 0700
SYNC // 07e0
diff --git a/src/cmd/internal/obj/s390x/a.out.go b/src/cmd/internal/obj/s390x/a.out.go
index c1bda1fced..cdfb6ddff3 100644
--- a/src/cmd/internal/obj/s390x/a.out.go
+++ b/src/cmd/internal/obj/s390x/a.out.go
@@ -994,6 +994,9 @@ const (
AWORD
ADWORD
+ // Breakpoint
+ ABRRK
+
// end marker
ALAST
diff --git a/src/cmd/internal/obj/s390x/anames.go b/src/cmd/internal/obj/s390x/anames.go
index 8b2a76b2c9..3af15a504c 100644
--- a/src/cmd/internal/obj/s390x/anames.go
+++ b/src/cmd/internal/obj/s390x/anames.go
@@ -716,5 +716,6 @@ var Anames = []string{
"BYTE",
"WORD",
"DWORD",
+ "BRRK",
"LAST",
}
diff --git a/src/cmd/internal/obj/s390x/asmz.go b/src/cmd/internal/obj/s390x/asmz.go
index d8a36c4e9c..d9f76061ef 100644
--- a/src/cmd/internal/obj/s390x/asmz.go
+++ b/src/cmd/internal/obj/s390x/asmz.go
@@ -333,6 +333,9 @@ var optab = []Optab{
// undefined (deliberate illegal instruction)
{i: 78, as: obj.AUNDEF},
+ // Break point instruction(0x0001 opcode)
+ {i: 73, as: ABRRK},
+
// 2 byte no-operation
{i: 66, as: ANOPH},
@@ -2470,6 +2473,7 @@ const (
op_XSCH uint32 = 0xB276 // FORMAT_S CANCEL SUBCHANNEL
op_XY uint32 = 0xE357 // FORMAT_RXY1 EXCLUSIVE OR (32)
op_ZAP uint32 = 0xF800 // FORMAT_SS2 ZERO AND ADD
+ op_BRRK uint32 = 0x0001 // FORMAT_E BREAKPOINT
// added in z13
op_CXPT uint32 = 0xEDAF // RSL-b CONVERT FROM PACKED (to extended DFP)
@@ -3605,6 +3609,9 @@ func (c *ctxtz) asmout(p *obj.Prog, asm *[]byte) {
zSIL(opcode, uint32(r), uint32(d), uint32(v), asm)
}
+ case 73: //Illegal opcode with SIGTRAP Exception
+ zE(op_BRRK, asm)
+
case 74: // mov reg addr (including relocation)
i2 := c.regoff(&p.To)
switch p.As {
diff --git a/src/runtime/asm_s390x.s b/src/runtime/asm_s390x.s
index 334e1aa909..96b20f43a8 100644
--- a/src/runtime/asm_s390x.s
+++ b/src/runtime/asm_s390x.s
@@ -163,7 +163,7 @@ DATA runtime·mainPC+0(SB)/8,$runtime·main(SB)
GLOBL runtime·mainPC(SB),RODATA,$8
TEXT runtime·breakpoint(SB),NOSPLIT|NOFRAME,$0-0
- MOVD $0, 2(R0)
+ BRRK
RET
TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0