Rev 2465 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2465 | Rev 5201 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line 7... | ||
7 | 7 | ||
Line 8... | Line 8... | ||
8 | $Revision: 2465 $ |
8 | $Revision: 5201 $ |
9 | 9 | ||
10 | 10 | ||
Line 134... | Line 134... | ||
134 | debug_getcontext: |
134 | debug_getcontext: |
135 | ; in: |
135 | ; in: |
136 | ; ecx=pid |
136 | ; ecx=pid |
137 | ; edx=sizeof(CONTEXT) |
137 | ; edx=sizeof(CONTEXT) |
138 | ; esi->CONTEXT |
138 | ; esi->CONTEXT |
139 | ; destroys eax,ecx,edx,esi,edi |
139 | ; destroys eax,ebx,ecx,edx,esi,edi |
- | 140 | ||
- | 141 | xor ebx, ebx ; 0 - get only gp regs |
|
140 | cmp edx, 28h |
142 | cmp edx, 40 |
- | 143 | je .std_ctx |
|
- | 144 | ||
- | 145 | cmp edx, 48+288 |
|
141 | jnz .ret |
146 | jne .ret |
- | 147 | ||
- | 148 | inc ebx ; 1 - get sse context |
|
- | 149 | ; TODO legacy 32-bit FPU/MMX context |
|
- | 150 | .std_ctx: |
|
142 | ; push ecx |
151 | ; push ecx |
143 | ; mov ecx, esi |
152 | ; mov ecx, esi |
144 | call check_region |
153 | call check_region |
145 | ; pop ecx |
154 | ; pop ecx |
146 | dec eax |
155 | dec eax |
147 | jnz .ret |
156 | jnz .ret |
148 | call get_debuggee_slot |
157 | call get_debuggee_slot |
149 | jc .ret |
158 | jc .ret |
- | 159 | ||
- | 160 | shr eax, 5 |
|
- | 161 | cmp eax, [fpu_owner] |
|
- | 162 | jne @f |
|
- | 163 | inc bh ; set swap context flag |
|
- | 164 | @@: |
|
- | 165 | shl eax, 8 |
|
150 | mov edi, esi |
166 | mov edi, esi |
151 | mov eax, [eax*8+SLOT_BASE+APPDATA.pl0_stack] |
167 | mov eax, [eax+SLOT_BASE+APPDATA.pl0_stack] |
152 | lea esi, [eax+RING0_STACK_SIZE] |
168 | lea esi, [eax+RING0_STACK_SIZE] |
Line 153... | Line 169... | ||
153 | 169 | ||
154 | .ring0: |
170 | .ring0: |
155 | ; note that following code assumes that all interrupt/exception handlers |
171 | ; note that following code assumes that all interrupt/exception handlers |
Line 176... | Line 192... | ||
176 | lodsd ;cs |
192 | lodsd ;cs |
177 | lodsd ;eflags |
193 | lodsd ;eflags |
178 | mov [edi+4], eax |
194 | mov [edi+4], eax |
179 | lodsd ;esp |
195 | lodsd ;esp |
180 | mov [edi+18h], eax |
196 | mov [edi+18h], eax |
- | 197 | ||
- | 198 | dec bl |
|
- | 199 | js .ret |
|
- | 200 | dec bl |
|
- | 201 | jns .ret |
|
- | 202 | ||
- | 203 | test bh, bh ; check swap flag |
|
- | 204 | jz @F |
|
- | 205 | ||
- | 206 | ffree st0 ; swap context |
|
- | 207 | @@: |
|
- | 208 | ||
- | 209 | add esi, 4 ;top of ring0 stack |
|
- | 210 | ;fpu/sse context saved here |
|
- | 211 | add edi, 40 |
|
- | 212 | mov eax, 1 ;sse context |
|
- | 213 | stosd |
|
- | 214 | xor eax, eax ;reserved dword |
|
- | 215 | stosd |
|
- | 216 | ||
- | 217 | mov ecx, 288/4 |
|
- | 218 | rep movsd ;copy sse context |
|
- | 219 | ||
181 | .ret: |
220 | .ret: |
182 | sti |
221 | sti |
183 | ret |
222 | ret |
Line 184... | Line 223... | ||
184 | 223 |