Subversion Repositories Kolibri OS

Rev

Rev 419 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 419 Rev 420
Line 133... Line 133...
133
	shr	ecx, 2
133
	shr	ecx, 2
134
	rep	movsd
134
	rep	movsd
135
	jmp	.ret
135
	jmp	.ret
136
.ring0:
136
.ring0:
137
; note that following code assumes that all interrupt/exception handlers
137
; note that following code assumes that all interrupt/exception handlers
138
; saves ring-3 context by push ds es, pushad in this order
138
; saves ring-3 context by pushad in this order
139
        mov     esi, [eax+TSS._esp0]
139
        mov     esi, [eax+TSS._esp0]
140
; top of ring0 stack: ring3 stack ptr (ss+esp), iret data (cs+eip+eflags), ds, es, pushad
140
; top of ring0 stack: ring3 stack ptr (ss+esp), iret data (cs+eip+eflags), pushad
141
	sub	esi, 8+12+8+20h
141
        sub     esi, 8+12+20h
142
	lodsd
142
        lodsd                     ;edi
143
	mov	[edi+24h], eax
143
	mov	[edi+24h], eax
144
	lodsd
144
        lodsd                     ;esi
145
	mov	[edi+20h], eax
145
	mov	[edi+20h], eax
146
	lodsd
146
        lodsd                     ; ebp
147
	mov	[edi+1Ch], eax
147
	mov	[edi+1Ch], eax
148
	lodsd
148
        lodsd                     ;esp
149
	lodsd
149
        lodsd                     ;ebx
150
	mov	[edi+14h], eax
150
	mov	[edi+14h], eax
151
	lodsd
151
        lodsd                     ;edx
152
	mov	[edi+10h], eax
152
	mov	[edi+10h], eax
153
	lodsd
153
        lodsd                     ;ecx
154
	mov	[edi+0Ch], eax
154
	mov	[edi+0Ch], eax
155
	lodsd
155
        lodsd                     ;eax
156
	mov	[edi+8], eax
156
	mov	[edi+8], eax
157
	add	esi, 8
157
;;;        add     esi, 8         ;ds es
158
	lodsd
158
        lodsd                     ;eip
159
	mov	[edi], eax
159
	mov	[edi], eax
160
	lodsd
160
        lodsd                     ;cs
161
	lodsd
161
        lodsd                     ;eflags
162
	mov	[edi+4], eax
162
	mov	[edi+4], eax
163
	lodsd
163
        lodsd                     ;esp
164
	mov	[edi+18h], eax
164
	mov	[edi+18h], eax
165
.ret:
165
.ret:
166
	sti
166
	sti
167
	ret
167
	ret
Line 192... Line 192...
192
	shr	ecx, 2
192
	shr	ecx, 2
193
	rep	movsd
193
	rep	movsd
194
	jmp	.stiret
194
	jmp	.stiret
195
.ring0:
195
.ring0:
196
        mov     edi, [eax+TSS._esp0]
196
        mov     edi, [eax+TSS._esp0]
197
	sub	edi, 8+12+8+20h
197
        sub     edi, 8+12+20h
198
	mov	eax, [esi+24h]
198
        mov     eax, [esi+24h]    ;edi
199
	stosd
199
	stosd
200
	mov	eax, [esi+20h]
200
        mov     eax, [esi+20h]    ;esi
201
	stosd
201
	stosd
202
	mov	eax, [esi+1Ch]
202
        mov     eax, [esi+1Ch]    ;ebp
203
	stosd
203
	stosd
204
	scasd
204
        scasd
205
	mov	eax, [esi+14h]
205
        mov     eax, [esi+14h]    ;ebx
206
	stosd
206
	stosd
207
	mov	eax, [esi+10h]
207
        mov     eax, [esi+10h]    ;edx
208
	stosd
208
	stosd
209
	mov	eax, [esi+0Ch]
209
        mov     eax, [esi+0Ch]    ;ecx
210
	stosd
210
	stosd
211
	mov	eax, [esi+8]
211
        mov     eax, [esi+8]      ;eax
212
	stosd
212
	stosd
213
	add	edi, 8
213
;;;        add     edi, 8         ;ds es
214
	mov	eax, [esi]
214
        mov     eax, [esi]        ;eip
215
	stosd
215
	stosd
216
	scasd
216
	scasd
217
	mov	eax, [esi+4]
217
        mov     eax, [esi+4]      ;eflags
218
	stosd
218
	stosd
219
	mov	eax, [esi+18h]
219
        mov     eax, [esi+18h]    ;esp
220
	stosd
220
	stosd
221
.stiret:
221
.stiret:
222
	sti
222
	sti
223
.ret:
223
.ret:
224
	ret
224
	ret
Line 420... Line 420...
420
 
420
 
421
debug_exc:
421
debug_exc:
422
; int 1 = #DB
422
; int 1 = #DB
423
	save_ring3_context
423
	save_ring3_context
424
	cld
424
	cld
425
	mov	ax, os_data
425
        mov     ax, app_data ;os_data
426
	mov	ds, ax
426
	mov	ds, ax
427
	mov	es, ax
427
	mov	es, ax
428
	mov	eax, dr6
428
	mov	eax, dr6
429
	test	ax, ax
429
	test	ax, ax
Line 458... Line 458...
458
        mov     eax, [SLOT_BASE+eax+APPDATA.debugger_slot]
458
        mov     eax, [SLOT_BASE+eax+APPDATA.debugger_slot]
459
	test	eax, eax
459
	test	eax, eax
460
	jnz	.debug
460
	jnz	.debug
461
	sti
461
	sti
462
; not debuggee => say error and terminate
462
; not debuggee => say error and terminate
463
	add	esp, 28h+4
463
        add     esp, 0x20+4
464
	mov	[error_interrupt], 1
464
	mov	[error_interrupt], 1
465
	call	show_error_parameters
465
	call	show_error_parameters
466
        mov     edx, [TASK_BASE]
466
        mov     edx, [TASK_BASE]
467
	mov	byte [edx+TASKDATA.state], 4
467
	mov	byte [edx+TASKDATA.state], 4
468
	jmp	change_task
468
	jmp	change_task