]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove unused badsignal2 on windows
authorqmuntal <quimmuntal@gmail.com>
Mon, 23 Jan 2023 11:59:29 +0000 (12:59 +0100)
committerQuim Muntal <quimmuntal@gmail.com>
Tue, 24 Jan 2023 12:56:06 +0000 (12:56 +0000)
This CL removes badsignal2 function, as it is unused on Windows.

badsignal2 was originally intended to abort the process when
an exception was raised on a non-Go thread, following the same approach
as Linux and others.

Since it was added, back on https://golang.org/cl/5797068, it has caused
several issues on Windows, see #8224 and #50877. That's because we can't
know wether the signal is bad or not, as our trap might not be at the
end of the exception handler chain.

To fix those issues, https://golang.org/cl/104200046 and CL 442896
stopped calling badsignal2, and CL 458135 removed one last incorrect
call on amd64 and 386.

Change-Id: I5bd31ee2672118ae0f1a2c8b46a1bb0f4893a011
Reviewed-on: https://go-review.googlesource.com/c/go/+/463116
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/runtime/os_windows.go
src/runtime/signal_windows.go
src/runtime/sys_windows_386.s
src/runtime/sys_windows_amd64.s
src/runtime/sys_windows_arm.s
src/runtime/sys_windows_arm64.s

index 44718f1d21459e164f4dcf7f3592160ef9d81059..60741f321ffb65730509c64921b4e5a8c3a1dc25 100644 (file)
@@ -546,8 +546,6 @@ func initLongPathSupport() {
 func osinit() {
        asmstdcallAddr = unsafe.Pointer(abi.FuncPCABI0(asmstdcall))
 
-       setBadSignalMsg()
-
        loadOptionalSyscalls()
 
        disableWER()
index 0686be4635adc6354e6269e981d8cdaf5a53996c..1ea0d1e06c470d02c0791f0a04ed178cdc4b8e87 100644 (file)
@@ -375,19 +375,6 @@ func sigpanic() {
        throw("fault")
 }
 
-var (
-       badsignalmsg [100]byte
-       badsignallen int32
-)
-
-func setBadSignalMsg() {
-       const msg = "runtime: signal received on thread not created by Go.\n"
-       for i, c := range msg {
-               badsignalmsg[i] = byte(c)
-               badsignallen++
-       }
-}
-
 // Following are not implemented.
 
 func initsig(preinit bool) {
@@ -402,12 +389,6 @@ func sigdisable(sig uint32) {
 func sigignore(sig uint32) {
 }
 
-func badsignal2()
-
-func raisebadsignal(sig uint32) {
-       badsignal2()
-}
-
 func signame(sig uint32) string {
        return ""
 }
index 0983cc7b1fdf6b7a33601f31b6c0a72fedc96740..d120746bb60c6ccf28bc32e3da193af0976fecef 100644 (file)
@@ -44,28 +44,6 @@ TEXT runtime·asmstdcall(SB),NOSPLIT,$0
 
        RET
 
-TEXT   runtime·badsignal2(SB),NOSPLIT,$24
-       // stderr
-       MOVL    $-12, 0(SP)
-       MOVL    SP, BP
-       CALL    *runtime·_GetStdHandle(SB)
-       MOVL    BP, SP
-
-       MOVL    AX, 0(SP)       // handle
-       MOVL    $runtime·badsignalmsg(SB), DX // pointer
-       MOVL    DX, 4(SP)
-       MOVL    runtime·badsignallen(SB), DX // count
-       MOVL    DX, 8(SP)
-       LEAL    20(SP), DX  // written count
-       MOVL    $0, 0(DX)
-       MOVL    DX, 12(SP)
-       MOVL    $0, 16(SP) // overlapped
-       CALL    *runtime·_WriteFile(SB)
-
-       // Does not return.
-       CALL    runtime·abort(SB)
-       RET
-
 // faster get/set last error
 TEXT runtime·getlasterror(SB),NOSPLIT,$0
        MOVL    0x34(FS), AX
index 04e649539c7fef5be6784bd087a5d321e0c04776..7cab08efa6f8755e296a42a40703dc2c9ae16633 100644 (file)
@@ -75,30 +75,6 @@ loadregs:
 
        RET
 
-TEXT runtime·badsignal2(SB),NOSPLIT|NOFRAME,$48
-       // stderr
-       MOVQ    $-12, CX // stderr
-       MOVQ    CX, 0(SP)
-       MOVQ    runtime·_GetStdHandle(SB), AX
-       CALL    AX
-
-       MOVQ    AX, CX  // handle
-       MOVQ    CX, 0(SP)
-       MOVQ    $runtime·badsignalmsg(SB), DX // pointer
-       MOVQ    DX, 8(SP)
-       MOVL    $runtime·badsignallen(SB), R8 // count
-       MOVQ    R8, 16(SP)
-       LEAQ    40(SP), R9  // written count
-       MOVQ    $0, 0(R9)
-       MOVQ    R9, 24(SP)
-       MOVQ    $0, 32(SP)      // overlapped
-       MOVQ    runtime·_WriteFile(SB), AX
-       CALL    AX
-
-       // Does not return.
-       CALL    runtime·abort(SB)
-       RET
-
 // faster get/set last error
 TEXT runtime·getlasterror(SB),NOSPLIT,$0
        MOVQ    0x30(GS), AX
index a00fd166705b14e50f016c2eadcb8cc5e4ce4a58..78cc3333c7bcf916e2b0a7dcdeaf181be68dc954 100644 (file)
@@ -76,30 +76,6 @@ loadregs:
 
        MOVM.IA.W (R13), [R4, R5, R15]
 
-TEXT runtime·badsignal2(SB),NOSPLIT|NOFRAME,$0
-       MOVM.DB.W [R4, R14], (R13)      // push {r4, lr}
-       MOVW    R13, R4                 // save original stack pointer
-       SUB     $8, R13                 // space for 2 variables
-       BIC     $0x7, R13               // alignment for ABI
-
-       // stderr
-       MOVW    runtime·_GetStdHandle(SB), R1
-       MOVW    $-12, R0
-       BL      (R1)
-
-       MOVW    $runtime·badsignalmsg(SB), R1  // lpBuffer
-       MOVW    $runtime·badsignallen(SB), R2  // lpNumberOfBytesToWrite
-       MOVW    (R2), R2
-       ADD     $0x4, R13, R3           // lpNumberOfBytesWritten
-       MOVW    $0, R12                 // lpOverlapped
-       MOVW    R12, (R13)
-
-       MOVW    runtime·_WriteFile(SB), R12
-       BL      (R12)
-
-       // Does not return.
-       B       runtime·abort(SB)
-
 TEXT runtime·getlasterror(SB),NOSPLIT,$0
        MRC     15, 0, R0, C13, C0, 2
        MOVW    0x34(R0), R0
index 67fe21b2d09487a6aa91fab7d20fc22e13843eda..ab6944c9eaed1a1c463d1848eb4584130e6ebda7 100644 (file)
@@ -99,32 +99,6 @@ _0args:
        LDP.P   32(RSP), (R29, R30)
        RET
 
-TEXT runtime·badsignal2(SB),NOSPLIT,$16-0
-       NO_LOCAL_POINTERS
-
-       // stderr
-       MOVD    runtime·_GetStdHandle(SB), R1
-       MOVD    $-12, R0
-       SUB     $16, RSP        // skip over saved frame pointer below RSP
-       BL      (R1)
-       ADD     $16, RSP
-
-       // handle in R0 already
-       MOVD    $runtime·badsignalmsg(SB), R1  // lpBuffer
-       MOVD    $runtime·badsignallen(SB), R2  // lpNumberOfBytesToWrite
-       MOVD    (R2), R2
-       // point R3 to stack local that will receive number of bytes written
-       ADD     $16, RSP, R3            // lpNumberOfBytesWritten
-       MOVD    $0, R4                  // lpOverlapped
-       MOVD    runtime·_WriteFile(SB), R12
-       SUB     $16, RSP        // skip over saved frame pointer below RSP
-       BL      (R12)
-
-       // Does not return.
-       B       runtime·abort(SB)
-
-       RET
-
 TEXT runtime·getlasterror(SB),NOSPLIT|NOFRAME,$0
        MOVD    TEB_error(R18_PLATFORM), R0
        MOVD    R0, ret+0(FP)