2007-03-26 14:18:08 +02:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; ;;
|
2008-02-04 16:31:59 +01:00
|
|
|
|
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
|
2007-03-26 14:18:08 +02:00
|
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; MenuetOS process management, protected ring3 ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; Distributed under GPL. See file COPYING for details. ;;
|
|
|
|
|
;; Copyright 2003 Ville Turjanmaa ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-07-27 15:52:03 +02:00
|
|
|
|
$Revision$
|
|
|
|
|
|
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
align 4 ;3A08
|
2005-10-06 19:56:22 +02:00
|
|
|
|
build_interrupt_table:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov edi, idts
|
|
|
|
|
mov esi, sys_int
|
|
|
|
|
mov ecx, 0x40
|
|
|
|
|
mov eax, (10001110b shl 24) + os_code
|
|
|
|
|
@@: movsw ;low word of code-entry
|
|
|
|
|
stosd ;interrupt gate type : os_code selector
|
|
|
|
|
movsw ;high word of code-entry
|
|
|
|
|
loop @b
|
|
|
|
|
movsd ;copy low dword of trap gate for int 0x40
|
|
|
|
|
movsd ;copy high dword of trap gate for int 0x40
|
|
|
|
|
lidt [esi]
|
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
iglobal
|
2009-04-04 21:58:42 +02:00
|
|
|
|
align 4
|
2005-10-06 19:56:22 +02:00
|
|
|
|
sys_int:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
;exception handlers addresses (for interrupt gate construction)
|
|
|
|
|
dd e0,e1,e2,e3,e4,e5,e6,except_7
|
|
|
|
|
dd e8,e9,e10,e11,e12,e13,page_fault_exc,e15
|
|
|
|
|
dd e16, e17,e18, e19
|
|
|
|
|
times 12 dd unknown_interrupt ;int_20..int_31
|
|
|
|
|
|
|
|
|
|
;interrupt handlers addresses (for interrupt gate construction)
|
|
|
|
|
dd irq0, irq_serv.irq_1, irq_serv.irq_2
|
|
|
|
|
if USE_COM_IRQ
|
|
|
|
|
dd irq_serv.irq_3, irq_serv.irq_4
|
|
|
|
|
else
|
|
|
|
|
dd p_irq3, p_irq4 ;??? <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
end if
|
|
|
|
|
dd irq_serv.irq_5, p_irq6, irq_serv.irq_7
|
|
|
|
|
dd irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10
|
|
|
|
|
dd irq_serv.irq_11, irq_serv.irq_12, irqD,p_irq14,p_irq15
|
|
|
|
|
times 16 dd unknown_interrupt ;int_0x30..int_0x3F
|
|
|
|
|
|
|
|
|
|
;int_0x40 gate trap (for directly copied)
|
|
|
|
|
dw i40 and 0xFFFF, os_code, 11101111b shl 8, i40 shr 16
|
|
|
|
|
|
|
|
|
|
idtreg: ; data for LIDT instruction (must be immediately below sys_int data)
|
|
|
|
|
dw 2*($-sys_int-4)-1
|
|
|
|
|
dd idts ;0x8000B100
|
|
|
|
|
dw 0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
msg_fault_sel dd msg_exc_8,msg_exc_u,msg_exc_a,msg_exc_b
|
|
|
|
|
dd msg_exc_c,msg_exc_d,msg_exc_e
|
|
|
|
|
|
|
|
|
|
msg_exc_8 db "Double fault", 0
|
|
|
|
|
msg_exc_u db "Undefined Exception", 0
|
|
|
|
|
msg_exc_a db "Invalid TSS", 0
|
|
|
|
|
msg_exc_b db "Segment not present", 0
|
|
|
|
|
msg_exc_c db "Stack fault", 0
|
|
|
|
|
msg_exc_d db "General protection fault", 0
|
|
|
|
|
msg_exc_e db "Page fault", 0
|
|
|
|
|
|
|
|
|
|
msg_sel_ker db "kernel", 0
|
|
|
|
|
msg_sel_app db "application", 0
|
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
endg
|
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
macro save_ring3_context {
|
|
|
|
|
pushad
|
2006-01-25 14:19:21 +01:00
|
|
|
|
}
|
2009-04-04 21:58:42 +02:00
|
|
|
|
macro restore_ring3_context {
|
|
|
|
|
popad
|
2006-01-25 14:19:21 +01:00
|
|
|
|
}
|
2009-04-04 21:58:42 +02:00
|
|
|
|
macro exc_wo_code [num] {
|
2005-10-16 15:30:23 +02:00
|
|
|
|
e#num :
|
2009-04-04 21:58:42 +02:00
|
|
|
|
save_ring3_context
|
|
|
|
|
mov bl, num
|
|
|
|
|
jmp exc_c
|
|
|
|
|
} exc_wo_code 0,1,2,3,4,5,6,15,16,19
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
macro exc_w_code [num] {
|
2005-11-10 18:59:41 +01:00
|
|
|
|
e#num :
|
2009-04-04 21:58:42 +02:00
|
|
|
|
add esp, 4
|
|
|
|
|
save_ring3_context
|
|
|
|
|
mov bl, num
|
|
|
|
|
jmp exc_c
|
|
|
|
|
} exc_w_code 8,9,10,11,12,13,17,18
|
2005-11-10 18:59:41 +01:00
|
|
|
|
|
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
uglobal
|
|
|
|
|
pf_err_code dd ?
|
|
|
|
|
endg
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
page_fault_exc:
|
|
|
|
|
pop [pf_err_code] ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #PF
|
|
|
|
|
save_ring3_context
|
|
|
|
|
mov bl,14
|
|
|
|
|
exc_c: ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> 3-<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> + pushad (<EFBFBD>.<EFBFBD>., <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
reg_ss equ esp+0x30
|
|
|
|
|
reg_esp3 equ esp+0x2C
|
|
|
|
|
reg_eflags equ esp+0x28
|
|
|
|
|
reg_cs3 equ esp+0x24
|
|
|
|
|
reg_eip equ esp+0x20
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> pushad
|
|
|
|
|
reg_eax equ esp+0x1C
|
|
|
|
|
reg_ecx equ esp+0x18
|
|
|
|
|
reg_edx equ esp+0x14
|
|
|
|
|
reg_ebx equ esp+0x10
|
|
|
|
|
reg_esp0 equ esp+0x0C
|
|
|
|
|
reg_ebp equ esp+0x08
|
|
|
|
|
reg_esi equ esp+0x04
|
|
|
|
|
reg_edi equ esp+0x00
|
|
|
|
|
|
|
|
|
|
Mov ds,ax,app_data ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov es,ax ; <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
cld ; <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DF <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2008-02-04 16:31:59 +01:00
|
|
|
|
; redirect to V86 manager? (EFLAGS & 0x20000) != 0?
|
2009-04-04 21:58:42 +02:00
|
|
|
|
test byte[reg_eflags+2],2
|
|
|
|
|
jnz v86_exc_c
|
|
|
|
|
cmp bl,14 ; #PF
|
|
|
|
|
jne .l0
|
|
|
|
|
call page_fault_handler
|
|
|
|
|
.l0: mov esi, [current_slot]
|
|
|
|
|
mov eax,[esi+APPDATA.fpu_handler]
|
|
|
|
|
cmp bl,16 ; #MF
|
|
|
|
|
je .l1
|
|
|
|
|
cmp bl,19 ; #XF
|
|
|
|
|
jne .l2
|
|
|
|
|
mov eax,[esi+APPDATA.sse_handler]
|
|
|
|
|
.l1: test eax, eax
|
|
|
|
|
jnz IRetToUserHook
|
|
|
|
|
.l2: cli
|
|
|
|
|
mov eax, [esi+APPDATA.debugger_slot]
|
|
|
|
|
test eax, eax
|
|
|
|
|
jnz .debug
|
|
|
|
|
sti
|
2006-01-25 14:19:21 +01:00
|
|
|
|
; not debuggee => say error and terminate
|
2009-04-04 21:58:42 +02:00
|
|
|
|
call show_error_parameters ;; only ONE using, inline ???
|
|
|
|
|
;mov edx, [TASK_BASE]
|
|
|
|
|
mov [edx + TASKDATA.state], byte 4 ; terminate
|
|
|
|
|
jmp change_task ; stack - here it does not matter at all
|
2006-01-25 14:19:21 +01:00
|
|
|
|
.debug:
|
|
|
|
|
; we are debugged process, notify debugger and suspend ourself
|
|
|
|
|
; eax=debugger PID
|
2009-04-04 21:58:42 +02:00
|
|
|
|
cmp bl,1 ; #DB
|
|
|
|
|
je debug_ex
|
|
|
|
|
movzx edx, bl ; debug_message data=Number_Of_Exception
|
|
|
|
|
mov ecx,1 ; debug_message code=other_exception
|
|
|
|
|
jmp debug_ex.notify ; notify debugger and suspend ourself
|
|
|
|
|
|
|
|
|
|
IRetToUserHook:
|
|
|
|
|
xchg eax, [reg_eip]
|
|
|
|
|
sub dword[reg_esp3], 4
|
|
|
|
|
mov edi, [reg_esp3]
|
|
|
|
|
stosd
|
|
|
|
|
restore_ring3_context
|
|
|
|
|
unknown_interrupt:
|
|
|
|
|
iretd
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-10-19 17:42:11 +02:00
|
|
|
|
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
2005-10-06 19:56:22 +02:00
|
|
|
|
show_error_parameters:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov edx,[TASK_BASE] ;not scratched below
|
|
|
|
|
DEBUGF 1, "K : Process - forced terminate PID: %x\n", [edx+TASKDATA.pid]
|
|
|
|
|
cmp bl, 0x08
|
|
|
|
|
jb .l0
|
|
|
|
|
cmp bl, 0x0e
|
|
|
|
|
jbe .l1
|
|
|
|
|
.l0: mov bl, 0x09
|
|
|
|
|
.l1: movzx eax,bl
|
|
|
|
|
mov eax,[msg_fault_sel+eax*4 - 0x08*4]
|
|
|
|
|
DEBUGF 1, "K : %s\n", eax
|
|
|
|
|
mov eax, [reg_cs3+4]
|
|
|
|
|
mov edi, msg_sel_app
|
|
|
|
|
mov ebx, [reg_esp3+4]
|
|
|
|
|
cmp eax, app_code
|
|
|
|
|
je @f
|
|
|
|
|
mov edi, msg_sel_ker
|
|
|
|
|
mov ebx, [reg_esp0+4]
|
|
|
|
|
@@: DEBUGF 1, "K : EAX : %x EBX : %x ECX : %x\n", [reg_eax+4], [reg_ebx+4], [reg_ecx+4]
|
|
|
|
|
DEBUGF 1, "K : EDX : %x ESI : %x EDI : %x\n", [reg_edx+4], [reg_esi+4], [reg_edi+4]
|
|
|
|
|
DEBUGF 1, "K : EBP : %x EIP : %x ESP : %x\n", [reg_ebp+4], [reg_eip+4], ebx
|
|
|
|
|
DEBUGF 1, "K : Flags : %x CS : %x (%s)\n", [reg_eflags+4], eax, edi
|
|
|
|
|
ret
|
2007-10-19 17:42:11 +02:00
|
|
|
|
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
restore reg_ss
|
|
|
|
|
restore reg_esp3
|
|
|
|
|
restore reg_eflags
|
|
|
|
|
restore reg_cs
|
|
|
|
|
restore reg_eip
|
|
|
|
|
restore reg_eax
|
|
|
|
|
restore reg_ecx
|
|
|
|
|
restore reg_edx
|
|
|
|
|
restore reg_ebx
|
|
|
|
|
restore reg_esp0
|
|
|
|
|
restore reg_ebp
|
|
|
|
|
restore reg_esi
|
|
|
|
|
restore reg_edi
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2005-10-13 19:50:36 +02:00
|
|
|
|
; irq1 -> hid/keyboard.inc
|
2009-04-04 21:58:42 +02:00
|
|
|
|
macro irqh [num] {
|
2005-10-16 15:30:23 +02:00
|
|
|
|
p_irq#num :
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov edi, num
|
|
|
|
|
jmp irqhandler
|
2005-10-16 15:30:23 +02:00
|
|
|
|
}
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
2005-10-24 19:14:59 +02:00
|
|
|
|
|
|
|
|
|
p_irq6:
|
2008-12-28 14:29:34 +01:00
|
|
|
|
save_ring3_context
|
|
|
|
|
mov ax, app_data ;os_data
|
|
|
|
|
mov ds, ax
|
|
|
|
|
mov es, ax
|
2008-12-28 15:08:39 +01:00
|
|
|
|
mov edi, 6
|
2008-12-28 14:29:34 +01:00
|
|
|
|
cmp [v86_irqhooks+edi*8], 0
|
|
|
|
|
jnz v86_irq2
|
|
|
|
|
call fdc_irq
|
|
|
|
|
call ready_for_next_irq
|
|
|
|
|
restore_ring3_context
|
|
|
|
|
iret
|
2005-10-28 18:16:47 +02:00
|
|
|
|
|
2005-10-24 19:14:59 +02:00
|
|
|
|
|
2006-09-27 16:58:51 +02:00
|
|
|
|
p_irq14:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
save_ring3_context
|
|
|
|
|
mov ax, app_data ;os_data
|
|
|
|
|
mov ds, ax
|
|
|
|
|
mov es, ax
|
|
|
|
|
mov edi, 14
|
|
|
|
|
cmp [v86_irqhooks+edi*8], 0
|
|
|
|
|
jnz v86_irq2
|
|
|
|
|
; mov byte [BOOT_VAR + 0x48E], 0xFF
|
|
|
|
|
call [irq14_func]
|
|
|
|
|
call ready_for_next_irq_1
|
|
|
|
|
restore_ring3_context
|
|
|
|
|
iret
|
2006-09-27 16:58:51 +02:00
|
|
|
|
p_irq15:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
save_ring3_context
|
|
|
|
|
mov ax, app_data ;os_data
|
|
|
|
|
mov ds, ax
|
|
|
|
|
mov es, ax
|
|
|
|
|
mov edi, 15
|
|
|
|
|
cmp [v86_irqhooks+edi*8], 0
|
|
|
|
|
jnz v86_irq2
|
|
|
|
|
; mov byte [BOOT_VAR + 0x48E], 0xFF
|
|
|
|
|
call [irq15_func]
|
|
|
|
|
call ready_for_next_irq_1
|
|
|
|
|
restore_ring3_context
|
|
|
|
|
iret
|
2006-09-27 16:58:51 +02:00
|
|
|
|
|
2006-01-06 12:46:26 +01:00
|
|
|
|
ready_for_next_irq:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov [check_idle_semaphore],5
|
|
|
|
|
mov al, 0x20
|
|
|
|
|
out 0x20, al
|
|
|
|
|
ret
|
2006-01-06 12:46:26 +01:00
|
|
|
|
|
|
|
|
|
ready_for_next_irq_1:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov [check_idle_semaphore],5
|
|
|
|
|
mov al, 0x20
|
|
|
|
|
out 0xa0,al
|
|
|
|
|
out 0x20, al
|
|
|
|
|
ret
|
2006-01-06 12:46:26 +01:00
|
|
|
|
|
2005-10-13 19:50:36 +02:00
|
|
|
|
irqD:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
push eax
|
|
|
|
|
mov al,0
|
|
|
|
|
out 0xf0,al
|
|
|
|
|
mov al,0x20
|
|
|
|
|
out 0xa0,al
|
|
|
|
|
out 0x20,al
|
|
|
|
|
pop eax
|
|
|
|
|
iret
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
irqh 2,3,4,5,7,8,9,10,11
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
irqhandler:
|
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov esi,edi ; 1
|
|
|
|
|
shl esi,6 ; 1
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add esi,irq00read ; 1
|
2009-04-04 21:58:42 +02:00
|
|
|
|
shl edi,12 ; 1
|
2007-03-01 21:32:19 +01:00
|
|
|
|
add edi,IRQ_SAVE
|
2006-05-05 14:40:02 +02:00
|
|
|
|
mov ecx,16
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
irqnewread:
|
2006-05-05 14:40:02 +02:00
|
|
|
|
dec ecx
|
|
|
|
|
js irqover
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
movzx edx, word [esi] ; 2+
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
test edx, edx ; 1
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jz irqover
|
|
|
|
|
|
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov ebx, [edi] ; address of begin of buffer in edi ; + 0x0 dword - data size
|
|
|
|
|
mov eax, 4000 ; + 0x4 dword - data begin offset
|
2008-02-27 19:05:09 +01:00
|
|
|
|
cmp ebx, eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
je irqfull
|
2009-04-04 21:58:42 +02:00
|
|
|
|
add ebx, [edi + 0x4] ; add data size to data begin offset
|
|
|
|
|
cmp ebx, eax ; if end of buffer, begin cycle again
|
2008-02-27 19:05:09 +01:00
|
|
|
|
jb @f
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2008-02-27 19:05:09 +01:00
|
|
|
|
xor ebx, ebx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2008-02-27 19:05:09 +01:00
|
|
|
|
@@:
|
|
|
|
|
add ebx, edi
|
2009-04-04 21:58:42 +02:00
|
|
|
|
movzx eax, byte[esi + 3] ; get type of data being received 1 - byte, 2 - word
|
2008-02-27 19:05:09 +01:00
|
|
|
|
dec eax
|
|
|
|
|
jz irqbyte
|
|
|
|
|
dec eax
|
|
|
|
|
jnz noirqword
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
in ax,dx
|
2009-04-04 21:58:42 +02:00
|
|
|
|
cmp ebx, 3999 ; check for address odd in the end of buffer
|
2008-02-27 19:05:09 +01:00
|
|
|
|
jne .odd
|
|
|
|
|
mov [ebx + 0x10], ax
|
|
|
|
|
jmp .add_size
|
|
|
|
|
.odd:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov [ebx + 0x10], al ; I could make mistake here :)
|
2008-02-27 19:05:09 +01:00
|
|
|
|
mov [edi + 0x10], ah
|
|
|
|
|
.add_size:
|
|
|
|
|
add dword [edi], 2
|
|
|
|
|
jmp nextport
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
irqbyte:
|
|
|
|
|
in al,dx
|
|
|
|
|
mov [ebx + 0x10],al
|
|
|
|
|
inc dword [edi]
|
|
|
|
|
nextport:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add esi,4
|
|
|
|
|
jmp irqnewread
|
|
|
|
|
|
2008-02-27 19:05:09 +01:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
noirqword:
|
|
|
|
|
irqfull:
|
|
|
|
|
irqover:
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set_application_table_status:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
push eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov eax,[CURRENT_TASK]
|
|
|
|
|
shl eax, 5
|
|
|
|
|
add eax,CURRENT_TASK+TASKDATA.pid
|
|
|
|
|
mov eax,[eax]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov [application_table_status],eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
pop eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clear_application_table_status:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
push eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov eax,[CURRENT_TASK]
|
|
|
|
|
shl eax, 5
|
|
|
|
|
add eax,CURRENT_TASK+TASKDATA.pid
|
|
|
|
|
mov eax,[eax]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
cmp eax,[application_table_status]
|
|
|
|
|
jne apptsl1
|
|
|
|
|
mov [application_table_status],0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
apptsl1:
|
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
pop eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
sys_resize_app_memory:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
; eax = 1 - resize
|
|
|
|
|
; ebx = new amount of memory
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
cmp eax,1
|
|
|
|
|
jne .no_application_mem_resize
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
stdcall new_mem_resize, ebx
|
|
|
|
|
mov [esp+36], eax
|
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2006-10-06 08:09:41 +02:00
|
|
|
|
.no_application_mem_resize:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
sys_threads:
|
|
|
|
|
|
|
|
|
|
; eax=1 create thread
|
|
|
|
|
;
|
|
|
|
|
; ebx=thread start
|
|
|
|
|
; ecx=thread stack value
|
|
|
|
|
;
|
|
|
|
|
; on return : eax = pid
|
|
|
|
|
jmp new_sys_threads
|
|
|
|
|
|
|
|
|
|
iglobal
|
2009-04-04 21:58:42 +02:00
|
|
|
|
; process_terminating db 'K : Process - terminating',13,10,0
|
|
|
|
|
; process_terminated db 'K : Process - done',13,10,0
|
|
|
|
|
msg_obj_destroy db 'K : destroy app object',13,10,0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
endg
|
|
|
|
|
|
2007-02-08 08:15:14 +01:00
|
|
|
|
; param
|
|
|
|
|
; esi= slot
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
terminate: ; terminate application
|
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
.slot equ esp ;locals
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
push esi ;save .slot
|
2007-02-09 18:48:56 +01:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
shl esi, 8
|
|
|
|
|
cmp [SLOT_BASE+esi+APPDATA.dir_table], 0
|
|
|
|
|
jne @F
|
|
|
|
|
pop esi
|
|
|
|
|
shl esi, 5
|
|
|
|
|
mov [CURRENT_TASK+esi+TASKDATA.state], 9
|
|
|
|
|
ret
|
2007-02-09 18:48:56 +01:00
|
|
|
|
@@:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
;mov esi,process_terminating
|
|
|
|
|
;call sys_msg_board_str
|
2007-02-08 08:15:14 +01:00
|
|
|
|
@@:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
cli
|
|
|
|
|
cmp [application_table_status],0
|
|
|
|
|
je term9
|
|
|
|
|
sti
|
|
|
|
|
call change_task
|
|
|
|
|
jmp @b
|
2007-02-08 08:15:14 +01:00
|
|
|
|
term9:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
call set_application_table_status
|
2007-02-08 08:15:14 +01:00
|
|
|
|
|
2008-02-04 16:31:59 +01:00
|
|
|
|
; if the process is in V86 mode...
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov eax, [.slot]
|
|
|
|
|
shl eax, 8
|
|
|
|
|
mov esi, [eax+SLOT_BASE+APPDATA.pl0_stack]
|
|
|
|
|
add esi, RING0_STACK_SIZE
|
|
|
|
|
cmp [eax+SLOT_BASE+APPDATA.saved_esp0], esi
|
|
|
|
|
jz .nov86
|
2008-02-04 16:31:59 +01:00
|
|
|
|
; ...it has page directory for V86 mode
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov esi, [eax+SLOT_BASE+APPDATA.saved_esp0]
|
|
|
|
|
mov ecx, [esi+4]
|
|
|
|
|
mov [eax+SLOT_BASE+APPDATA.dir_table], ecx
|
2008-02-04 16:31:59 +01:00
|
|
|
|
; ...and I/O permission map for V86 mode
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov ecx, [esi+12]
|
|
|
|
|
mov [eax+SLOT_BASE+APPDATA.io_map], ecx
|
|
|
|
|
mov ecx, [esi+8]
|
|
|
|
|
mov [eax+SLOT_BASE+APPDATA.io_map+4], ecx
|
2008-02-04 16:31:59 +01:00
|
|
|
|
.nov86:
|
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov esi, [.slot]
|
|
|
|
|
shl esi,8
|
|
|
|
|
add esi, SLOT_BASE+APP_OBJ_OFFSET
|
2007-02-08 08:15:14 +01:00
|
|
|
|
@@:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov eax, [esi+APPOBJ.fd]
|
|
|
|
|
test eax, eax
|
|
|
|
|
jz @F
|
|
|
|
|
|
|
|
|
|
cmp eax, esi
|
|
|
|
|
je @F
|
|
|
|
|
|
|
|
|
|
push esi
|
|
|
|
|
call [eax+APPOBJ.destroy]
|
|
|
|
|
DEBUGF 1,"%s",msg_obj_destroy
|
|
|
|
|
pop esi
|
|
|
|
|
jmp @B
|
2007-02-08 08:15:14 +01:00
|
|
|
|
@@:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov eax, [.slot]
|
|
|
|
|
shl eax, 8
|
|
|
|
|
mov eax,[SLOT_BASE+eax+APPDATA.dir_table]
|
|
|
|
|
stdcall destroy_app_space, eax
|
|
|
|
|
|
|
|
|
|
mov esi, [.slot]
|
|
|
|
|
cmp [fpu_owner],esi ; if user fpu last -> fpu user = 1
|
|
|
|
|
jne @F
|
|
|
|
|
|
|
|
|
|
mov [fpu_owner],1
|
|
|
|
|
mov eax, [256+SLOT_BASE+APPDATA.fpu_state]
|
|
|
|
|
clts
|
|
|
|
|
bt [cpu_caps], CAPS_SSE
|
|
|
|
|
jnc .no_SSE
|
|
|
|
|
fxrstor [eax]
|
|
|
|
|
jmp @F
|
2006-10-31 21:19:05 +01:00
|
|
|
|
.no_SSE:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
fnclex
|
|
|
|
|
frstor [eax]
|
2007-02-17 11:09:23 +01:00
|
|
|
|
@@:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov [KEY_COUNT],byte 0 ; empty keyboard buffer
|
|
|
|
|
mov [BTN_COUNT],byte 0 ; empty button buffer
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
2006-06-30 14:23:15 +02:00
|
|
|
|
; remove defined hotkeys
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov eax, hotkey_list
|
2006-06-30 14:23:15 +02:00
|
|
|
|
.loop:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
cmp [eax+8], esi
|
|
|
|
|
jnz .cont
|
|
|
|
|
mov ecx, [eax]
|
|
|
|
|
jecxz @f
|
|
|
|
|
push dword [eax+12]
|
|
|
|
|
pop dword [ecx+12]
|
2006-06-30 14:23:15 +02:00
|
|
|
|
@@:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov ecx, [eax+12]
|
|
|
|
|
push dword [eax]
|
|
|
|
|
pop dword [ecx]
|
|
|
|
|
xor ecx, ecx
|
|
|
|
|
mov [eax], ecx
|
|
|
|
|
mov [eax+4], ecx
|
|
|
|
|
mov [eax+8], ecx
|
|
|
|
|
mov [eax+12], ecx
|
2006-06-30 14:23:15 +02:00
|
|
|
|
.cont:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
add eax, 16
|
|
|
|
|
cmp eax, hotkey_list+256*16
|
|
|
|
|
jb .loop
|
2006-06-30 14:23:15 +02:00
|
|
|
|
; remove hotkeys in buffer
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov eax, hotkey_buffer
|
2006-06-30 14:23:15 +02:00
|
|
|
|
.loop2:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
cmp [eax], esi
|
|
|
|
|
jnz .cont2
|
|
|
|
|
and dword [eax+4], 0
|
|
|
|
|
and dword [eax], 0
|
2006-06-30 14:23:15 +02:00
|
|
|
|
.cont2:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
add eax, 8
|
|
|
|
|
cmp eax, hotkey_buffer+120*8
|
|
|
|
|
jb .loop2
|
2006-06-30 14:23:15 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov ecx,esi ; remove buttons
|
2005-10-06 19:56:22 +02:00
|
|
|
|
bnewba2:
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov edi,[BTN_ADDR]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov eax,edi
|
|
|
|
|
cld
|
|
|
|
|
movzx ebx,word [edi]
|
|
|
|
|
inc bx
|
|
|
|
|
bnewba:
|
|
|
|
|
dec bx
|
2009-04-04 21:58:42 +02:00
|
|
|
|
jz bnmba
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add eax,0x10
|
|
|
|
|
cmp cx,[eax]
|
|
|
|
|
jnz bnewba
|
|
|
|
|
pusha
|
|
|
|
|
mov ecx,ebx
|
|
|
|
|
inc ecx
|
|
|
|
|
shl ecx,4
|
|
|
|
|
mov ebx,eax
|
|
|
|
|
add eax,0x10
|
|
|
|
|
call memmove
|
|
|
|
|
dec dword [edi]
|
|
|
|
|
popa
|
|
|
|
|
jmp bnewba2
|
|
|
|
|
bnmba:
|
|
|
|
|
|
|
|
|
|
pusha ; save window coordinates for window restoring
|
|
|
|
|
cld
|
|
|
|
|
shl esi,5
|
|
|
|
|
add esi,window_data
|
2006-08-03 21:30:32 +02:00
|
|
|
|
mov eax,[esi+WDATA.box.left]
|
2006-07-23 16:47:32 +02:00
|
|
|
|
mov [dlx],eax
|
2006-08-03 21:30:32 +02:00
|
|
|
|
add eax,[esi+WDATA.box.width]
|
2006-07-23 16:47:32 +02:00
|
|
|
|
mov [dlxe],eax
|
2006-08-03 21:30:32 +02:00
|
|
|
|
mov eax,[esi+WDATA.box.top]
|
2006-07-23 16:47:32 +02:00
|
|
|
|
mov [dly],eax
|
2006-08-03 21:30:32 +02:00
|
|
|
|
add eax,[esi+WDATA.box.height]
|
2006-07-23 16:47:32 +02:00
|
|
|
|
mov [dlye],eax
|
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
xor eax, eax
|
2006-08-29 14:52:52 +02:00
|
|
|
|
mov [esi+WDATA.box.left],eax
|
|
|
|
|
mov [esi+WDATA.box.width],eax
|
|
|
|
|
mov [esi+WDATA.box.top],eax
|
|
|
|
|
mov [esi+WDATA.box.height],eax
|
2006-08-06 12:29:45 +02:00
|
|
|
|
mov [esi+WDATA.cl_workarea],eax
|
|
|
|
|
mov [esi+WDATA.cl_titlebar],eax
|
|
|
|
|
mov [esi+WDATA.cl_frames],eax
|
|
|
|
|
mov dword [esi+WDATA.reserved],eax ; clear all flags: wstate, redraw, wdrawn
|
2006-07-23 16:47:32 +02:00
|
|
|
|
lea edi, [esi-window_data+draw_data]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov ecx,32/4
|
|
|
|
|
rep stosd
|
|
|
|
|
popa
|
|
|
|
|
|
2006-01-25 14:19:21 +01:00
|
|
|
|
; debuggee test
|
|
|
|
|
pushad
|
|
|
|
|
mov edi, esi
|
|
|
|
|
shl edi, 5
|
2007-02-28 11:51:05 +01:00
|
|
|
|
mov eax, [SLOT_BASE+edi*8+APPDATA.debugger_slot]
|
2006-01-25 14:19:21 +01:00
|
|
|
|
test eax, eax
|
2009-04-04 21:58:42 +02:00
|
|
|
|
jz .nodebug
|
2006-01-25 14:19:21 +01:00
|
|
|
|
push 8
|
|
|
|
|
pop ecx
|
2009-04-04 21:58:42 +02:00
|
|
|
|
push dword [CURRENT_TASK+edi+TASKDATA.pid] ; PID
|
2006-01-25 14:19:21 +01:00
|
|
|
|
push 2
|
|
|
|
|
call debugger_notify
|
|
|
|
|
pop ecx
|
|
|
|
|
pop ecx
|
|
|
|
|
.nodebug:
|
|
|
|
|
popad
|
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov ebx, [.slot]
|
|
|
|
|
shl ebx, 8
|
|
|
|
|
push ebx
|
|
|
|
|
mov ebx,[SLOT_BASE+ebx+APPDATA.pl0_stack]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
stdcall kernel_free, ebx
|
2007-05-24 13:27:05 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
pop ebx
|
|
|
|
|
mov ebx,[SLOT_BASE+ebx+APPDATA.cur_dir]
|
|
|
|
|
stdcall kernel_free, ebx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov edi, [.slot]
|
|
|
|
|
shl edi,8
|
|
|
|
|
add edi,SLOT_BASE
|
2007-04-18 08:37:14 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov eax, [edi+APPDATA.io_map]
|
|
|
|
|
cmp eax, (tss._io_map_0-OS_BASE+PG_MAP)
|
|
|
|
|
je @F
|
|
|
|
|
call free_page
|
2007-04-18 08:37:14 +02:00
|
|
|
|
@@:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov eax, [edi+APPDATA.io_map+4]
|
|
|
|
|
cmp eax, (tss._io_map_1-OS_BASE+PG_MAP)
|
|
|
|
|
je @F
|
|
|
|
|
call free_page
|
2007-04-18 08:37:14 +02:00
|
|
|
|
@@:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov eax, 0x20202020
|
|
|
|
|
stosd
|
|
|
|
|
stosd
|
|
|
|
|
stosd
|
|
|
|
|
mov ecx,244/4
|
|
|
|
|
xor eax, eax
|
|
|
|
|
rep stosd
|
2006-07-23 16:47:32 +02:00
|
|
|
|
|
|
|
|
|
; activate window
|
2009-04-04 21:58:42 +02:00
|
|
|
|
movzx eax, word [WIN_STACK + esi*2]
|
|
|
|
|
cmp eax, [TASK_COUNT]
|
|
|
|
|
jne .dont_activate
|
|
|
|
|
pushad
|
2006-07-23 16:47:32 +02:00
|
|
|
|
.check_next_window:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
dec eax
|
|
|
|
|
cmp eax, 1
|
|
|
|
|
jbe .nothing_to_activate
|
|
|
|
|
lea esi, [WIN_POS+eax*2]
|
|
|
|
|
movzx edi, word [esi] ; edi = process
|
|
|
|
|
shl edi, 5
|
|
|
|
|
cmp [CURRENT_TASK + edi + TASKDATA.state], byte 9 ; skip dead slots
|
|
|
|
|
je .check_next_window
|
|
|
|
|
add edi, window_data
|
2006-09-19 15:16:31 +02:00
|
|
|
|
; \begin{diamond}[19.09.2006]
|
|
|
|
|
; skip minimized windows
|
2009-04-04 21:58:42 +02:00
|
|
|
|
test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
|
|
|
|
|
jnz .check_next_window
|
2006-09-19 15:16:31 +02:00
|
|
|
|
; \end{diamond}
|
2009-04-04 21:58:42 +02:00
|
|
|
|
call waredraw
|
2006-07-23 16:47:32 +02:00
|
|
|
|
.nothing_to_activate:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
popad
|
2006-07-23 16:47:32 +02:00
|
|
|
|
.dont_activate:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
push esi ; remove hd1 & cd & flp reservation
|
|
|
|
|
shl esi, 5
|
|
|
|
|
mov esi, [esi+CURRENT_TASK+TASKDATA.pid]
|
|
|
|
|
cmp [hd1_status], esi
|
|
|
|
|
jnz @f
|
|
|
|
|
call free_hd_channel
|
|
|
|
|
mov [hd1_status], 0
|
2006-06-30 14:23:15 +02:00
|
|
|
|
@@:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
cmp [cd_status], esi
|
|
|
|
|
jnz @f
|
|
|
|
|
call free_cd_channel
|
|
|
|
|
mov [cd_status], 0
|
2006-06-30 14:23:15 +02:00
|
|
|
|
@@:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
cmp [flp_status], esi
|
|
|
|
|
jnz @f
|
|
|
|
|
mov [flp_status], 0
|
2006-06-30 14:23:15 +02:00
|
|
|
|
@@:
|
2009-04-04 21:58:42 +02:00
|
|
|
|
pop esi
|
|
|
|
|
cmp [bgrlockpid], esi
|
|
|
|
|
jnz @f
|
|
|
|
|
and [bgrlockpid], 0
|
|
|
|
|
mov [bgrlock], 0
|
2007-06-18 18:39:42 +02:00
|
|
|
|
@@:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
pusha ; remove all irq reservations
|
2006-06-30 14:23:15 +02:00
|
|
|
|
mov eax,esi
|
2006-08-06 12:29:45 +02:00
|
|
|
|
shl eax, 5
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov eax,[eax+CURRENT_TASK+TASKDATA.pid]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov edi,irq_owner
|
2008-03-18 18:19:08 +01:00
|
|
|
|
xor ebx, ebx
|
|
|
|
|
xor edx, edx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
newirqfree:
|
2008-03-18 18:19:08 +01:00
|
|
|
|
cmp [edi + 4 * ebx], eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne nofreeirq
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov [edi + 4 * ebx], edx ; remove irq reservation
|
|
|
|
|
mov [irq_tab + 4 * ebx], edx ; remove irq handler
|
|
|
|
|
mov [irq_rights + 4 * ebx], edx ; set access rights to full access
|
2005-10-06 19:56:22 +02:00
|
|
|
|
nofreeirq:
|
2008-03-18 18:19:08 +01:00
|
|
|
|
inc ebx
|
|
|
|
|
cmp ebx, 16
|
2009-04-04 21:58:42 +02:00
|
|
|
|
jb newirqfree
|
2005-10-06 19:56:22 +02:00
|
|
|
|
popa
|
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
pusha ; remove all port reservations
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov edx,esi
|
2006-08-06 12:29:45 +02:00
|
|
|
|
shl edx, 5
|
2007-02-28 09:52:06 +01:00
|
|
|
|
add edx,CURRENT_TASK
|
2006-08-06 12:29:45 +02:00
|
|
|
|
mov edx,[edx+TASKDATA.pid]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
rmpr0:
|
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov esi,[RESERVED_PORTS]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
cmp esi,0
|
2009-04-04 21:58:42 +02:00
|
|
|
|
je rmpr9
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
rmpr3:
|
|
|
|
|
|
|
|
|
|
mov edi,esi
|
|
|
|
|
shl edi,4
|
2007-03-01 21:32:19 +01:00
|
|
|
|
add edi,RESERVED_PORTS
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
cmp edx,[edi]
|
2009-04-04 21:58:42 +02:00
|
|
|
|
je rmpr4
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
dec esi
|
|
|
|
|
jnz rmpr3
|
|
|
|
|
|
|
|
|
|
jmp rmpr9
|
|
|
|
|
|
|
|
|
|
rmpr4:
|
|
|
|
|
|
|
|
|
|
mov ecx,256
|
|
|
|
|
sub ecx,esi
|
|
|
|
|
shl ecx,4
|
|
|
|
|
|
|
|
|
|
mov esi,edi
|
|
|
|
|
add esi,16
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
|
dec dword [RESERVED_PORTS]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
jmp rmpr0
|
|
|
|
|
|
|
|
|
|
rmpr9:
|
|
|
|
|
|
|
|
|
|
popa
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov edi,esi ; do not run this process slot
|
2005-10-13 19:50:36 +02:00
|
|
|
|
shl edi, 5
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov [edi+CURRENT_TASK + TASKDATA.state],byte 9
|
2006-01-25 14:19:21 +01:00
|
|
|
|
; debugger test - terminate all debuggees
|
|
|
|
|
mov eax, 2
|
2007-02-28 11:51:05 +01:00
|
|
|
|
mov ecx, SLOT_BASE+2*0x100+APPDATA.debugger_slot
|
2006-01-25 14:19:21 +01:00
|
|
|
|
.xd0:
|
2007-02-28 09:52:06 +01:00
|
|
|
|
cmp eax, [TASK_COUNT]
|
2009-04-04 21:58:42 +02:00
|
|
|
|
ja .xd1
|
2006-01-25 14:19:21 +01:00
|
|
|
|
cmp dword [ecx], esi
|
|
|
|
|
jnz @f
|
|
|
|
|
and dword [ecx], 0
|
|
|
|
|
pushad
|
2007-12-17 12:04:07 +01:00
|
|
|
|
xchg eax, ecx
|
|
|
|
|
mov ebx, 2
|
2006-01-25 14:19:21 +01:00
|
|
|
|
call sys_system
|
|
|
|
|
popad
|
|
|
|
|
@@:
|
|
|
|
|
inc eax
|
|
|
|
|
add ecx, 0x100
|
|
|
|
|
jmp .xd0
|
|
|
|
|
.xd1:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; call systest
|
|
|
|
|
sti ; .. and life goes on
|
|
|
|
|
|
2006-08-01 16:09:42 +02:00
|
|
|
|
mov eax, [dlx]
|
|
|
|
|
mov ebx, [dly]
|
|
|
|
|
mov ecx, [dlxe]
|
|
|
|
|
mov edx, [dlye]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call calculatescreen
|
|
|
|
|
xor eax, eax
|
|
|
|
|
xor esi, esi
|
|
|
|
|
call redrawscreen
|
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background
|
|
|
|
|
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
mov [application_table_status],0
|
2007-05-17 21:54:49 +02:00
|
|
|
|
;mov esi,process_terminated
|
|
|
|
|
;call sys_msg_board_str
|
2007-02-17 11:09:23 +01:00
|
|
|
|
add esp, 4
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
2007-02-14 02:16:07 +01:00
|
|
|
|
restore .slot
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
iglobal
|
2009-04-04 21:58:42 +02:00
|
|
|
|
boot_sched_1 db 'Building gdt tss pointer',0
|
|
|
|
|
boot_sched_2 db 'Building IDT table',0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
endg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build_scheduler:
|
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
mov esi,boot_sched_1
|
|
|
|
|
call boot_log
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; call build_process_gdt_tss_pointer
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; mov esi,boot_sched_2
|
|
|
|
|
; call boot_log
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2009-04-04 21:58:42 +02:00
|
|
|
|
ret
|