OLD | NEW |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include "zasm_GOOS_GOARCH.h" | 5 #include "zasm_GOOS_GOARCH.h" |
6 #include "../../cmd/ld/textflag.h" | 6 #include "../../cmd/ld/textflag.h" |
7 | 7 |
8 // maxargs should be divisible by 2, as Windows stack | 8 // maxargs should be divisible by 2, as Windows stack |
9 // must be kept 16-byte aligned on syscall entry. | 9 // must be kept 16-byte aligned on syscall entry. |
10 #define maxargs 16 | 10 #define maxargs 16 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // Called by Windows as a Vectored Exception Handler (VEH). | 99 // Called by Windows as a Vectored Exception Handler (VEH). |
100 // First argument is pointer to struct containing | 100 // First argument is pointer to struct containing |
101 // exception record and context pointers. | 101 // exception record and context pointers. |
102 // Return 0 for 'not handled', -1 for handled. | 102 // Return 0 for 'not handled', -1 for handled. |
103 TEXT runtime·sigtramp(SB),NOSPLIT,$0-0 | 103 TEXT runtime·sigtramp(SB),NOSPLIT,$0-0 |
104 // CX: PEXCEPTION_POINTERS ExceptionInfo | 104 // CX: PEXCEPTION_POINTERS ExceptionInfo |
105 | 105 |
106 // DI SI BP BX R12 R13 R14 R15 registers and DF flag are preserved | 106 // DI SI BP BX R12 R13 R14 R15 registers and DF flag are preserved |
107 // as required by windows callback convention. | 107 // as required by windows callback convention. |
108 PUSHFQ | 108 PUSHFQ |
109 » SUBQ» $88, SP | 109 » SUBQ» $96, SP |
110 MOVQ DI, 80(SP) | 110 MOVQ DI, 80(SP) |
111 MOVQ SI, 72(SP) | 111 MOVQ SI, 72(SP) |
112 MOVQ BP, 64(SP) | 112 MOVQ BP, 64(SP) |
113 MOVQ BX, 56(SP) | 113 MOVQ BX, 56(SP) |
114 MOVQ R12, 48(SP) | 114 MOVQ R12, 48(SP) |
115 MOVQ R13, 40(SP) | 115 MOVQ R13, 40(SP) |
116 MOVQ R14, 32(SP) | 116 MOVQ R14, 32(SP) |
117 » MOVQ» R15, 24(SP) | 117 » MOVQ» R15, 88(SP) |
118 | 118 |
119 MOVQ 0(CX), BX // ExceptionRecord* | 119 MOVQ 0(CX), BX // ExceptionRecord* |
120 MOVQ 8(CX), CX // Context* | 120 MOVQ 8(CX), CX // Context* |
121 | 121 |
122 // fetch g | 122 // fetch g |
123 get_tls(DX) | 123 get_tls(DX) |
124 CMPQ DX, $0 | 124 CMPQ DX, $0 |
125 JNE 3(PC) | 125 JNE 3(PC) |
126 MOVQ $0, AX // continue | 126 MOVQ $0, AX // continue |
127 JMP done | 127 JMP done |
128 MOVQ g(DX), DX | 128 MOVQ g(DX), DX |
129 CMPQ DX, $0 | 129 CMPQ DX, $0 |
130 JNE 2(PC) | 130 JNE 2(PC) |
131 CALL runtime·badsignal2(SB) | 131 CALL runtime·badsignal2(SB) |
132 // call sighandler(ExceptionRecord*, Context*, G*) | 132 // call sighandler(ExceptionRecord*, Context*, G*) |
133 MOVQ BX, 0(SP) | 133 MOVQ BX, 0(SP) |
134 MOVQ CX, 8(SP) | 134 MOVQ CX, 8(SP) |
135 MOVQ DX, 16(SP) | 135 MOVQ DX, 16(SP) |
136 CALL runtime·sighandler(SB) | 136 CALL runtime·sighandler(SB) |
137 // AX is set to report result back to Windows | 137 // AX is set to report result back to Windows |
| 138 MOVL 24(SP), AX |
138 | 139 |
139 done: | 140 done: |
140 // restore registers as required for windows callback | 141 // restore registers as required for windows callback |
141 » MOVQ» 24(SP), R15 | 142 » MOVQ» 88(SP), R15 |
142 MOVQ 32(SP), R14 | 143 MOVQ 32(SP), R14 |
143 MOVQ 40(SP), R13 | 144 MOVQ 40(SP), R13 |
144 MOVQ 48(SP), R12 | 145 MOVQ 48(SP), R12 |
145 MOVQ 56(SP), BX | 146 MOVQ 56(SP), BX |
146 MOVQ 64(SP), BP | 147 MOVQ 64(SP), BP |
147 MOVQ 72(SP), SI | 148 MOVQ 72(SP), SI |
148 MOVQ 80(SP), DI | 149 MOVQ 80(SP), DI |
149 » ADDQ» $88, SP | 150 » ADDQ» $96, SP |
150 POPFQ | 151 POPFQ |
151 | 152 |
152 RET | 153 RET |
153 | 154 |
154 TEXT runtime·ctrlhandler(SB),NOSPLIT,$8 | 155 TEXT runtime·ctrlhandler(SB),NOSPLIT,$8 |
155 MOVQ CX, 16(SP) // spill | 156 MOVQ CX, 16(SP) // spill |
156 MOVQ $runtime·ctrlhandler1(SB), CX | 157 MOVQ $runtime·ctrlhandler1(SB), CX |
157 MOVQ CX, 0(SP) | 158 MOVQ CX, 0(SP) |
158 CALL runtime·externalthreadhandler(SB) | 159 CALL runtime·externalthreadhandler(SB) |
159 RET | 160 RET |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 // Want negative 100ns units. | 377 // Want negative 100ns units. |
377 NEGQ BX | 378 NEGQ BX |
378 MOVQ SP, R8 // ptime | 379 MOVQ SP, R8 // ptime |
379 MOVQ BX, (R8) | 380 MOVQ BX, (R8) |
380 MOVQ $-1, CX // handle | 381 MOVQ $-1, CX // handle |
381 MOVQ $0, DX // alertable | 382 MOVQ $0, DX // alertable |
382 MOVQ runtime·NtWaitForSingleObject(SB), AX | 383 MOVQ runtime·NtWaitForSingleObject(SB), AX |
383 CALL AX | 384 CALL AX |
384 MOVQ 8(SP), SP | 385 MOVQ 8(SP), SP |
385 RET | 386 RET |
OLD | NEW |