1
0
mirror of https://github.com/golang/go synced 2024-11-23 14:40:02 -07:00

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>
This commit is contained in:
Srinivas Pokala 2022-12-14 06:31:50 +01:00 committed by Keith Randall
parent 5c67ebbb31
commit 3e77efc720
5 changed files with 13 additions and 1 deletions

View File

@ -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

View File

@ -994,6 +994,9 @@ const (
AWORD
ADWORD
// Breakpoint
ABRRK
// end marker
ALAST

View File

@ -716,5 +716,6 @@ var Anames = []string{
"BYTE",
"WORD",
"DWORD",
"BRRK",
"LAST",
}

View File

@ -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 {

View File

@ -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