Commit c950a90d authored by Austin Clements's avatar Austin Clements

runtime: call abort instead of raw INT $3 or bad MOV

Everything except for amd64, amd64p32, and 386 currently defines and
uses an abort function. This CL makes these match. The next CL will
recognize the abort function to make this more useful.

Change-Id: I7c155871ea48919a9220417df0630005b444f488
Reviewed-on: https://go-review.googlesource.com/93660
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarKeith Randall <khr@golang.org>
parent 7f1b2738
...@@ -24,3 +24,5 @@ runtime/asm_386.s: [386] uint32tofloat64: function uint32tofloat64 missing Go de ...@@ -24,3 +24,5 @@ runtime/asm_386.s: [386] uint32tofloat64: function uint32tofloat64 missing Go de
runtime/asm_386.s: [386] float64touint32: function float64touint32 missing Go declaration runtime/asm_386.s: [386] float64touint32: function float64touint32 missing Go declaration
runtime/asm_386.s: [386] stackcheck: function stackcheck missing Go declaration runtime/asm_386.s: [386] stackcheck: function stackcheck missing Go declaration
runtime/asm_ARCHSUFF.s: [GOARCH] abort: function abort missing Go declaration
...@@ -21,3 +21,4 @@ runtime/asm_amd64.s: [amd64] addmoduledata: function addmoduledata missing Go de ...@@ -21,3 +21,4 @@ runtime/asm_amd64.s: [amd64] addmoduledata: function addmoduledata missing Go de
runtime/duff_amd64.s: [amd64] duffzero: function duffzero missing Go declaration runtime/duff_amd64.s: [amd64] duffzero: function duffzero missing Go declaration
runtime/duff_amd64.s: [amd64] duffcopy: function duffcopy missing Go declaration runtime/duff_amd64.s: [amd64] duffcopy: function duffcopy missing Go declaration
runtime/asm_amd64.s: [amd64] stackcheck: function stackcheck missing Go declaration runtime/asm_amd64.s: [amd64] stackcheck: function stackcheck missing Go declaration
runtime/asm_ARCHSUFF.s: [GOARCH] abort: function abort missing Go declaration
...@@ -26,3 +26,5 @@ runtime/asm_amd64p32.s: [amd64p32] rt0_go: unknown variable argv ...@@ -26,3 +26,5 @@ runtime/asm_amd64p32.s: [amd64p32] rt0_go: unknown variable argv
runtime/asm_amd64p32.s: [amd64p32] asmcgocall: RET without writing to 4-byte ret+8(FP) runtime/asm_amd64p32.s: [amd64p32] asmcgocall: RET without writing to 4-byte ret+8(FP)
runtime/asm_amd64p32.s: [amd64p32] stackcheck: function stackcheck missing Go declaration runtime/asm_amd64p32.s: [amd64p32] stackcheck: function stackcheck missing Go declaration
runtime/asm_ARCHSUFF.s: [GOARCH] abort: function abort missing Go declaration
...@@ -132,7 +132,7 @@ bad_proc: // show that the program requires MMX. ...@@ -132,7 +132,7 @@ bad_proc: // show that the program requires MMX.
CALL runtime·write(SB) CALL runtime·write(SB)
MOVL $1, 0(SP) MOVL $1, 0(SP)
CALL runtime·exit(SB) CALL runtime·exit(SB)
INT $3 CALL runtime·abort(SB)
has_cpuid: has_cpuid:
MOVL $0, AX MOVL $0, AX
...@@ -306,7 +306,7 @@ ok: ...@@ -306,7 +306,7 @@ ok:
// start this M // start this M
CALL runtime·mstart(SB) CALL runtime·mstart(SB)
INT $3 CALL runtime·abort(SB)
RET RET
DATA bad_proc_msg<>+0x00(SB)/8, $"This pro" DATA bad_proc_msg<>+0x00(SB)/8, $"This pro"
...@@ -500,14 +500,14 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0 ...@@ -500,14 +500,14 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0
CMPL g(CX), SI CMPL g(CX), SI
JNE 3(PC) JNE 3(PC)
CALL runtime·badmorestackg0(SB) CALL runtime·badmorestackg0(SB)
INT $3 CALL runtime·abort(SB)
// Cannot grow signal stack. // Cannot grow signal stack.
MOVL m_gsignal(BX), SI MOVL m_gsignal(BX), SI
CMPL g(CX), SI CMPL g(CX), SI
JNE 3(PC) JNE 3(PC)
CALL runtime·badmorestackgsignal(SB) CALL runtime·badmorestackgsignal(SB)
INT $3 CALL runtime·abort(SB)
// Called from f. // Called from f.
// Set m->morebuf to f's caller. // Set m->morebuf to f's caller.
...@@ -534,7 +534,7 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0 ...@@ -534,7 +534,7 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0
MOVL -4(AX), BX // fault if CALL would, before smashing SP MOVL -4(AX), BX // fault if CALL would, before smashing SP
MOVL AX, SP MOVL AX, SP
CALL runtime·newstack(SB) CALL runtime·newstack(SB)
MOVL $0, 0x1003 // crash if newstack returns CALL runtime·abort(SB) // crash if newstack returns
RET RET
TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0-0 TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0-0
...@@ -907,16 +907,21 @@ TEXT setg_gcc<>(SB), NOSPLIT, $0 ...@@ -907,16 +907,21 @@ TEXT setg_gcc<>(SB), NOSPLIT, $0
MOVL DX, g(AX) MOVL DX, g(AX)
RET RET
TEXT runtime·abort(SB),NOSPLIT,$0-0
INT $3
loop:
JMP loop
// check that SP is in range [g->stack.lo, g->stack.hi) // check that SP is in range [g->stack.lo, g->stack.hi)
TEXT runtime·stackcheck(SB), NOSPLIT, $0-0 TEXT runtime·stackcheck(SB), NOSPLIT, $0-0
get_tls(CX) get_tls(CX)
MOVL g(CX), AX MOVL g(CX), AX
CMPL (g_stack+stack_hi)(AX), SP CMPL (g_stack+stack_hi)(AX), SP
JHI 2(PC) JHI 2(PC)
INT $3 CALL runtime·abort(SB)
CMPL SP, (g_stack+stack_lo)(AX) CMPL SP, (g_stack+stack_lo)(AX)
JHI 2(PC) JHI 2(PC)
INT $3 CALL runtime·abort(SB)
RET RET
// func cputicks() int64 // func cputicks() int64
......
...@@ -227,7 +227,7 @@ needtls: ...@@ -227,7 +227,7 @@ needtls:
MOVQ runtime·m0+m_tls(SB), AX MOVQ runtime·m0+m_tls(SB), AX
CMPQ AX, $0x123 CMPQ AX, $0x123
JEQ 2(PC) JEQ 2(PC)
MOVL AX, 0 // abort CALL runtime·abort(SB)
ok: ok:
// set the per-goroutine and per-mach "registers" // set the per-goroutine and per-mach "registers"
get_tls(BX) get_tls(BX)
...@@ -262,7 +262,7 @@ ok: ...@@ -262,7 +262,7 @@ ok:
// start this M // start this M
CALL runtime·mstart(SB) CALL runtime·mstart(SB)
MOVL $0xf1, 0xf1 // crash CALL runtime·abort(SB) // mstart should never return
RET RET
DATA runtime·mainPC+0(SB)/8,$runtime·main(SB) DATA runtime·mainPC+0(SB)/8,$runtime·main(SB)
...@@ -446,14 +446,14 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0 ...@@ -446,14 +446,14 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0
CMPQ g(CX), SI CMPQ g(CX), SI
JNE 3(PC) JNE 3(PC)
CALL runtime·badmorestackg0(SB) CALL runtime·badmorestackg0(SB)
INT $3 CALL runtime·abort(SB)
// Cannot grow signal stack (m->gsignal). // Cannot grow signal stack (m->gsignal).
MOVQ m_gsignal(BX), SI MOVQ m_gsignal(BX), SI
CMPQ g(CX), SI CMPQ g(CX), SI
JNE 3(PC) JNE 3(PC)
CALL runtime·badmorestackgsignal(SB) CALL runtime·badmorestackgsignal(SB)
INT $3 CALL runtime·abort(SB)
// Called from f. // Called from f.
// Set m->morebuf to f's caller. // Set m->morebuf to f's caller.
...@@ -479,7 +479,7 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0 ...@@ -479,7 +479,7 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0
MOVQ BX, g(CX) MOVQ BX, g(CX)
MOVQ (g_sched+gobuf_sp)(BX), SP MOVQ (g_sched+gobuf_sp)(BX), SP
CALL runtime·newstack(SB) CALL runtime·newstack(SB)
MOVQ $0, 0x1003 // crash if newstack returns CALL runtime·abort(SB) // crash if newstack returns
RET RET
// morestack but not preserving ctxt. // morestack but not preserving ctxt.
...@@ -886,16 +886,21 @@ TEXT setg_gcc<>(SB),NOSPLIT,$0 ...@@ -886,16 +886,21 @@ TEXT setg_gcc<>(SB),NOSPLIT,$0
MOVQ DI, g(AX) MOVQ DI, g(AX)
RET RET
TEXT runtime·abort(SB),NOSPLIT,$0-0
INT $3
loop:
JMP loop
// check that SP is in range [g->stack.lo, g->stack.hi) // check that SP is in range [g->stack.lo, g->stack.hi)
TEXT runtime·stackcheck(SB), NOSPLIT, $0-0 TEXT runtime·stackcheck(SB), NOSPLIT, $0-0
get_tls(CX) get_tls(CX)
MOVQ g(CX), AX MOVQ g(CX), AX
CMPQ (g_stack+stack_hi)(AX), SP CMPQ (g_stack+stack_hi)(AX), SP
JHI 2(PC) JHI 2(PC)
INT $3 CALL runtime·abort(SB)
CMPQ SP, (g_stack+stack_lo)(AX) CMPQ SP, (g_stack+stack_lo)(AX)
JHI 2(PC) JHI 2(PC)
INT $3 CALL runtime·abort(SB)
RET RET
// func cputicks() int64 // func cputicks() int64
......
...@@ -124,7 +124,7 @@ needtls: ...@@ -124,7 +124,7 @@ needtls:
MOVQ runtime·m0+m_tls(SB), AX MOVQ runtime·m0+m_tls(SB), AX
CMPQ AX, $0x123 CMPQ AX, $0x123
JEQ 2(PC) JEQ 2(PC)
MOVL AX, 0 // abort CALL runtime·abort(SB)
ok: ok:
// set the per-goroutine and per-mach "registers" // set the per-goroutine and per-mach "registers"
get_tls(BX) get_tls(BX)
...@@ -534,6 +534,11 @@ TEXT runtime·setg(SB), NOSPLIT, $0-4 ...@@ -534,6 +534,11 @@ TEXT runtime·setg(SB), NOSPLIT, $0-4
MOVL 0, AX MOVL 0, AX
RET RET
TEXT runtime·abort(SB),NOSPLIT,$0-0
INT $3
loop:
JMP loop
// check that SP is in range [g->stack.lo, g->stack.hi) // check that SP is in range [g->stack.lo, g->stack.hi)
TEXT runtime·stackcheck(SB), NOSPLIT, $0-0 TEXT runtime·stackcheck(SB), NOSPLIT, $0-0
get_tls(CX) get_tls(CX)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment