small update copyright year in kernel
git-svn-id: svn://kolibrios.org@9715 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -281,8 +281,6 @@ LFB_BASE = 0xFE000000
|
|||||||
|
|
||||||
new_app_base = 0;
|
new_app_base = 0;
|
||||||
|
|
||||||
;twdw = TASK_TABLE - window_data
|
|
||||||
|
|
||||||
std_application_base_address = new_app_base
|
std_application_base_address = new_app_base
|
||||||
RING0_STACK_SIZE = 0x2000
|
RING0_STACK_SIZE = 0x2000
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2020. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -76,8 +76,8 @@ end if
|
|||||||
; IOAPIC init
|
; IOAPIC init
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
@@:
|
@@:
|
||||||
stdcall map_io_mem, [acpi_ioapic_base+ebx*4], 0x20, PG_GLOBAL+PG_NOCACHE+PG_SWR
|
stdcall map_io_mem, [acpi_ioapic_base + ebx*4], 0x20, PG_GLOBAL + PG_NOCACHE + PG_SWR
|
||||||
mov [IOAPIC_base+ebx*4], eax
|
mov [IOAPIC_base + ebx*4], eax
|
||||||
inc ebx
|
inc ebx
|
||||||
cmp ebx, [ioapic_cnt]
|
cmp ebx, [ioapic_cnt]
|
||||||
jnz @b
|
jnz @b
|
||||||
@@ -91,7 +91,7 @@ end if
|
|||||||
shr eax, 16
|
shr eax, 16
|
||||||
inc al
|
inc al
|
||||||
movzx eax, al
|
movzx eax, al
|
||||||
mov ecx, [ioapic_gsi_base+edx*4]
|
mov ecx, [ioapic_gsi_base + edx*4]
|
||||||
cmp ecx, IRQ_RESERVED
|
cmp ecx, IRQ_RESERVED
|
||||||
jae .lapic_init
|
jae .lapic_init
|
||||||
add ecx, eax
|
add ecx, eax
|
||||||
@@ -99,7 +99,7 @@ end if
|
|||||||
jbe @f
|
jbe @f
|
||||||
sub eax, ecx
|
sub eax, ecx
|
||||||
@@:
|
@@:
|
||||||
mov [IRQ_COUNT+edx*4], eax
|
mov [IRQ_COUNT + edx*4], eax
|
||||||
|
|
||||||
; Reroute IOAPIC & mask all interrupts
|
; Reroute IOAPIC & mask all interrupts
|
||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
@@ -110,7 +110,7 @@ end if
|
|||||||
mov ah, 0x08; Delivery Mode: Fixed, Destination Mode: Logical
|
mov ah, 0x08; Delivery Mode: Fixed, Destination Mode: Logical
|
||||||
mov al, cl
|
mov al, cl
|
||||||
add al, 0x20; vector
|
add al, 0x20; vector
|
||||||
add eax, [ioapic_gsi_base+edx*4]
|
add eax, [ioapic_gsi_base + edx*4]
|
||||||
or eax, 0x1a000; Mask Interrupt, level-triggered active-low
|
or eax, 0x1a000; Mask Interrupt, level-triggered active-low
|
||||||
cmp [ioapic_cur], 0
|
cmp [ioapic_cur], 0
|
||||||
jnz @f
|
jnz @f
|
||||||
@@ -128,7 +128,7 @@ end if
|
|||||||
call IOAPIC_write
|
call IOAPIC_write
|
||||||
inc eax
|
inc eax
|
||||||
inc ecx
|
inc ecx
|
||||||
cmp ecx, [IRQ_COUNT+edx*4]
|
cmp ecx, [IRQ_COUNT + edx*4]
|
||||||
jb .next_irq
|
jb .next_irq
|
||||||
|
|
||||||
inc [ioapic_cur]
|
inc [ioapic_cur]
|
||||||
@@ -158,7 +158,7 @@ LAPIC_init:
|
|||||||
mov eax, [LAPIC_BASE]
|
mov eax, [LAPIC_BASE]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz @f
|
jnz @f
|
||||||
stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_GLOBAL+PG_NOCACHE+PG_SWR
|
stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_GLOBAL + PG_NOCACHE + PG_SWR
|
||||||
mov [LAPIC_BASE], eax
|
mov [LAPIC_BASE], eax
|
||||||
@@:
|
@@:
|
||||||
mov esi, eax
|
mov esi, eax
|
||||||
@@ -243,7 +243,7 @@ IOAPIC_read:
|
|||||||
; out: EAX - readed value
|
; out: EAX - readed value
|
||||||
push esi
|
push esi
|
||||||
mov esi, [ioapic_cur]
|
mov esi, [ioapic_cur]
|
||||||
mov esi, [IOAPIC_base+esi*4]
|
mov esi, [IOAPIC_base + esi*4]
|
||||||
mov [esi], eax
|
mov [esi], eax
|
||||||
mov eax, [esi + 0x10]
|
mov eax, [esi + 0x10]
|
||||||
pop esi
|
pop esi
|
||||||
@@ -256,7 +256,7 @@ IOAPIC_write:
|
|||||||
; out: none
|
; out: none
|
||||||
push esi
|
push esi
|
||||||
mov esi, [ioapic_cur]
|
mov esi, [ioapic_cur]
|
||||||
mov esi, [IOAPIC_base+esi*4]
|
mov esi, [IOAPIC_base + esi*4]
|
||||||
mov [esi], eax
|
mov [esi], eax
|
||||||
mov [esi + 0x10], ebx
|
mov [esi + 0x10], ebx
|
||||||
pop esi
|
pop esi
|
||||||
@@ -348,7 +348,7 @@ IRQ_mask_all:
|
|||||||
mov [ioapic_cur], 0
|
mov [ioapic_cur], 0
|
||||||
.next_ioapic:
|
.next_ioapic:
|
||||||
mov edx, [ioapic_cur]
|
mov edx, [ioapic_cur]
|
||||||
mov ecx, [IRQ_COUNT+edx*4]
|
mov ecx, [IRQ_COUNT + edx*4]
|
||||||
mov eax, 0x10
|
mov eax, 0x10
|
||||||
@@:
|
@@:
|
||||||
mov ebx, eax
|
mov ebx, eax
|
||||||
@@ -454,8 +454,8 @@ proc disable_irq stdcall, irq_line:dword
|
|||||||
push [ioapic_cur]
|
push [ioapic_cur]
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
.next_ioapic:
|
.next_ioapic:
|
||||||
mov ecx, [ioapic_gsi_base+eax*4]
|
mov ecx, [ioapic_gsi_base + eax*4]
|
||||||
add ecx, [IRQ_COUNT+eax*4]
|
add ecx, [IRQ_COUNT + eax*4]
|
||||||
cmp ebx, ecx
|
cmp ebx, ecx
|
||||||
jae .found
|
jae .found
|
||||||
inc eax
|
inc eax
|
||||||
@@ -485,7 +485,7 @@ pci_irq_fixup:
|
|||||||
mov esi, [acpi_dev_data]
|
mov esi, [acpi_dev_data]
|
||||||
mov ebx, [acpi_dev_size]
|
mov ebx, [acpi_dev_size]
|
||||||
|
|
||||||
lea edi, [esi+ebx]
|
lea edi, [esi + ebx]
|
||||||
|
|
||||||
.iterate:
|
.iterate:
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2013-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2013-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2013-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2013-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -12,7 +12,7 @@ $Revision$
|
|||||||
sys_debug_services:
|
sys_debug_services:
|
||||||
cmp ebx, 9
|
cmp ebx, 9
|
||||||
ja @f
|
ja @f
|
||||||
jmp dword [sys_debug_services_table+ebx*4]
|
jmp dword [sys_debug_services_table + ebx*4]
|
||||||
@@:
|
@@:
|
||||||
ret
|
ret
|
||||||
iglobal
|
iglobal
|
||||||
@@ -33,7 +33,7 @@ debug_set_event_data:
|
|||||||
; in: ecx = pointer
|
; in: ecx = pointer
|
||||||
; destroys eax
|
; destroys eax
|
||||||
mov eax, [current_slot]
|
mov eax, [current_slot]
|
||||||
mov [eax+APPDATA.dbg_event_mem], ecx
|
mov [eax + APPDATA.dbg_event_mem], ecx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
get_debuggee_slot:
|
get_debuggee_slot:
|
||||||
@@ -49,7 +49,7 @@ get_debuggee_slot:
|
|||||||
shl eax, BSF sizeof.APPDATA
|
shl eax, BSF sizeof.APPDATA
|
||||||
push ebx
|
push ebx
|
||||||
mov ebx, [current_slot_idx]
|
mov ebx, [current_slot_idx]
|
||||||
cmp [SLOT_BASE+eax+APPDATA.debugger_slot], ebx
|
cmp [SLOT_BASE + eax + APPDATA.debugger_slot], ebx
|
||||||
pop ebx
|
pop ebx
|
||||||
jnz .ret_bad
|
jnz .ret_bad
|
||||||
; clc ; automatically
|
; clc ; automatically
|
||||||
@@ -63,7 +63,7 @@ debug_detach:
|
|||||||
; destroys eax,ebx
|
; destroys eax,ebx
|
||||||
call get_debuggee_slot
|
call get_debuggee_slot
|
||||||
jc .ret
|
jc .ret
|
||||||
and dword [eax+SLOT_BASE+APPDATA.debugger_slot], 0
|
and dword [eax + SLOT_BASE + APPDATA.debugger_slot], 0
|
||||||
call do_resume
|
call do_resume
|
||||||
.ret:
|
.ret:
|
||||||
sti
|
sti
|
||||||
@@ -155,15 +155,15 @@ debug_getcontext:
|
|||||||
call get_debuggee_slot
|
call get_debuggee_slot
|
||||||
jc .ret
|
jc .ret
|
||||||
|
|
||||||
shr eax, 8
|
shr eax, BSF sizeof.APPDATA
|
||||||
cmp eax, [fpu_owner]
|
cmp eax, [fpu_owner]
|
||||||
jne @f
|
jne @f
|
||||||
inc bh ; set swap context flag
|
inc bh ; set swap context flag
|
||||||
@@:
|
@@:
|
||||||
shl eax, BSF sizeof.APPDATA
|
shl eax, BSF sizeof.APPDATA
|
||||||
mov edi, esi
|
mov edi, esi
|
||||||
mov eax, [eax+SLOT_BASE+APPDATA.pl0_stack]
|
mov eax, [SLOT_BASE + eax + APPDATA.pl0_stack]
|
||||||
lea esi, [eax+RING0_STACK_SIZE]
|
lea esi, [eax + RING0_STACK_SIZE]
|
||||||
|
|
||||||
.ring0:
|
.ring0:
|
||||||
; note that following code assumes that all interrupt/exception handlers
|
; note that following code assumes that all interrupt/exception handlers
|
||||||
@@ -231,8 +231,8 @@ debug_setcontext:
|
|||||||
call get_debuggee_slot
|
call get_debuggee_slot
|
||||||
jc .stiret
|
jc .stiret
|
||||||
; mov esi, edx
|
; mov esi, edx
|
||||||
mov eax, [eax+SLOT_BASE+APPDATA.pl0_stack]
|
mov eax, [eax + SLOT_BASE+APPDATA.pl0_stack]
|
||||||
lea edi, [eax+RING0_STACK_SIZE]
|
lea edi, [eax + RING0_STACK_SIZE]
|
||||||
|
|
||||||
.ring0:
|
.ring0:
|
||||||
sub edi, 8+12+20h
|
sub edi, 8+12+20h
|
||||||
@@ -267,7 +267,7 @@ debug_set_drx:
|
|||||||
call get_debuggee_slot
|
call get_debuggee_slot
|
||||||
jc .errret
|
jc .errret
|
||||||
mov ebp, eax
|
mov ebp, eax
|
||||||
lea eax, [eax+SLOT_BASE+APPDATA.dbg_regs]
|
lea eax, [eax + SLOT_BASE + APPDATA.dbg_regs]
|
||||||
; [eax]=dr0, [eax+4]=dr1, [eax+8]=dr2, [eax+C]=dr3
|
; [eax]=dr0, [eax+4]=dr1, [eax+8]=dr2, [eax+C]=dr3
|
||||||
; [eax+10]=dr7
|
; [eax+10]=dr7
|
||||||
cmp esi, OS_BASE
|
cmp esi, OS_BASE
|
||||||
@@ -288,13 +288,13 @@ debug_set_drx:
|
|||||||
; clear breakpoint
|
; clear breakpoint
|
||||||
movzx edx, dl
|
movzx edx, dl
|
||||||
add edx, edx
|
add edx, edx
|
||||||
and dword [eax+edx*2], 0 ; clear DR<i>
|
and dword [eax + edx*2], 0 ; clear DR<i>
|
||||||
btr dword [eax+10h], edx ; clear L<i> bit
|
btr dword [eax + 10h], edx ; clear L<i> bit
|
||||||
test byte [eax+10h], 55h
|
test byte [eax + 10h], 55h
|
||||||
jnz .okret
|
jnz .okret
|
||||||
; imul eax, ebp, tss_step/32
|
; imul eax, ebp, tss_step/32
|
||||||
; and byte [eax + tss_data + TSS._trap], not 1
|
; and byte [eax + tss_data + TSS._trap], not 1
|
||||||
and [ebp + SLOT_BASE+APPDATA.dbg_state], not 1
|
and [SLOT_BASE + ebp + APPDATA.dbg_state], not 1
|
||||||
.okret:
|
.okret:
|
||||||
and dword [esp+32], 0
|
and dword [esp+32], 0
|
||||||
sti
|
sti
|
||||||
@@ -325,23 +325,23 @@ debug_set_drx:
|
|||||||
test bl, dl
|
test bl, dl
|
||||||
|
|
||||||
jnz .errret
|
jnz .errret
|
||||||
or byte [eax+10h+1], 3 ; set GE and LE flags
|
or byte [eax + 10h+1], 3 ; set GE and LE flags
|
||||||
|
|
||||||
movzx edx, dh
|
movzx edx, dh
|
||||||
movzx ecx, dl
|
movzx ecx, dl
|
||||||
add ecx, ecx
|
add ecx, ecx
|
||||||
bts dword [eax+10h], ecx ; set L<i> flag
|
bts dword [eax + 10h], ecx ; set L<i> flag
|
||||||
add ecx, ecx
|
add ecx, ecx
|
||||||
mov [eax+ecx], ebx;esi ; set DR<i>
|
mov [eax + ecx], ebx;esi ; set DR<i>
|
||||||
shl edx, cl
|
shl edx, cl
|
||||||
mov ebx, 0xF
|
mov ebx, 0xF
|
||||||
shl ebx, cl
|
shl ebx, cl
|
||||||
not ebx
|
not ebx
|
||||||
and [eax+10h+2], bx
|
and [eax + 10h+2], bx
|
||||||
or [eax+10h+2], dx ; set R/W and LEN fields
|
or [eax + 10h+2], dx ; set R/W and LEN fields
|
||||||
; imul eax, ebp, tss_step/32
|
; imul eax, ebp, tss_step/32
|
||||||
; or byte [eax + tss_data + TSS._trap], 1
|
; or byte [eax + tss_data + TSS._trap], 1
|
||||||
or [ebp + SLOT_BASE+APPDATA.dbg_state], 1
|
or [SLOT_BASE + ebp + APPDATA.dbg_state], 1
|
||||||
jmp .okret
|
jmp .okret
|
||||||
|
|
||||||
debug_read_process_memory:
|
debug_read_process_memory:
|
||||||
@@ -354,7 +354,7 @@ debug_read_process_memory:
|
|||||||
; destroys all
|
; destroys all
|
||||||
call get_debuggee_slot
|
call get_debuggee_slot
|
||||||
jc .err
|
jc .err
|
||||||
shr eax, 8
|
shr eax, BSF sizeof.APPDATA
|
||||||
mov ecx, edi
|
mov ecx, edi
|
||||||
call read_process_memory
|
call read_process_memory
|
||||||
sti
|
sti
|
||||||
@@ -374,7 +374,7 @@ debug_write_process_memory:
|
|||||||
; destroys all
|
; destroys all
|
||||||
call get_debuggee_slot
|
call get_debuggee_slot
|
||||||
jc debug_read_process_memory.err
|
jc debug_read_process_memory.err
|
||||||
shr eax, 8
|
shr eax, BSF sizeof.APPDATA
|
||||||
mov ecx, edi
|
mov ecx, edi
|
||||||
call write_process_memory
|
call write_process_memory
|
||||||
sti
|
sti
|
||||||
@@ -393,8 +393,8 @@ debugger_notify:
|
|||||||
add edi, 500 ; 5 sec timeout
|
add edi, 500 ; 5 sec timeout
|
||||||
.1:
|
.1:
|
||||||
mov eax, ebp
|
mov eax, ebp
|
||||||
shl eax, 8
|
shl eax, BSF sizeof.APPDATA
|
||||||
mov esi, [SLOT_BASE+eax+APPDATA.dbg_event_mem]
|
mov esi, [SLOT_BASE + eax + APPDATA.dbg_event_mem]
|
||||||
test esi, esi
|
test esi, esi
|
||||||
jz .ret
|
jz .ret
|
||||||
; read buffer header
|
; read buffer header
|
||||||
@@ -450,6 +450,6 @@ debugger_notify:
|
|||||||
; new debug event
|
; new debug event
|
||||||
mov eax, ebp
|
mov eax, ebp
|
||||||
shl eax, BSF sizeof.APPDATA
|
shl eax, BSF sizeof.APPDATA
|
||||||
or [SLOT_BASE+eax+APPDATA.occurred_events], EVENT_DEBUG
|
or [SLOT_BASE + eax + APPDATA.occurred_events], EVENT_DEBUG
|
||||||
.ret:
|
.ret:
|
||||||
ret
|
ret
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2020. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License. ;;
|
;; Distributed under terms of the GNU General Public License. ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -21,12 +21,12 @@ proc get_notify stdcall, p_ev:dword
|
|||||||
|
|
||||||
.wait:
|
.wait:
|
||||||
mov ebx, [current_slot]
|
mov ebx, [current_slot]
|
||||||
test dword [ebx+APPDATA.event_mask], EVENT_NOTIFY
|
test dword [ebx + APPDATA.event_mask], EVENT_NOTIFY
|
||||||
jz @f
|
jz @f
|
||||||
and dword [ebx+APPDATA.event_mask], not EVENT_NOTIFY
|
and dword [ebx + APPDATA.event_mask], not EVENT_NOTIFY
|
||||||
mov edi, [p_ev]
|
mov edi, [p_ev]
|
||||||
mov dword [edi], EV_INTR
|
mov dword [edi], EV_INTR
|
||||||
mov eax, [ebx+APPDATA.event]
|
mov eax, [ebx + APPDATA.event]
|
||||||
mov dword [edi+4], eax
|
mov dword [edi+4], eax
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
@@ -50,15 +50,15 @@ proc srv_handler stdcall, ioctl:dword
|
|||||||
test esi, esi
|
test esi, esi
|
||||||
jz .err
|
jz .err
|
||||||
|
|
||||||
mov edi, [esi+handle]
|
mov edi, [esi + handle]
|
||||||
cmp [edi+SRV.magic], ' SRV'
|
cmp [edi + SRV.magic], ' SRV'
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
cmp [edi+SRV.size], sizeof.SRV
|
cmp [edi + SRV.size], sizeof.SRV
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
; stdcall [edi+SRV.srv_proc], esi
|
; stdcall [edi+SRV.srv_proc], esi
|
||||||
mov eax, [edi+SRV.srv_proc]
|
mov eax, [edi + SRV.srv_proc]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
stdcall eax, esi
|
stdcall eax, esi
|
||||||
@@ -66,8 +66,8 @@ proc srv_handler stdcall, ioctl:dword
|
|||||||
.fail:
|
.fail:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
not eax
|
not eax
|
||||||
mov [esi+output], eax
|
mov [esi + output], eax
|
||||||
mov [esi+out_size], 4
|
mov [esi + out_size], 4
|
||||||
ret
|
ret
|
||||||
.err:
|
.err:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
@@ -86,19 +86,19 @@ srv_handlerEx:
|
|||||||
cmp ecx, OS_BASE
|
cmp ecx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
|
|
||||||
mov eax, [ecx+handle]
|
mov eax, [ecx + handle]
|
||||||
|
|
||||||
cmp eax, OS_BASE
|
cmp eax, OS_BASE
|
||||||
jbe .fail
|
jbe .fail
|
||||||
|
|
||||||
cmp [eax+SRV.magic], ' SRV'
|
cmp [eax + SRV.magic], ' SRV'
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
cmp [eax+SRV.size], sizeof.SRV
|
cmp [eax + SRV.size], sizeof.SRV
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
; stdcall [eax+SRV.srv_proc], ecx
|
; stdcall [eax+SRV.srv_proc], ecx
|
||||||
mov eax, [eax+SRV.srv_proc]
|
mov eax, [eax + SRV.srv_proc]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
stdcall eax, ecx
|
stdcall eax, ecx
|
||||||
@@ -123,7 +123,7 @@ proc get_service stdcall, sz_name:dword
|
|||||||
@@:
|
@@:
|
||||||
mov edx, [srv.fd]
|
mov edx, [srv.fd]
|
||||||
@@:
|
@@:
|
||||||
cmp edx, srv.fd-SRV.fd
|
cmp edx, srv.fd - SRV.fd
|
||||||
je .not_load
|
je .not_load
|
||||||
|
|
||||||
stdcall strncmp, edx, [sz_name], 16
|
stdcall strncmp, edx, [sz_name], 16
|
||||||
@@ -131,7 +131,7 @@ proc get_service stdcall, sz_name:dword
|
|||||||
mov eax, edx
|
mov eax, edx
|
||||||
je .nothing
|
je .nothing
|
||||||
|
|
||||||
mov edx, [edx+SRV.fd]
|
mov edx, [edx + SRV.fd]
|
||||||
jmp @B
|
jmp @B
|
||||||
.not_load:
|
.not_load:
|
||||||
mov eax, [sz_name]
|
mov eax, [sz_name]
|
||||||
@@ -210,18 +210,18 @@ proc reg_service_ex stdcall, name:dword, handler:dword, srvsize:dword
|
|||||||
pop edi
|
pop edi
|
||||||
pop esi
|
pop esi
|
||||||
|
|
||||||
mov [eax+SRV.magic], ' SRV'
|
mov [eax + SRV.magic], ' SRV'
|
||||||
mov [eax+SRV.size], sizeof.SRV
|
mov [eax + SRV.size], sizeof.SRV
|
||||||
|
|
||||||
mov ebx, srv.fd-SRV.fd
|
mov ebx, srv.fd - SRV.fd
|
||||||
mov edx, [ebx+SRV.fd]
|
mov edx, [ebx + SRV.fd]
|
||||||
mov [eax+SRV.fd], edx
|
mov [eax + SRV.fd], edx
|
||||||
mov [eax+SRV.bk], ebx
|
mov [eax + SRV.bk], ebx
|
||||||
mov [ebx+SRV.fd], eax
|
mov [ebx + SRV.fd], eax
|
||||||
mov [edx+SRV.bk], eax
|
mov [edx + SRV.bk], eax
|
||||||
|
|
||||||
mov ecx, [handler]
|
mov ecx, [handler]
|
||||||
mov [eax+SRV.srv_proc], ecx
|
mov [eax + SRV.srv_proc], ecx
|
||||||
;dec [count_services]
|
;dec [count_services]
|
||||||
pop ebx
|
pop ebx
|
||||||
ret
|
ret
|
||||||
@@ -236,15 +236,15 @@ stop_all_services: ;used in shutdown system
|
|||||||
push ebp
|
push ebp
|
||||||
mov edx, [srv.fd]
|
mov edx, [srv.fd]
|
||||||
.next:
|
.next:
|
||||||
cmp edx, srv.fd-SRV.fd
|
cmp edx, srv.fd - SRV.fd
|
||||||
je .done
|
je .done
|
||||||
cmp [edx+SRV.magic], ' SRV'
|
cmp [edx + SRV.magic], ' SRV'
|
||||||
jne .next
|
jne .next
|
||||||
cmp [edx+SRV.size], sizeof.SRV
|
cmp [edx + SRV.size], sizeof.SRV
|
||||||
jne .next
|
jne .next
|
||||||
|
|
||||||
mov ebx, [edx+SRV.entry]
|
mov ebx, [edx + SRV.entry]
|
||||||
mov edx, [edx+SRV.fd]
|
mov edx, [edx + SRV.fd]
|
||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
jz .next
|
jz .next
|
||||||
|
|
||||||
@@ -543,7 +543,7 @@ proc load_file_umode stdcall, file_name:dword
|
|||||||
|
|
||||||
mov edx, [file_size] ;preallocate page memory
|
mov edx, [file_size] ;preallocate page memory
|
||||||
shr eax, 10
|
shr eax, 10
|
||||||
lea edi, [page_tabs+eax]
|
lea edi, [page_tabs + eax]
|
||||||
add edx, 4095
|
add edx, 4095
|
||||||
shr edx, 12
|
shr edx, 12
|
||||||
@@:
|
@@:
|
||||||
@@ -648,7 +648,7 @@ proc get_proc_ex stdcall uses ebx esi, proc_name:dword, imports:dword
|
|||||||
.look_up:
|
.look_up:
|
||||||
|
|
||||||
mov eax, [ebx+32]
|
mov eax, [ebx+32]
|
||||||
mov eax, [OS_BASE+eax+esi*4]
|
mov eax, [OS_BASE + eax + esi*4]
|
||||||
add eax, OS_BASE
|
add eax, OS_BASE
|
||||||
stdcall strncmp, eax, [proc_name], 256
|
stdcall strncmp, eax, [proc_name], 256
|
||||||
test eax, eax
|
test eax, eax
|
||||||
@@ -662,7 +662,7 @@ proc get_proc_ex stdcall uses ebx esi, proc_name:dword, imports:dword
|
|||||||
ret
|
ret
|
||||||
.ok:
|
.ok:
|
||||||
mov eax, [ebx+28]
|
mov eax, [ebx+28]
|
||||||
mov eax, [OS_BASE+eax+esi*4]
|
mov eax, [OS_BASE + eax + esi*4]
|
||||||
add eax, OS_BASE
|
add eax, OS_BASE
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@@ -677,10 +677,10 @@ proc fix_coff_symbols stdcall uses ebx esi, sec:dword, symbols:dword,\
|
|||||||
mov edi, [symbols]
|
mov edi, [symbols]
|
||||||
mov [retval], 1
|
mov [retval], 1
|
||||||
.fix:
|
.fix:
|
||||||
movzx ebx, [edi+COFF_SYM.SectionNumber]
|
movzx ebx, [edi + COFF_SYM.SectionNumber]
|
||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
jnz .internal
|
jnz .internal
|
||||||
mov eax, dword [edi+COFF_SYM.Name]
|
mov eax, dword [edi + COFF_SYM.Name]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz @F
|
jnz @F
|
||||||
|
|
||||||
@@ -706,7 +706,7 @@ proc fix_coff_symbols stdcall uses ebx esi, sec:dword, symbols:dword,\
|
|||||||
mov [retval], 0
|
mov [retval], 0
|
||||||
@@:
|
@@:
|
||||||
mov edi, [symbols]
|
mov edi, [symbols]
|
||||||
mov [edi+COFF_SYM.Value], eax
|
mov [edi + COFF_SYM.Value], eax
|
||||||
jmp .next
|
jmp .next
|
||||||
.internal:
|
.internal:
|
||||||
cmp bx, -1
|
cmp bx, -1
|
||||||
@@ -716,11 +716,11 @@ proc fix_coff_symbols stdcall uses ebx esi, sec:dword, symbols:dword,\
|
|||||||
|
|
||||||
dec ebx
|
dec ebx
|
||||||
shl ebx, 3
|
shl ebx, 3
|
||||||
lea ebx, [ebx+ebx*4]
|
lea ebx, [ebx + ebx*4]
|
||||||
add ebx, [sec]
|
add ebx, [sec]
|
||||||
|
|
||||||
mov eax, [ebx+COFF_SECTION.VirtualAddress]
|
mov eax, [ebx + COFF_SECTION.VirtualAddress]
|
||||||
add [edi+COFF_SYM.Value], eax
|
add [edi + COFF_SYM.Value], eax
|
||||||
.next:
|
.next:
|
||||||
add edi, sizeof.COFF_SYM
|
add edi, sizeof.COFF_SYM
|
||||||
mov [symbols], edi
|
mov [symbols], edi
|
||||||
@@ -738,38 +738,38 @@ proc fix_coff_relocs stdcall uses ebx esi, coff:dword, sym:dword, \
|
|||||||
endl
|
endl
|
||||||
|
|
||||||
mov eax, [coff]
|
mov eax, [coff]
|
||||||
movzx ebx, [eax+COFF_HEADER.nSections]
|
movzx ebx, [eax + COFF_HEADER.nSections]
|
||||||
mov [n_sec], ebx
|
mov [n_sec], ebx
|
||||||
lea esi, [eax+20]
|
lea esi, [eax+20]
|
||||||
.fix_sec:
|
.fix_sec:
|
||||||
mov edi, [esi+COFF_SECTION.PtrReloc]
|
mov edi, [esi + COFF_SECTION.PtrReloc]
|
||||||
add edi, [coff]
|
add edi, [coff]
|
||||||
|
|
||||||
movzx ecx, [esi+COFF_SECTION.NumReloc]
|
movzx ecx, [esi + COFF_SECTION.NumReloc]
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz .next
|
jz .next
|
||||||
.reloc_loop:
|
.reloc_loop:
|
||||||
mov ebx, [edi+COFF_RELOC.SymIndex]
|
mov ebx, [edi + COFF_RELOC.SymIndex]
|
||||||
add ebx, ebx
|
add ebx, ebx
|
||||||
lea ebx, [ebx+ebx*8]
|
lea ebx, [ebx+ebx*8]
|
||||||
add ebx, [sym]
|
add ebx, [sym]
|
||||||
|
|
||||||
mov edx, [ebx+COFF_SYM.Value]
|
mov edx, [ebx + COFF_SYM.Value]
|
||||||
|
|
||||||
cmp [edi+COFF_RELOC.Type], 6
|
cmp [edi + COFF_RELOC.Type], 6
|
||||||
je .dir_32
|
je .dir_32
|
||||||
|
|
||||||
cmp [edi+COFF_RELOC.Type], 20
|
cmp [edi + COFF_RELOC.Type], 20
|
||||||
jne .next_reloc
|
jne .next_reloc
|
||||||
.rel_32:
|
.rel_32:
|
||||||
mov eax, [edi+COFF_RELOC.VirtualAddress]
|
mov eax, [edi + COFF_RELOC.VirtualAddress]
|
||||||
add eax, [esi+COFF_SECTION.VirtualAddress]
|
add eax, [esi + COFF_SECTION.VirtualAddress]
|
||||||
sub edx, eax
|
sub edx, eax
|
||||||
sub edx, 4
|
sub edx, 4
|
||||||
jmp .fix
|
jmp .fix
|
||||||
.dir_32:
|
.dir_32:
|
||||||
mov eax, [edi+COFF_RELOC.VirtualAddress]
|
mov eax, [edi + COFF_RELOC.VirtualAddress]
|
||||||
add eax, [esi+COFF_SECTION.VirtualAddress]
|
add eax, [esi + COFF_SECTION.VirtualAddress]
|
||||||
.fix:
|
.fix:
|
||||||
add eax, [delta]
|
add eax, [delta]
|
||||||
add [eax], edx
|
add [eax], edx
|
||||||
@@ -793,24 +793,24 @@ proc rebase_coff stdcall uses ebx esi, coff:dword, sym:dword, \
|
|||||||
endl
|
endl
|
||||||
|
|
||||||
mov eax, [coff]
|
mov eax, [coff]
|
||||||
movzx ebx, [eax+COFF_HEADER.nSections]
|
movzx ebx, [eax + COFF_HEADER.nSections]
|
||||||
mov [n_sec], ebx
|
mov [n_sec], ebx
|
||||||
lea esi, [eax+20]
|
lea esi, [eax+20]
|
||||||
mov edx, [delta]
|
mov edx, [delta]
|
||||||
.fix_sec:
|
.fix_sec:
|
||||||
mov edi, [esi+COFF_SECTION.PtrReloc]
|
mov edi, [esi + COFF_SECTION.PtrReloc]
|
||||||
add edi, [coff]
|
add edi, [coff]
|
||||||
|
|
||||||
movzx ecx, [esi+COFF_SECTION.NumReloc]
|
movzx ecx, [esi + COFF_SECTION.NumReloc]
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz .next
|
jz .next
|
||||||
.reloc_loop:
|
.reloc_loop:
|
||||||
cmp [edi+COFF_RELOC.Type], 6
|
cmp [edi + COFF_RELOC.Type], 6
|
||||||
jne .next_reloc
|
jne .next_reloc
|
||||||
.dir_32:
|
.dir_32:
|
||||||
mov eax, [edi+COFF_RELOC.VirtualAddress]
|
mov eax, [edi + COFF_RELOC.VirtualAddress]
|
||||||
add eax, [esi+COFF_SECTION.VirtualAddress]
|
add eax, [esi + COFF_SECTION.VirtualAddress]
|
||||||
add [eax+edx], edx
|
add [eax + edx], edx
|
||||||
.next_reloc:
|
.next_reloc:
|
||||||
add edi, 10
|
add edi, 10
|
||||||
dec ecx
|
dec ecx
|
||||||
@@ -831,7 +831,7 @@ coff_get_align:
|
|||||||
; - if alignment is given and is no more than 4K, use it;
|
; - if alignment is given and is no more than 4K, use it;
|
||||||
; - if alignment is more than 4K, revert to 4K.
|
; - if alignment is more than 4K, revert to 4K.
|
||||||
push ecx
|
push ecx
|
||||||
mov cl, byte [edx+COFF_SECTION.Characteristics+2]
|
mov cl, byte [edx + COFF_SECTION.Characteristics+2]
|
||||||
mov eax, 1
|
mov eax, 1
|
||||||
shr cl, 4
|
shr cl, 4
|
||||||
dec cl
|
dec cl
|
||||||
@@ -871,26 +871,26 @@ proc load_library stdcall, file_name:dword, encoding:dword
|
|||||||
cli
|
cli
|
||||||
mov esi, [current_process]
|
mov esi, [current_process]
|
||||||
mov edi, [fullname]
|
mov edi, [fullname]
|
||||||
mov ebx, [esi+PROC.dlls_list_ptr]
|
mov ebx, [esi + PROC.dlls_list_ptr]
|
||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
jz .not_in_process
|
jz .not_in_process
|
||||||
mov esi, [ebx+HDLL.fd]
|
mov esi, [ebx + HDLL.fd]
|
||||||
.scan_in_process:
|
.scan_in_process:
|
||||||
cmp esi, ebx
|
cmp esi, ebx
|
||||||
jz .not_in_process
|
jz .not_in_process
|
||||||
mov eax, [esi+HDLL.parent]
|
mov eax, [esi + HDLL.parent]
|
||||||
add eax, DLLDESCR.name
|
add eax, DLLDESCR.name
|
||||||
stdcall strncmp, eax, edi, -1
|
stdcall strncmp, eax, edi, -1
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .next_in_process
|
jnz .next_in_process
|
||||||
; simple variant: load DLL which is already loaded in this process
|
; simple variant: load DLL which is already loaded in this process
|
||||||
; just increment reference counters and return address of exports table
|
; just increment reference counters and return address of exports table
|
||||||
inc [esi+HDLL.refcount]
|
inc [esi + HDLL.refcount]
|
||||||
mov ecx, [esi+HDLL.parent]
|
mov ecx, [esi + HDLL.parent]
|
||||||
inc [ecx+DLLDESCR.refcount]
|
inc [ecx + DLLDESCR.refcount]
|
||||||
mov eax, [ecx+DLLDESCR.exports]
|
mov eax, [ecx + DLLDESCR.exports]
|
||||||
sub eax, [ecx+DLLDESCR.defaultbase]
|
sub eax, [ecx + DLLDESCR.defaultbase]
|
||||||
add eax, [esi+HDLL.base]
|
add eax, [esi + HDLL.base]
|
||||||
sti
|
sti
|
||||||
push eax
|
push eax
|
||||||
stdcall kernel_free, [fullname]
|
stdcall kernel_free, [fullname]
|
||||||
@@ -898,7 +898,7 @@ proc load_library stdcall, file_name:dword, encoding:dword
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.next_in_process:
|
.next_in_process:
|
||||||
mov esi, [esi+HDLL.fd]
|
mov esi, [esi + HDLL.fd]
|
||||||
jmp .scan_in_process
|
jmp .scan_in_process
|
||||||
|
|
||||||
.not_in_process:
|
.not_in_process:
|
||||||
@@ -913,19 +913,19 @@ proc load_library stdcall, file_name:dword, encoding:dword
|
|||||||
.scan_for_dlls:
|
.scan_for_dlls:
|
||||||
cmp esi, dll_list
|
cmp esi, dll_list
|
||||||
jz .load_new
|
jz .load_new
|
||||||
lea eax, [esi+DLLDESCR.name]
|
lea eax, [esi + DLLDESCR.name]
|
||||||
stdcall strncmp, eax, edi, -1
|
stdcall strncmp, eax, edi, -1
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .continue_scan
|
jnz .continue_scan
|
||||||
.test_prev_dll:
|
.test_prev_dll:
|
||||||
mov eax, dword [fileinfo+24]; last modified time
|
mov eax, dword [fileinfo+24]; last modified time
|
||||||
mov edx, dword [fileinfo+28]; last modified date
|
mov edx, dword [fileinfo+28]; last modified date
|
||||||
cmp dword [esi+DLLDESCR.timestamp], eax
|
cmp dword [esi + DLLDESCR.timestamp], eax
|
||||||
jnz .continue_scan
|
jnz .continue_scan
|
||||||
cmp dword [esi+DLLDESCR.timestamp+4], edx
|
cmp dword [esi + DLLDESCR.timestamp+4], edx
|
||||||
jz .dll_already_loaded
|
jz .dll_already_loaded
|
||||||
.continue_scan:
|
.continue_scan:
|
||||||
mov esi, [esi+DLLDESCR.fd]
|
mov esi, [esi + DLLDESCR.fd]
|
||||||
jmp .scan_for_dlls
|
jmp .scan_for_dlls
|
||||||
|
|
||||||
; new DLL
|
; new DLL
|
||||||
@@ -944,24 +944,24 @@ proc load_library stdcall, file_name:dword, encoding:dword
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
repnz scasb
|
repnz scasb
|
||||||
not ecx
|
not ecx
|
||||||
lea eax, [ecx+sizeof.DLLDESCR]
|
lea eax, [ecx + sizeof.DLLDESCR]
|
||||||
push ecx
|
push ecx
|
||||||
call malloc
|
call malloc
|
||||||
pop ecx
|
pop ecx
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail_and_free_coff
|
jz .fail_and_free_coff
|
||||||
; save timestamp
|
; save timestamp
|
||||||
lea edi, [eax+DLLDESCR.name]
|
lea edi, [eax + DLLDESCR.name]
|
||||||
rep movsb
|
rep movsb
|
||||||
mov esi, eax
|
mov esi, eax
|
||||||
mov eax, dword [fileinfo+24]
|
mov eax, dword [fileinfo+24]
|
||||||
mov dword [esi+DLLDESCR.timestamp], eax
|
mov dword [esi + DLLDESCR.timestamp], eax
|
||||||
mov eax, dword [fileinfo+28]
|
mov eax, dword [fileinfo+28]
|
||||||
mov dword [esi+DLLDESCR.timestamp+4], eax
|
mov dword [esi + DLLDESCR.timestamp+4], eax
|
||||||
|
|
||||||
; calculate size of loaded DLL
|
; calculate size of loaded DLL
|
||||||
mov edx, [coff]
|
mov edx, [coff]
|
||||||
movzx ecx, [edx+COFF_HEADER.nSections]
|
movzx ecx, [edx + COFF_HEADER.nSections]
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
|
|
||||||
add edx, 20
|
add edx, 20
|
||||||
@@ -970,12 +970,12 @@ proc load_library stdcall, file_name:dword, encoding:dword
|
|||||||
add ebx, eax
|
add ebx, eax
|
||||||
not eax
|
not eax
|
||||||
and ebx, eax
|
and ebx, eax
|
||||||
add ebx, [edx+COFF_SECTION.SizeOfRawData]
|
add ebx, [edx + COFF_SECTION.SizeOfRawData]
|
||||||
add edx, sizeof.COFF_SECTION
|
add edx, sizeof.COFF_SECTION
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz @B
|
jnz @B
|
||||||
; it must be nonzero and not too big
|
; it must be nonzero and not too big
|
||||||
mov [esi+DLLDESCR.size], ebx
|
mov [esi + DLLDESCR.size], ebx
|
||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
jz .fail_and_free_dll
|
jz .fail_and_free_dll
|
||||||
cmp ebx, MAX_DEFAULT_DLL_ADDR-MIN_DEFAULT_DLL_ADDR
|
cmp ebx, MAX_DEFAULT_DLL_ADDR-MIN_DEFAULT_DLL_ADDR
|
||||||
@@ -984,24 +984,24 @@ proc load_library stdcall, file_name:dword, encoding:dword
|
|||||||
stdcall kernel_alloc, ebx
|
stdcall kernel_alloc, ebx
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail_and_free_dll
|
jz .fail_and_free_dll
|
||||||
mov [esi+DLLDESCR.data], eax
|
mov [esi + DLLDESCR.data], eax
|
||||||
; calculate preferred base address
|
; calculate preferred base address
|
||||||
add ebx, 0x1FFF
|
add ebx, 0x1FFF
|
||||||
and ebx, not 0xFFF
|
and ebx, not 0xFFF
|
||||||
mov ecx, [dll_cur_addr]
|
mov ecx, [dll_cur_addr]
|
||||||
lea edx, [ecx+ebx]
|
lea edx, [ecx + ebx]
|
||||||
cmp edx, MAX_DEFAULT_DLL_ADDR
|
cmp edx, MAX_DEFAULT_DLL_ADDR
|
||||||
jb @f
|
jb @f
|
||||||
mov ecx, MIN_DEFAULT_DLL_ADDR
|
mov ecx, MIN_DEFAULT_DLL_ADDR
|
||||||
lea edx, [ecx+ebx]
|
lea edx, [ecx + ebx]
|
||||||
@@:
|
@@:
|
||||||
mov [esi+DLLDESCR.defaultbase], ecx
|
mov [esi + DLLDESCR.defaultbase], ecx
|
||||||
mov [dll_cur_addr], edx
|
mov [dll_cur_addr], edx
|
||||||
|
|
||||||
; copy sections and set correct values for VirtualAddress'es in headers
|
; copy sections and set correct values for VirtualAddress'es in headers
|
||||||
push esi
|
push esi
|
||||||
mov edx, [coff]
|
mov edx, [coff]
|
||||||
movzx ebx, [edx+COFF_HEADER.nSections]
|
movzx ebx, [edx + COFF_HEADER.nSections]
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
add edx, 20
|
add edx, 20
|
||||||
cld
|
cld
|
||||||
@@ -1012,11 +1012,11 @@ proc load_library stdcall, file_name:dword, encoding:dword
|
|||||||
not eax
|
not eax
|
||||||
and ecx, eax
|
and ecx, eax
|
||||||
and edi, eax
|
and edi, eax
|
||||||
mov [edx+COFF_SECTION.VirtualAddress], ecx
|
mov [edx + COFF_SECTION.VirtualAddress], ecx
|
||||||
add ecx, [edx+COFF_SECTION.SizeOfRawData]
|
add ecx, [edx + COFF_SECTION.SizeOfRawData]
|
||||||
mov esi, [edx+COFF_SECTION.PtrRawData]
|
mov esi, [edx + COFF_SECTION.PtrRawData]
|
||||||
push ecx
|
push ecx
|
||||||
mov ecx, [edx+COFF_SECTION.SizeOfRawData]
|
mov ecx, [edx + COFF_SECTION.SizeOfRawData]
|
||||||
test esi, esi
|
test esi, esi
|
||||||
jnz .copy
|
jnz .copy
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
@@ -1036,20 +1036,20 @@ proc load_library stdcall, file_name:dword, encoding:dword
|
|||||||
; later we will use COFF header, headers for sections and symbol table
|
; later we will use COFF header, headers for sections and symbol table
|
||||||
; and also relocations table for all sections
|
; and also relocations table for all sections
|
||||||
mov edx, [coff]
|
mov edx, [coff]
|
||||||
mov ebx, [edx+COFF_HEADER.pSymTable]
|
mov ebx, [edx + COFF_HEADER.pSymTable]
|
||||||
mov edi, dword [fileinfo+32]
|
mov edi, dword [fileinfo+32]
|
||||||
sub edi, ebx
|
sub edi, ebx
|
||||||
jc .fail_and_free_data
|
jc .fail_and_free_data
|
||||||
mov [esi+DLLDESCR.symbols_lim], edi
|
mov [esi + DLLDESCR.symbols_lim], edi
|
||||||
add ebx, edx
|
add ebx, edx
|
||||||
movzx ecx, [edx+COFF_HEADER.nSections]
|
movzx ecx, [edx + COFF_HEADER.nSections]
|
||||||
lea ecx, [ecx*5]
|
lea ecx, [ecx*5]
|
||||||
lea edi, [edi+ecx*8+20]
|
lea edi, [edi + ecx*8+20]
|
||||||
add edx, 20
|
add edx, 20
|
||||||
@@:
|
@@:
|
||||||
movzx eax, [edx+COFF_SECTION.NumReloc]
|
movzx eax, [edx + COFF_SECTION.NumReloc]
|
||||||
lea eax, [eax*5]
|
lea eax, [eax*5]
|
||||||
lea edi, [edi+eax*2]
|
lea edi, [edi + eax*2]
|
||||||
add edx, sizeof.COFF_SECTION
|
add edx, sizeof.COFF_SECTION
|
||||||
sub ecx, 5
|
sub ecx, 5
|
||||||
jnz @b
|
jnz @b
|
||||||
@@ -1057,33 +1057,33 @@ proc load_library stdcall, file_name:dword, encoding:dword
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail_and_free_data
|
jz .fail_and_free_data
|
||||||
mov edx, [coff]
|
mov edx, [coff]
|
||||||
movzx ecx, [edx+COFF_HEADER.nSections]
|
movzx ecx, [edx + COFF_HEADER.nSections]
|
||||||
lea ecx, [ecx*5]
|
lea ecx, [ecx*5]
|
||||||
lea ecx, [ecx*2+5]
|
lea ecx, [ecx*2+5]
|
||||||
mov [esi+DLLDESCR.coff_hdr], eax
|
mov [esi + DLLDESCR.coff_hdr], eax
|
||||||
push esi
|
push esi
|
||||||
mov esi, edx
|
mov esi, edx
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
rep movsd
|
rep movsd
|
||||||
pop esi
|
pop esi
|
||||||
mov [esi+DLLDESCR.symbols_ptr], edi
|
mov [esi + DLLDESCR.symbols_ptr], edi
|
||||||
push esi
|
push esi
|
||||||
mov ecx, [edx+COFF_HEADER.nSymbols]
|
mov ecx, [edx+COFF_HEADER.nSymbols]
|
||||||
mov [esi+DLLDESCR.symbols_num], ecx
|
mov [esi + DLLDESCR.symbols_num], ecx
|
||||||
mov ecx, [esi+DLLDESCR.symbols_lim]
|
mov ecx, [esi + DLLDESCR.symbols_lim]
|
||||||
mov esi, ebx
|
mov esi, ebx
|
||||||
rep movsb
|
rep movsb
|
||||||
pop esi
|
pop esi
|
||||||
mov ebx, [esi+DLLDESCR.coff_hdr]
|
mov ebx, [esi + DLLDESCR.coff_hdr]
|
||||||
push esi
|
push esi
|
||||||
movzx eax, [edx+COFF_HEADER.nSections]
|
movzx eax, [edx + COFF_HEADER.nSections]
|
||||||
lea edx, [ebx+20]
|
lea edx, [ebx+20]
|
||||||
@@:
|
@@:
|
||||||
movzx ecx, [edx+COFF_SECTION.NumReloc]
|
movzx ecx, [edx + COFF_SECTION.NumReloc]
|
||||||
lea ecx, [ecx*5]
|
lea ecx, [ecx*5]
|
||||||
mov esi, [edx+COFF_SECTION.PtrReloc]
|
mov esi, [edx + COFF_SECTION.PtrReloc]
|
||||||
mov [edx+COFF_SECTION.PtrReloc], edi
|
mov [edx + COFF_SECTION.PtrReloc], edi
|
||||||
sub [edx+COFF_SECTION.PtrReloc], ebx
|
sub [edx + COFF_SECTION.PtrReloc], ebx
|
||||||
add esi, [coff]
|
add esi, [coff]
|
||||||
shr ecx, 1
|
shr ecx, 1
|
||||||
rep movsd
|
rep movsd
|
||||||
@@ -1096,53 +1096,53 @@ proc load_library stdcall, file_name:dword, encoding:dword
|
|||||||
|
|
||||||
; fixup symbols
|
; fixup symbols
|
||||||
mov edx, ebx
|
mov edx, ebx
|
||||||
mov eax, [ebx+COFF_HEADER.nSymbols]
|
mov eax, [ebx + COFF_HEADER.nSymbols]
|
||||||
add edx, 20
|
add edx, 20
|
||||||
mov ecx, [esi+DLLDESCR.symbols_num]
|
mov ecx, [esi + DLLDESCR.symbols_num]
|
||||||
lea ecx, [ecx*9]
|
lea ecx, [ecx*9]
|
||||||
add ecx, ecx
|
add ecx, ecx
|
||||||
add ecx, [esi+DLLDESCR.symbols_ptr]
|
add ecx, [esi + DLLDESCR.symbols_ptr]
|
||||||
|
|
||||||
stdcall fix_coff_symbols, edx, [esi+DLLDESCR.symbols_ptr], eax, \
|
stdcall fix_coff_symbols, edx, [esi + DLLDESCR.symbols_ptr], eax, \
|
||||||
ecx, 0
|
ecx, 0
|
||||||
; test eax, eax
|
; test eax, eax
|
||||||
; jnz @F
|
; jnz @F
|
||||||
;
|
;
|
||||||
;@@:
|
;@@:
|
||||||
|
|
||||||
stdcall get_coff_sym, [esi+DLLDESCR.symbols_ptr], [ebx+COFF_HEADER.nSymbols], szEXPORTS
|
stdcall get_coff_sym, [esi + DLLDESCR.symbols_ptr], [ebx + COFF_HEADER.nSymbols], szEXPORTS
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz @F
|
jnz @F
|
||||||
|
|
||||||
stdcall get_coff_sym, [esi+DLLDESCR.symbols_ptr], [ebx+COFF_HEADER.nSymbols], sz_EXPORTS
|
stdcall get_coff_sym, [esi + DLLDESCR.symbols_ptr], [ebx + COFF_HEADER.nSymbols], sz_EXPORTS
|
||||||
@@:
|
@@:
|
||||||
mov [esi+DLLDESCR.exports], eax
|
mov [esi + DLLDESCR.exports], eax
|
||||||
|
|
||||||
; fix relocs in the hidden copy in kernel memory to default address
|
; fix relocs in the hidden copy in kernel memory to default address
|
||||||
; it is first fix; usually this will be enough, but second fix
|
; it is first fix; usually this will be enough, but second fix
|
||||||
; can be necessary if real load address will not equal assumption
|
; can be necessary if real load address will not equal assumption
|
||||||
mov eax, [esi+DLLDESCR.data]
|
mov eax, [esi + DLLDESCR.data]
|
||||||
sub eax, [esi+DLLDESCR.defaultbase]
|
sub eax, [esi + DLLDESCR.defaultbase]
|
||||||
stdcall fix_coff_relocs, ebx, [esi+DLLDESCR.symbols_ptr], eax
|
stdcall fix_coff_relocs, ebx, [esi + DLLDESCR.symbols_ptr], eax
|
||||||
|
|
||||||
stdcall kernel_free, [coff]
|
stdcall kernel_free, [coff]
|
||||||
|
|
||||||
cli
|
cli
|
||||||
; initialize DLLDESCR struct
|
; initialize DLLDESCR struct
|
||||||
and dword [esi+DLLDESCR.refcount], 0; no HDLLs yet; later it will be incremented
|
and dword [esi + DLLDESCR.refcount], 0; no HDLLs yet; later it will be incremented
|
||||||
mov [esi+DLLDESCR.fd], dll_list
|
mov [esi + DLLDESCR.fd], dll_list
|
||||||
mov eax, [dll_list.bk]
|
mov eax, [dll_list.bk]
|
||||||
mov [dll_list.bk], esi
|
mov [dll_list.bk], esi
|
||||||
mov [esi+DLLDESCR.bk], eax
|
mov [esi + DLLDESCR.bk], eax
|
||||||
mov [eax+DLLDESCR.fd], esi
|
mov [eax + DLLDESCR.fd], esi
|
||||||
.dll_already_loaded:
|
.dll_already_loaded:
|
||||||
stdcall kernel_free, [fullname]
|
stdcall kernel_free, [fullname]
|
||||||
inc [esi+DLLDESCR.refcount]
|
inc [esi + DLLDESCR.refcount]
|
||||||
push esi
|
push esi
|
||||||
call init_heap
|
call init_heap
|
||||||
pop esi
|
pop esi
|
||||||
mov edi, [esi+DLLDESCR.size]
|
mov edi, [esi + DLLDESCR.size]
|
||||||
stdcall user_alloc_at, [esi+DLLDESCR.defaultbase], edi
|
stdcall user_alloc_at, [esi + DLLDESCR.defaultbase], edi
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz @f
|
jnz @f
|
||||||
stdcall user_alloc, edi
|
stdcall user_alloc, edi
|
||||||
@@ -1157,36 +1157,36 @@ proc load_library stdcall, file_name:dword, encoding:dword
|
|||||||
mov ebx, [current_slot_idx]
|
mov ebx, [current_slot_idx]
|
||||||
shl ebx, BSF sizeof.APPDATA
|
shl ebx, BSF sizeof.APPDATA
|
||||||
mov edx, [SLOT_BASE + ebx + APPDATA.tid]
|
mov edx, [SLOT_BASE + ebx + APPDATA.tid]
|
||||||
mov [eax+HDLL.pid], edx
|
mov [eax + HDLL.pid], edx
|
||||||
push eax
|
push eax
|
||||||
call init_dlls_in_thread
|
call init_dlls_in_thread
|
||||||
pop ebx
|
pop ebx
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail_and_free_user
|
jz .fail_and_free_user
|
||||||
mov edx, [eax+HDLL.fd]
|
mov edx, [eax + HDLL.fd]
|
||||||
mov [ebx+HDLL.fd], edx
|
mov [ebx + HDLL.fd], edx
|
||||||
mov [ebx+HDLL.bk], eax
|
mov [ebx + HDLL.bk], eax
|
||||||
mov [eax+HDLL.fd], ebx
|
mov [eax + HDLL.fd], ebx
|
||||||
mov [edx+HDLL.bk], ebx
|
mov [edx + HDLL.bk], ebx
|
||||||
mov eax, ebx
|
mov eax, ebx
|
||||||
mov ebx, [img_base]
|
mov ebx, [img_base]
|
||||||
mov [eax+HDLL.base], ebx
|
mov [eax + HDLL.base], ebx
|
||||||
mov [eax+HDLL.size], edi
|
mov [eax + HDLL.size], edi
|
||||||
mov [eax+HDLL.refcount], 1
|
mov [eax + HDLL.refcount], 1
|
||||||
mov [eax+HDLL.parent], esi
|
mov [eax + HDLL.parent], esi
|
||||||
mov edx, ebx
|
mov edx, ebx
|
||||||
shr edx, 12
|
shr edx, 12
|
||||||
or dword [page_tabs+(edx-1)*4], MEM_BLOCK_DONT_FREE
|
or dword [page_tabs + (edx-1)*4], MEM_BLOCK_DONT_FREE
|
||||||
; copy entries of page table from kernel-side image to usermode
|
; copy entries of page table from kernel-side image to usermode
|
||||||
; use copy-on-write for user-mode image, so map as readonly
|
; use copy-on-write for user-mode image, so map as readonly
|
||||||
xor edi, edi
|
xor edi, edi
|
||||||
mov ecx, [esi+DLLDESCR.data]
|
mov ecx, [esi + DLLDESCR.data]
|
||||||
shr ecx, 12
|
shr ecx, 12
|
||||||
.map_pages_loop:
|
.map_pages_loop:
|
||||||
mov eax, [page_tabs+ecx*4]
|
mov eax, [page_tabs + ecx*4]
|
||||||
and eax, not 0xFFF
|
and eax, not 0xFFF
|
||||||
or al, PG_UR
|
or al, PG_UR
|
||||||
xchg eax, [page_tabs+edx*4]
|
xchg eax, [page_tabs + edx*4]
|
||||||
test al, 1
|
test al, 1
|
||||||
jz @f
|
jz @f
|
||||||
call free_page
|
call free_page
|
||||||
@@ -1195,23 +1195,23 @@ proc load_library stdcall, file_name:dword, encoding:dword
|
|||||||
inc ecx
|
inc ecx
|
||||||
inc edx
|
inc edx
|
||||||
add edi, 0x1000
|
add edi, 0x1000
|
||||||
cmp edi, [esi+DLLDESCR.size]
|
cmp edi, [esi + DLLDESCR.size]
|
||||||
jb .map_pages_loop
|
jb .map_pages_loop
|
||||||
|
|
||||||
; if real user-mode base is not equal to preferred base, relocate image
|
; if real user-mode base is not equal to preferred base, relocate image
|
||||||
sub ebx, [esi+DLLDESCR.defaultbase]
|
sub ebx, [esi + DLLDESCR.defaultbase]
|
||||||
jz @f
|
jz @f
|
||||||
stdcall rebase_coff, [esi+DLLDESCR.coff_hdr], [esi+DLLDESCR.symbols_ptr], ebx
|
stdcall rebase_coff, [esi + DLLDESCR.coff_hdr], [esi + DLLDESCR.symbols_ptr], ebx
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
mov eax, [esi+DLLDESCR.exports]
|
mov eax, [esi + DLLDESCR.exports]
|
||||||
sub eax, [esi+DLLDESCR.defaultbase]
|
sub eax, [esi + DLLDESCR.defaultbase]
|
||||||
add eax, [img_base]
|
add eax, [img_base]
|
||||||
sti
|
sti
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.fail_and_free_data:
|
.fail_and_free_data:
|
||||||
stdcall kernel_free, [esi+DLLDESCR.data]
|
stdcall kernel_free, [esi + DLLDESCR.data]
|
||||||
.fail_and_free_dll:
|
.fail_and_free_dll:
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
call free
|
call free
|
||||||
@@ -1239,7 +1239,7 @@ endp
|
|||||||
; NULL if memory allocation failed
|
; NULL if memory allocation failed
|
||||||
init_dlls_in_thread:
|
init_dlls_in_thread:
|
||||||
mov ebx, [current_process]
|
mov ebx, [current_process]
|
||||||
mov eax, [ebx+PROC.dlls_list_ptr]
|
mov eax, [ebx + PROC.dlls_list_ptr]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .ret
|
jnz .ret
|
||||||
|
|
||||||
@@ -1252,20 +1252,20 @@ init_dlls_in_thread:
|
|||||||
mov [eax+4], eax
|
mov [eax+4], eax
|
||||||
|
|
||||||
mov ebx, [current_process]
|
mov ebx, [current_process]
|
||||||
mov [ebx+PROC.dlls_list_ptr], eax
|
mov [ebx + PROC.dlls_list_ptr], eax
|
||||||
.ret:
|
.ret:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; in: eax = number of references to delete, esi -> DLLDESCR struc
|
; in: eax = number of references to delete, esi -> DLLDESCR struc
|
||||||
dereference_dll:
|
dereference_dll:
|
||||||
sub [esi+DLLDESCR.refcount], eax
|
sub [esi + DLLDESCR.refcount], eax
|
||||||
jnz .ret
|
jnz .ret
|
||||||
mov eax, [esi+DLLDESCR.fd]
|
mov eax, [esi + DLLDESCR.fd]
|
||||||
mov edx, [esi+DLLDESCR.bk]
|
mov edx, [esi + DLLDESCR.bk]
|
||||||
mov [eax+DLLDESCR.bk], edx
|
mov [eax + DLLDESCR.bk], edx
|
||||||
mov [edx+DLLDESCR.fd], eax
|
mov [edx + DLLDESCR.fd], eax
|
||||||
stdcall kernel_free, [esi+DLLDESCR.coff_hdr]
|
stdcall kernel_free, [esi + DLLDESCR.coff_hdr]
|
||||||
stdcall kernel_free, [esi+DLLDESCR.data]
|
stdcall kernel_free, [esi + DLLDESCR.data]
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
call free
|
call free
|
||||||
.ret:
|
.ret:
|
||||||
@@ -1273,19 +1273,19 @@ dereference_dll:
|
|||||||
|
|
||||||
destroy_hdll:
|
destroy_hdll:
|
||||||
push ebx ecx esi edi
|
push ebx ecx esi edi
|
||||||
mov ebx, [eax+HDLL.base]
|
mov ebx, [eax + HDLL.base]
|
||||||
mov esi, [eax+HDLL.parent]
|
mov esi, [eax + HDLL.parent]
|
||||||
mov edx, [esi+DLLDESCR.size]
|
mov edx, [esi + DLLDESCR.size]
|
||||||
|
|
||||||
push eax
|
push eax
|
||||||
mov esi, [eax+HDLL.parent]
|
mov esi, [eax + HDLL.parent]
|
||||||
mov eax, [eax+HDLL.refcount]
|
mov eax, [eax + HDLL.refcount]
|
||||||
call dereference_dll
|
call dereference_dll
|
||||||
pop eax
|
pop eax
|
||||||
mov edx, [eax+HDLL.bk]
|
mov edx, [eax + HDLL.bk]
|
||||||
mov ebx, [eax+HDLL.fd]
|
mov ebx, [eax + HDLL.fd]
|
||||||
mov [ebx+HDLL.bk], edx
|
mov [ebx + HDLL.bk], edx
|
||||||
mov [edx+HDLL.fd], ebx
|
mov [edx + HDLL.fd], ebx
|
||||||
call free
|
call free
|
||||||
pop edi esi ecx ebx
|
pop edi esi ecx ebx
|
||||||
ret
|
ret
|
||||||
@@ -1295,7 +1295,7 @@ destroy_all_hdlls:
|
|||||||
test esi, esi
|
test esi, esi
|
||||||
jz .ret
|
jz .ret
|
||||||
.loop:
|
.loop:
|
||||||
mov eax, [esi+HDLL.fd]
|
mov eax, [esi + HDLL.fd]
|
||||||
cmp eax, esi
|
cmp eax, esi
|
||||||
jz free
|
jz free
|
||||||
call destroy_hdll
|
call destroy_hdll
|
||||||
@@ -1321,13 +1321,13 @@ create_kernel_object:
|
|||||||
|
|
||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
mov edx, [ecx+APPOBJ.fd]
|
mov edx, [ecx + APPOBJ.fd]
|
||||||
mov [eax+APPOBJ.fd], edx
|
mov [eax + APPOBJ.fd], edx
|
||||||
mov [eax+APPOBJ.bk], ecx
|
mov [eax + APPOBJ.bk], ecx
|
||||||
mov [eax+APPOBJ.pid], ebx
|
mov [eax + APPOBJ.pid], ebx
|
||||||
|
|
||||||
mov [ecx+APPOBJ.fd], eax
|
mov [ecx + APPOBJ.fd], eax
|
||||||
mov [edx+APPOBJ.bk], eax
|
mov [edx + APPOBJ.bk], eax
|
||||||
popfd
|
popfd
|
||||||
.fail:
|
.fail:
|
||||||
ret
|
ret
|
||||||
@@ -1340,10 +1340,10 @@ destroy_kernel_object:
|
|||||||
|
|
||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
mov ebx, [eax+APPOBJ.fd]
|
mov ebx, [eax + APPOBJ.fd]
|
||||||
mov ecx, [eax+APPOBJ.bk]
|
mov ecx, [eax + APPOBJ.bk]
|
||||||
mov [ebx+APPOBJ.bk], ecx
|
mov [ebx + APPOBJ.bk], ecx
|
||||||
mov [ecx+APPOBJ.fd], ebx
|
mov [ecx + APPOBJ.fd], ebx
|
||||||
popfd
|
popfd
|
||||||
|
|
||||||
xor edx, edx ;clear common header
|
xor edx, edx ;clear common header
|
||||||
@@ -1370,14 +1370,14 @@ create_object:
|
|||||||
cli
|
cli
|
||||||
|
|
||||||
mov esi, [current_process]
|
mov esi, [current_process]
|
||||||
mov eax, [esi+PROC.ht_free]
|
mov eax, [esi + PROC.ht_free]
|
||||||
mov edi, [esi+PROC.ht_next]
|
mov edi, [esi + PROC.ht_next]
|
||||||
dec eax
|
dec eax
|
||||||
js .err0
|
js .err0
|
||||||
|
|
||||||
mov [esi+PROC.ht_free], eax
|
mov [esi + PROC.ht_free], eax
|
||||||
mov eax, [esi+PROC.htab+edi*4]
|
mov eax, [esi + PROC.htab + edi*4]
|
||||||
mov [esi+PROC.ht_next], eax
|
mov [esi + PROC.ht_next], eax
|
||||||
popfd
|
popfd
|
||||||
|
|
||||||
mov eax, ecx
|
mov eax, ecx
|
||||||
@@ -1385,8 +1385,8 @@ create_object:
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .err1
|
jz .err1
|
||||||
|
|
||||||
mov [eax+FUTEX.handle], edi
|
mov [eax + FUTEX.handle], edi
|
||||||
mov [esi+PROC.htab+edi*4], eax
|
mov [esi + PROC.htab+edi*4], eax
|
||||||
pop edi
|
pop edi
|
||||||
pop esi
|
pop esi
|
||||||
ret
|
ret
|
||||||
@@ -1395,10 +1395,10 @@ create_object:
|
|||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
|
|
||||||
mov eax, [esi+PROC.ht_next]
|
mov eax, [esi + PROC.ht_next]
|
||||||
mov [esi+PROC.htab+edi*4], eax
|
mov [esi + PROC.htab+edi*4], eax
|
||||||
mov [esi+PROC.ht_next], edi
|
mov [esi + PROC.ht_next], edi
|
||||||
inc [esi+PROC.ht_free]
|
inc [esi + PROC.ht_free]
|
||||||
.err0:
|
.err0:
|
||||||
popfd
|
popfd
|
||||||
pop edi
|
pop edi
|
||||||
@@ -1413,15 +1413,15 @@ align 4
|
|||||||
destroy_object:
|
destroy_object:
|
||||||
push esi
|
push esi
|
||||||
mov esi, [current_process]
|
mov esi, [current_process]
|
||||||
mov edx, [ecx+FUTEX.handle]
|
mov edx, [ecx + FUTEX.handle]
|
||||||
|
|
||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
|
|
||||||
mov eax, [esi+PROC.ht_next]
|
mov eax, [esi + PROC.ht_next]
|
||||||
mov [esi+PROC.htab+edx*4], eax
|
mov [esi + PROC.htab + edx*4], eax
|
||||||
mov [esi+PROC.ht_next], edx
|
mov [esi + PROC.ht_next], edx
|
||||||
inc [esi+PROC.ht_free]
|
inc [esi + PROC.ht_free]
|
||||||
|
|
||||||
popfd
|
popfd
|
||||||
pop esi
|
pop esi
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -17,16 +17,16 @@ macro export dllname,[label,string]
|
|||||||
forward
|
forward
|
||||||
count = count+1
|
count = count+1
|
||||||
common
|
common
|
||||||
dd 0,0,0, (module-OS_BASE) , 1
|
dd 0,0,0, (module - OS_BASE) , 1
|
||||||
dd count,count,(addresses-OS_BASE),(names-OS_BASE),(ordinal-OS_BASE)
|
dd count,count,(addresses - OS_BASE),(names - OS_BASE),(ordinal - OS_BASE)
|
||||||
addresses:
|
addresses:
|
||||||
forward
|
forward
|
||||||
dd (label-OS_BASE)
|
dd (label - OS_BASE)
|
||||||
common
|
common
|
||||||
names:
|
names:
|
||||||
forward
|
forward
|
||||||
local name
|
local name
|
||||||
dd (name-OS_BASE)
|
dd (name - OS_BASE)
|
||||||
common
|
common
|
||||||
ordinal:
|
ordinal:
|
||||||
count = 0
|
count = 0
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -75,12 +75,12 @@ proc load_k_library stdcall, file_name:dword
|
|||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
mov [coff], eax
|
mov [coff], eax
|
||||||
movzx ecx, [eax+CFH.nSections]
|
movzx ecx, [eax + CFH.nSections]
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
|
|
||||||
lea edx, [eax+20]
|
lea edx, [eax+20]
|
||||||
@@:
|
@@:
|
||||||
add ebx, [edx+CFS.SizeOfRawData]
|
add ebx, [edx + CFS.SizeOfRawData]
|
||||||
add ebx, 15
|
add ebx, 15
|
||||||
and ebx, not 15
|
and ebx, not 15
|
||||||
add edx, COFF_SECTION_SIZE
|
add edx, COFF_SECTION_SIZE
|
||||||
@@ -95,19 +95,19 @@ proc load_k_library stdcall, file_name:dword
|
|||||||
mov [img_base], eax
|
mov [img_base], eax
|
||||||
|
|
||||||
mov edx, [coff]
|
mov edx, [coff]
|
||||||
movzx ebx, [edx+CFH.nSections]
|
movzx ebx, [edx + CFH.nSections]
|
||||||
mov edi, [img_base]
|
mov edi, [img_base]
|
||||||
lea eax, [edx+20]
|
lea eax, [edx+20]
|
||||||
@@:
|
@@:
|
||||||
mov [eax+CFS.VirtualAddress], edi
|
mov [eax + CFS.VirtualAddress], edi
|
||||||
mov esi, [eax+CFS.PtrRawData]
|
mov esi, [eax + CFS.PtrRawData]
|
||||||
test esi, esi
|
test esi, esi
|
||||||
jnz .copy
|
jnz .copy
|
||||||
add edi, [eax+CFS.SizeOfRawData]
|
add edi, [eax + CFS.SizeOfRawData]
|
||||||
jmp .next
|
jmp .next
|
||||||
.copy:
|
.copy:
|
||||||
add esi, edx
|
add esi, edx
|
||||||
mov ecx, [eax+CFS.SizeOfRawData]
|
mov ecx, [eax + CFS.SizeOfRawData]
|
||||||
cld
|
cld
|
||||||
rep movsb
|
rep movsb
|
||||||
.next:
|
.next:
|
||||||
@@ -117,29 +117,29 @@ proc load_k_library stdcall, file_name:dword
|
|||||||
dec ebx
|
dec ebx
|
||||||
jnz @B
|
jnz @B
|
||||||
|
|
||||||
mov ebx, [edx+CFH.pSymTable]
|
mov ebx, [edx + CFH.pSymTable]
|
||||||
add ebx, edx
|
add ebx, edx
|
||||||
mov [sym], ebx
|
mov [sym], ebx
|
||||||
mov ecx, [edx+CFH.nSymbols]
|
mov ecx, [edx + CFH.nSymbols]
|
||||||
add ecx, ecx
|
add ecx, ecx
|
||||||
lea ecx, [ecx+ecx*8];ecx*=18 = nSymbols*CSYM_SIZE
|
lea ecx, [ecx + ecx*8];ecx*=18 = nSymbols*CSYM_SIZE
|
||||||
add ecx, [sym]
|
add ecx, [sym]
|
||||||
mov [strings], ecx
|
mov [strings], ecx
|
||||||
|
|
||||||
lea eax, [edx+20]
|
lea eax, [edx+20]
|
||||||
|
|
||||||
stdcall fix_coff_symbols, eax, [sym], [edx+CFH.nSymbols], \
|
stdcall fix_coff_symbols, eax, [sym], [edx + CFH.nSymbols], \
|
||||||
[strings], dword 0
|
[strings], dword 0
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz @F
|
jnz @F
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
mov edx, [coff]
|
mov edx, [coff]
|
||||||
movzx ebx, [edx+CFH.nSections]
|
movzx ebx, [edx + CFH.nSections]
|
||||||
mov edi, 0
|
mov edi, 0
|
||||||
lea eax, [edx+20]
|
lea eax, [edx+20]
|
||||||
@@:
|
@@:
|
||||||
add [eax+CFS.VirtualAddress], edi ;patch user space offset
|
add [eax + CFS.VirtualAddress], edi ;patch user space offset
|
||||||
add eax, COFF_SECTION_SIZE
|
add eax, COFF_SECTION_SIZE
|
||||||
dec ebx
|
dec ebx
|
||||||
jnz @B
|
jnz @B
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2017. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -177,14 +177,14 @@ fpu_save:
|
|||||||
.save:
|
.save:
|
||||||
mov [fpu_owner], esi
|
mov [fpu_owner], esi
|
||||||
|
|
||||||
shl ecx, 8
|
shl ecx, BSF sizeof.APPDATA
|
||||||
mov eax, [ecx+SLOT_BASE+APPDATA.fpu_state]
|
mov eax, [SLOT_BASE + ecx + APPDATA.fpu_state]
|
||||||
|
|
||||||
call save_context
|
call save_context
|
||||||
|
|
||||||
; first 512 bytes of XSAVE area have the same format as FXSAVE
|
; first 512 bytes of XSAVE area have the same format as FXSAVE
|
||||||
shl esi, 8
|
shl esi, BSF sizeof.APPDATA
|
||||||
mov esi, [esi+SLOT_BASE+APPDATA.fpu_state]
|
mov esi, [SLOT_BASE + esi + APPDATA.fpu_state]
|
||||||
mov ecx, 512/4
|
mov ecx, 512/4
|
||||||
cld
|
cld
|
||||||
rep movsd
|
rep movsd
|
||||||
@@ -225,13 +225,13 @@ avx_save:
|
|||||||
.save:
|
.save:
|
||||||
mov [fpu_owner], esi
|
mov [fpu_owner], esi
|
||||||
|
|
||||||
shl ecx, 8
|
shl ecx, BSF sizeof.APPDATA
|
||||||
mov eax, [ecx+SLOT_BASE+APPDATA.fpu_state]
|
mov eax, [SLOT_BASE + ecx + APPDATA.fpu_state]
|
||||||
|
|
||||||
call save_context
|
call save_context
|
||||||
|
|
||||||
shl esi, 8
|
shl esi, BSF sizeof.APPDATA
|
||||||
mov esi, [esi+SLOT_BASE+APPDATA.fpu_state]
|
mov esi, [SLOT_BASE + esi + APPDATA.fpu_state]
|
||||||
mov ecx, [xsave_area_size]
|
mov ecx, [xsave_area_size]
|
||||||
add ecx, 3
|
add ecx, 3
|
||||||
shr ecx, 2
|
shr ecx, 2
|
||||||
@@ -246,7 +246,7 @@ avx_save:
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
save_context:
|
save_context:
|
||||||
bt [cpu_caps+(CAPS_OSXSAVE/32)*4], CAPS_OSXSAVE mod 32
|
bt [cpu_caps + (CAPS_OSXSAVE/32)*4], CAPS_OSXSAVE mod 32
|
||||||
jnc save_fpu_context
|
jnc save_fpu_context
|
||||||
push eax edx
|
push eax edx
|
||||||
mov ecx, eax
|
mov ecx, eax
|
||||||
@@ -297,8 +297,8 @@ fpu_restore:
|
|||||||
pop ecx
|
pop ecx
|
||||||
ret
|
ret
|
||||||
.copy:
|
.copy:
|
||||||
shl eax, 8
|
shl eax, BSF sizeof.APPDATA
|
||||||
mov edi, [eax+SLOT_BASE+APPDATA.fpu_state]
|
mov edi, [SLOT_BASE + eax + APPDATA.fpu_state]
|
||||||
mov ecx, 512/4
|
mov ecx, 512/4
|
||||||
cld
|
cld
|
||||||
rep movsd
|
rep movsd
|
||||||
@@ -323,7 +323,7 @@ avx_restore:
|
|||||||
jne .copy
|
jne .copy
|
||||||
|
|
||||||
clts
|
clts
|
||||||
bt [cpu_caps+(CAPS_OSXSAVE/32)*4], CAPS_OSXSAVE mod 32
|
bt [cpu_caps + (CAPS_OSXSAVE/32)*4], CAPS_OSXSAVE mod 32
|
||||||
jnc .no_xsave
|
jnc .no_xsave
|
||||||
push edx
|
push edx
|
||||||
mov eax, [xsave_eax]
|
mov eax, [xsave_eax]
|
||||||
@@ -351,8 +351,8 @@ avx_restore:
|
|||||||
pop ecx
|
pop ecx
|
||||||
ret
|
ret
|
||||||
.copy:
|
.copy:
|
||||||
shl eax, 8
|
shl eax, BSF sizeof.APPDATA
|
||||||
mov edi, [eax+SLOT_BASE+APPDATA.fpu_state]
|
mov edi, [SLOT_BASE + eax + APPDATA.fpu_state]
|
||||||
mov ecx, [xsave_area_size]
|
mov ecx, [xsave_area_size]
|
||||||
add ecx, 3
|
add ecx, 3
|
||||||
shr ecx, 2
|
shr ecx, 2
|
||||||
@@ -375,9 +375,9 @@ except_7: ;#NM exception handler
|
|||||||
cmp ebx, [current_slot_idx]
|
cmp ebx, [current_slot_idx]
|
||||||
je .exit
|
je .exit
|
||||||
|
|
||||||
shl ebx, 8
|
shl ebx, BSF sizeof.APPDATA
|
||||||
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]
|
mov eax, [SLOT_BASE + ebx + APPDATA.fpu_state]
|
||||||
bt [cpu_caps+(CAPS_OSXSAVE/32)*4], CAPS_OSXSAVE mod 32
|
bt [cpu_caps + (CAPS_OSXSAVE/32)*4], CAPS_OSXSAVE mod 32
|
||||||
jnc .no_xsave
|
jnc .no_xsave
|
||||||
mov ecx, eax
|
mov ecx, eax
|
||||||
mov eax, [xsave_eax]
|
mov eax, [xsave_eax]
|
||||||
@@ -385,8 +385,8 @@ except_7: ;#NM exception handler
|
|||||||
xsave [ecx]
|
xsave [ecx]
|
||||||
mov ebx, [current_slot_idx]
|
mov ebx, [current_slot_idx]
|
||||||
mov [fpu_owner], ebx
|
mov [fpu_owner], ebx
|
||||||
shl ebx, 8
|
shl ebx, BSF sizeof.APPDATA
|
||||||
mov ecx, [ebx+SLOT_BASE+APPDATA.fpu_state]
|
mov ecx, [SLOT_BASE + ebx + APPDATA.fpu_state]
|
||||||
xrstor [ecx]
|
xrstor [ecx]
|
||||||
.exit:
|
.exit:
|
||||||
restore_ring3_context
|
restore_ring3_context
|
||||||
@@ -398,8 +398,8 @@ except_7: ;#NM exception handler
|
|||||||
fxsave [eax]
|
fxsave [eax]
|
||||||
mov ebx, [current_slot_idx]
|
mov ebx, [current_slot_idx]
|
||||||
mov [fpu_owner], ebx
|
mov [fpu_owner], ebx
|
||||||
shl ebx, 8
|
shl ebx, BSF sizeof.APPDATA
|
||||||
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]
|
mov eax, [SLOT_BASE + ebx + APPDATA.fpu_state]
|
||||||
fxrstor [eax]
|
fxrstor [eax]
|
||||||
restore_ring3_context
|
restore_ring3_context
|
||||||
iret
|
iret
|
||||||
@@ -408,8 +408,8 @@ except_7: ;#NM exception handler
|
|||||||
fnsave [eax]
|
fnsave [eax]
|
||||||
mov ebx, [current_slot_idx]
|
mov ebx, [current_slot_idx]
|
||||||
mov [fpu_owner], ebx
|
mov [fpu_owner], ebx
|
||||||
shl ebx, 8
|
shl ebx, BSF sizeof.APPDATA
|
||||||
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]
|
mov eax, [SLOT_BASE + ebx + APPDATA.fpu_state]
|
||||||
frstor [eax]
|
frstor [eax]
|
||||||
restore_ring3_context
|
restore_ring3_context
|
||||||
iret
|
iret
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2020. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -171,11 +171,11 @@ proc init_kernel_heap
|
|||||||
|
|
||||||
mov [next_memblock], HEAP_BASE + sizeof.MEM_BLOCK *3
|
mov [next_memblock], HEAP_BASE + sizeof.MEM_BLOCK *3
|
||||||
@@:
|
@@:
|
||||||
mov [eax-sizeof.MEM_BLOCK], eax
|
mov [eax - sizeof.MEM_BLOCK], eax
|
||||||
add eax, sizeof.MEM_BLOCK
|
add eax, sizeof.MEM_BLOCK
|
||||||
loop @B
|
loop @B
|
||||||
|
|
||||||
mov dword[eax-sizeof.MEM_BLOCK], 0
|
mov dword[eax - sizeof.MEM_BLOCK], 0
|
||||||
|
|
||||||
mov ecx, heap_mutex
|
mov ecx, heap_mutex
|
||||||
call mutex_init
|
call mutex_init
|
||||||
@@ -863,7 +863,7 @@ proc user_unmap stdcall, base:dword, offset:dword, size:dword
|
|||||||
|
|
||||||
shr ebx, 12 ; chek block attributes
|
shr ebx, 12 ; chek block attributes
|
||||||
lea ebx, [page_tabs + ebx*4]
|
lea ebx, [page_tabs + ebx*4]
|
||||||
mov eax, [ebx-4] ; block attributes
|
mov eax, [ebx - 4] ; block attributes
|
||||||
test al, MEM_BLOCK_USED
|
test al, MEM_BLOCK_USED
|
||||||
jz .error
|
jz .error
|
||||||
test al, MEM_BLOCK_DONT_FREE
|
test al, MEM_BLOCK_DONT_FREE
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2020. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -38,7 +38,7 @@ init_hpet:
|
|||||||
mov [hpet_timers], eax
|
mov [hpet_timers], eax
|
||||||
mov ecx, eax
|
mov ecx, eax
|
||||||
|
|
||||||
mov eax, [ebx+HPET_PERIOD]
|
mov eax, [ebx + HPET_PERIOD]
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
shld edx, eax, 10
|
shld edx, eax, 10
|
||||||
shl eax, 10
|
shl eax, 10
|
||||||
@@ -46,29 +46,29 @@ init_hpet:
|
|||||||
div esi
|
div esi
|
||||||
mov [hpet_period], eax
|
mov [hpet_period], eax
|
||||||
|
|
||||||
mov esi, [ebx+HPET_CFG]
|
mov esi, [ebx + HPET_CFG]
|
||||||
and esi, not HPET_CFG_ENABLE
|
and esi, not HPET_CFG_ENABLE
|
||||||
mov [ebx+HPET_CFG], esi ;stop main counter
|
mov [ebx + HPET_CFG], esi ;stop main counter
|
||||||
|
|
||||||
lea edx, [ebx+HPET_T0_CFG]
|
lea edx, [ebx + HPET_T0_CFG]
|
||||||
@@:
|
@@:
|
||||||
jcxz @F
|
jcxz @F
|
||||||
mov eax, [edx]
|
mov eax, [edx]
|
||||||
and eax, not (HPET_TN_ENABLE+HPET_TN_LEVEL+HPET_TN_FSB)
|
and eax, not (HPET_TN_ENABLE + HPET_TN_LEVEL + HPET_TN_FSB)
|
||||||
mov [edx], eax
|
mov [edx], eax
|
||||||
add edx, 0x20
|
add edx, 0x20
|
||||||
dec ecx
|
dec ecx
|
||||||
jmp @B
|
jmp @B
|
||||||
@@:
|
@@:
|
||||||
mov [ebx+HPET_COUNTER], ecx ;reset main counter
|
mov [ebx + HPET_COUNTER], ecx ;reset main counter
|
||||||
mov [ebx+HPET_COUNTER+4], ecx
|
mov [ebx + HPET_COUNTER + 4], ecx
|
||||||
|
|
||||||
or esi, HPET_CFG_ENABLE
|
or esi, HPET_CFG_ENABLE
|
||||||
mov [ebx+HPET_CFG], esi ;and start again
|
mov [ebx + HPET_CFG], esi ;and start again
|
||||||
|
|
||||||
.done:
|
.done:
|
||||||
rdtsc
|
rdtsc
|
||||||
mov [hpet_tsc_start], eax
|
mov [hpet_tsc_start], eax
|
||||||
mov [hpet_tsc_start+4], edx
|
mov [hpet_tsc_start + 4], edx
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2020. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -20,7 +20,7 @@ irqh_tab rd sizeof.LHEAD * IRQ_RESERVED / 4
|
|||||||
irqh_pool rd sizeof.IRQH * IRQ_POOL_SIZE /4
|
irqh_pool rd sizeof.IRQH * IRQ_POOL_SIZE /4
|
||||||
next_irqh rd 1
|
next_irqh rd 1
|
||||||
|
|
||||||
irq_active_set rd (IRQ_RESERVED+31)/32
|
irq_active_set rd (IRQ_RESERVED + 31)/32
|
||||||
irq_failed rd IRQ_RESERVED
|
irq_failed rd IRQ_RESERVED
|
||||||
|
|
||||||
endg
|
endg
|
||||||
@@ -30,7 +30,7 @@ set_irq_active:
|
|||||||
mov ecx, ebp
|
mov ecx, ebp
|
||||||
shr ecx, 5
|
shr ecx, 5
|
||||||
and eax, 31
|
and eax, 31
|
||||||
bts [irq_active_set+ecx*4], eax
|
bts [irq_active_set + ecx*4], eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
reset_irq_active:
|
reset_irq_active:
|
||||||
@@ -38,7 +38,7 @@ reset_irq_active:
|
|||||||
mov ecx, ebp
|
mov ecx, ebp
|
||||||
shr ecx, 5
|
shr ecx, 5
|
||||||
and eax, 31
|
and eax, 31
|
||||||
btr [irq_active_set+ecx*4], eax
|
btr [irq_active_set + ecx*4], eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@@ -53,14 +53,14 @@ init_irqs:
|
|||||||
loop @B
|
loop @B
|
||||||
|
|
||||||
mov ecx, IRQ_POOL_SIZE-1
|
mov ecx, IRQ_POOL_SIZE-1
|
||||||
mov eax, irqh_pool+sizeof.IRQH
|
mov eax, irqh_pool + sizeof.IRQH
|
||||||
mov [next_irqh], irqh_pool
|
mov [next_irqh], irqh_pool
|
||||||
@@:
|
@@:
|
||||||
mov [eax-sizeof.IRQH], eax
|
mov [eax - sizeof.IRQH], eax
|
||||||
add eax, sizeof.IRQH
|
add eax, sizeof.IRQH
|
||||||
loop @B
|
loop @B
|
||||||
|
|
||||||
mov [eax-sizeof.IRQH], dword 0
|
mov [eax - sizeof.IRQH], dword 0
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
@@ -99,14 +99,14 @@ proc attach_int_handler stdcall, irq:dword, handler:dword, user_data:dword
|
|||||||
mov [next_irqh], eax
|
mov [next_irqh], eax
|
||||||
mov [.irqh], ecx
|
mov [.irqh], ecx
|
||||||
|
|
||||||
mov [irq_failed+ebx*4], 0;clear counter
|
mov [irq_failed + ebx*4], 0;clear counter
|
||||||
|
|
||||||
mov eax, [user_data]
|
mov eax, [user_data]
|
||||||
mov [ecx+IRQH.handler], edx
|
mov [ecx + IRQH.handler], edx
|
||||||
mov [ecx+IRQH.data], eax
|
mov [ecx + IRQH.data], eax
|
||||||
and [ecx+IRQH.num_ints], 0
|
and [ecx + IRQH.num_ints], 0
|
||||||
|
|
||||||
lea edx, [irqh_tab+ebx*8]
|
lea edx, [irqh_tab + ebx*8]
|
||||||
list_add_tail ecx, edx ;clobber eax
|
list_add_tail ecx, edx ;clobber eax
|
||||||
stdcall enable_irq, ebx
|
stdcall enable_irq, ebx
|
||||||
|
|
||||||
@@ -167,15 +167,15 @@ align 16
|
|||||||
mov ds, bx
|
mov ds, bx
|
||||||
mov es, bx
|
mov es, bx
|
||||||
|
|
||||||
cmp [v86_irqhooks+ebp*8], 0
|
cmp [v86_irqhooks + ebp*8], 0
|
||||||
jnz v86_irq
|
jnz v86_irq
|
||||||
|
|
||||||
call set_irq_active
|
call set_irq_active
|
||||||
|
|
||||||
lea esi, [irqh_tab+ebp*8] ; esi= list head
|
lea esi, [irqh_tab + ebp*8] ; esi= list head
|
||||||
mov ebx, esi
|
mov ebx, esi
|
||||||
.next:
|
.next:
|
||||||
mov ebx, [ebx+IRQH.list.next]; ebx= irqh pointer
|
mov ebx, [ebx + IRQH.list.next]; ebx= irqh pointer
|
||||||
cmp ebx, esi
|
cmp ebx, esi
|
||||||
je .done
|
je .done
|
||||||
|
|
||||||
@@ -183,8 +183,8 @@ align 16
|
|||||||
push edi
|
push edi
|
||||||
push esi
|
push esi
|
||||||
|
|
||||||
push [ebx+IRQH.data]
|
push [ebx + IRQH.data]
|
||||||
call [ebx+IRQH.handler]
|
call [ebx + IRQH.handler]
|
||||||
pop ecx
|
pop ecx
|
||||||
|
|
||||||
pop esi
|
pop esi
|
||||||
@@ -194,7 +194,7 @@ align 16
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .next
|
jz .next
|
||||||
|
|
||||||
inc [ebx+IRQH.num_ints]
|
inc [ebx + IRQH.num_ints]
|
||||||
call reset_irq_active
|
call reset_irq_active
|
||||||
jmp .next
|
jmp .next
|
||||||
|
|
||||||
@@ -231,17 +231,17 @@ align 16
|
|||||||
jz .try_next_irq
|
jz .try_next_irq
|
||||||
cmp ebp, 15
|
cmp ebp, 15
|
||||||
jz .try_next_irq
|
jz .try_next_irq
|
||||||
lea esi, [irqh_tab+ebp*8]
|
lea esi, [irqh_tab + ebp*8]
|
||||||
mov ebx, esi
|
mov ebx, esi
|
||||||
.try_next_handler:
|
.try_next_handler:
|
||||||
mov ebx, [ebx+IRQH.list.next]
|
mov ebx, [ebx + IRQH.list.next]
|
||||||
cmp ebx, esi
|
cmp ebx, esi
|
||||||
je .try_next_irq
|
je .try_next_irq
|
||||||
cmp [ebx+IRQH.num_ints], 0
|
cmp [ebx + IRQH.num_ints], 0
|
||||||
jne .try_next_handler
|
jne .try_next_handler
|
||||||
; keyboard handler acknowledges everything
|
; keyboard handler acknowledges everything
|
||||||
push [ebx+IRQH.data]
|
push [ebx + IRQH.data]
|
||||||
call [ebx+IRQH.handler]
|
call [ebx + IRQH.handler]
|
||||||
pop ecx
|
pop ecx
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .try_next_handler
|
jz .try_next_handler
|
||||||
@@ -252,7 +252,7 @@ align 16
|
|||||||
pop ebp
|
pop ebp
|
||||||
spin_lock_irqsave IrqsList
|
spin_lock_irqsave IrqsList
|
||||||
list_del ebx
|
list_del ebx
|
||||||
lea edx, [irqh_tab+ebp*8]
|
lea edx, [irqh_tab + ebp*8]
|
||||||
list_add_tail ebx, edx
|
list_add_tail ebx, edx
|
||||||
spin_unlock_irqrestore IrqsList
|
spin_unlock_irqrestore IrqsList
|
||||||
jmp .exit
|
jmp .exit
|
||||||
@@ -264,7 +264,7 @@ align 16
|
|||||||
pop ebp
|
pop ebp
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
inc [irq_failed+ebp*4]
|
inc [irq_failed + ebp*4]
|
||||||
.exit:
|
.exit:
|
||||||
|
|
||||||
mov ecx, ebp
|
mov ecx, ebp
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -582,8 +582,8 @@ unlink_large_chunk:
|
|||||||
je .done
|
je .done
|
||||||
|
|
||||||
mov ecx, [edx+28]
|
mov ecx, [edx+28]
|
||||||
cmp edx, [mst.treebins+ecx*4]
|
cmp edx, [mst.treebins + ecx*4]
|
||||||
lea ecx, [mst.treebins+ecx*4]
|
lea ecx, [mst.treebins + ecx*4]
|
||||||
jne .l3
|
jne .l3
|
||||||
|
|
||||||
test eax, eax
|
test eax, eax
|
||||||
@@ -640,7 +640,7 @@ malloc_small:
|
|||||||
push edi
|
push edi
|
||||||
|
|
||||||
bsf eax, [mst.treemap]
|
bsf eax, [mst.treemap]
|
||||||
mov ecx, [mst.treebins+eax*4]
|
mov ecx, [mst.treebins + eax*4]
|
||||||
|
|
||||||
; rsize = (t->head & ~INUSE_BITS) - nb;
|
; rsize = (t->head & ~INUSE_BITS) - nb;
|
||||||
|
|
||||||
@@ -690,7 +690,7 @@ malloc_small:
|
|||||||
; unlink_large_chunk(v);
|
; unlink_large_chunk(v);
|
||||||
|
|
||||||
mov edx, ebx
|
mov edx, ebx
|
||||||
lea esi, [ebx+ebp]
|
lea esi, [ebx + ebp]
|
||||||
call unlink_large_chunk
|
call unlink_large_chunk
|
||||||
|
|
||||||
; if (rsize < 16)
|
; if (rsize < 16)
|
||||||
@@ -700,19 +700,19 @@ malloc_small:
|
|||||||
|
|
||||||
; v->head = (rsize + nb)|PINUSE_BIT|CINUSE_BIT;
|
; v->head = (rsize + nb)|PINUSE_BIT|CINUSE_BIT;
|
||||||
|
|
||||||
lea ecx, [edi+ebp]
|
lea ecx, [edi + ebp]
|
||||||
|
|
||||||
; (v+rsize + nb)->head |= PINUSE_BIT;
|
; (v+rsize + nb)->head |= PINUSE_BIT;
|
||||||
|
|
||||||
add edi, ebx
|
add edi, ebx
|
||||||
lea eax, [edi+ebp+4]
|
lea eax, [edi + ebp + 4]
|
||||||
pop edi
|
pop edi
|
||||||
or ecx, 3
|
or ecx, 3
|
||||||
mov [ebx+4], ecx
|
mov [ebx + 4], ecx
|
||||||
or dword [eax], 1
|
or dword [eax], 1
|
||||||
pop ebp
|
pop ebp
|
||||||
|
|
||||||
lea eax, [ebx+8]
|
lea eax, [ebx + 8]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.split:
|
.split:
|
||||||
@@ -786,12 +786,12 @@ malloc_large:
|
|||||||
lea ecx, [eax+7]
|
lea ecx, [eax+7]
|
||||||
shr esi, cl
|
shr esi, cl
|
||||||
and esi, 1
|
and esi, 1
|
||||||
lea ecx, [esi+eax*2]
|
lea ecx, [esi + eax*2]
|
||||||
mov [.idx], ecx
|
mov [.idx], ecx
|
||||||
|
|
||||||
; if ((t = ms.treebins[idx]) != 0)
|
; if ((t = ms.treebins[idx]) != 0)
|
||||||
|
|
||||||
mov eax, [mst.treebins+ecx*4]
|
mov eax, [mst.treebins + ecx*4]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .l3
|
jz .l3
|
||||||
|
|
||||||
@@ -849,7 +849,7 @@ malloc_large:
|
|||||||
; if (rt != 0 && rt != t)
|
; if (rt != 0 && rt != t)
|
||||||
|
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
mov eax, [eax+esi*4+16]
|
mov eax, [eax + esi*4+16]
|
||||||
jz @F
|
jz @F
|
||||||
cmp ecx, eax
|
cmp ecx, eax
|
||||||
jz @F
|
jz @F
|
||||||
@@ -893,7 +893,7 @@ malloc_large:
|
|||||||
|
|
||||||
bsf eax, edx
|
bsf eax, edx
|
||||||
; t = ms.treebins[i];
|
; t = ms.treebins[i];
|
||||||
mov eax, [mst.treebins+eax*4]
|
mov eax, [mst.treebins + eax*4]
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
@@ -952,7 +952,7 @@ malloc_large:
|
|||||||
; unlink_large_chunk(v);
|
; unlink_large_chunk(v);
|
||||||
|
|
||||||
mov edx, ebp
|
mov edx, ebp
|
||||||
lea esi, [ebx+ebp]
|
lea esi, [ebx + ebp]
|
||||||
call unlink_large_chunk
|
call unlink_large_chunk
|
||||||
|
|
||||||
; if (rsize < 16)
|
; if (rsize < 16)
|
||||||
@@ -962,12 +962,12 @@ malloc_large:
|
|||||||
|
|
||||||
; v->head = (rsize + nb)|PINUSE_BIT|CINUSE_BIT;
|
; v->head = (rsize + nb)|PINUSE_BIT|CINUSE_BIT;
|
||||||
|
|
||||||
lea ecx, [edi+ebx]
|
lea ecx, [edi + ebx]
|
||||||
|
|
||||||
; (v+rsize + nb)->head |= PINUSE_BIT;
|
; (v+rsize + nb)->head |= PINUSE_BIT;
|
||||||
|
|
||||||
add edi, ebp
|
add edi, ebp
|
||||||
lea eax, [edi+ebx+4]
|
lea eax, [edi + ebx + 4]
|
||||||
or ecx, 3
|
or ecx, 3
|
||||||
mov [ebp+4], ecx
|
mov [ebp+4], ecx
|
||||||
or dword [eax], 1
|
or dword [eax], 1
|
||||||
@@ -1025,7 +1025,7 @@ init_malloc:
|
|||||||
mov [eax+8], eax
|
mov [eax+8], eax
|
||||||
mov [eax+12], eax
|
mov [eax+12], eax
|
||||||
add eax, 16
|
add eax, 16
|
||||||
cmp eax, mst.smallbins+512
|
cmp eax, mst.smallbins + 512
|
||||||
jb @B
|
jb @B
|
||||||
|
|
||||||
mov ecx, mst.mutex
|
mov ecx, mst.mutex
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2020. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -131,7 +131,7 @@ map_page:
|
|||||||
and eax, [pte_valid_mask]
|
and eax, [pte_valid_mask]
|
||||||
mov ebx, [esp+8] ; lin_addr
|
mov ebx, [esp+8] ; lin_addr
|
||||||
shr ebx, 12
|
shr ebx, 12
|
||||||
mov [page_tabs+ebx*4], eax
|
mov [page_tabs + ebx*4], eax
|
||||||
mov eax, [esp+8] ; lin_addr
|
mov eax, [esp+8] ; lin_addr
|
||||||
pop ebx
|
pop ebx
|
||||||
invlpg [eax]
|
invlpg [eax]
|
||||||
@@ -194,7 +194,7 @@ proc map_io_mem stdcall, base:dword, size:dword, flags:dword
|
|||||||
or edx, [flags]
|
or edx, [flags]
|
||||||
and edx, [pte_valid_mask]
|
and edx, [pte_valid_mask]
|
||||||
@@:
|
@@:
|
||||||
mov [page_tabs+eax*4], edx
|
mov [page_tabs + eax*4], edx
|
||||||
invlpg [ebx]
|
invlpg [ebx]
|
||||||
inc eax
|
inc eax
|
||||||
add ebx, edi
|
add ebx, edi
|
||||||
@@ -232,7 +232,7 @@ commit_pages:
|
|||||||
and eax, [pte_valid_mask ]
|
and eax, [pte_valid_mask ]
|
||||||
mov edi, ebx
|
mov edi, ebx
|
||||||
shr edi, 12
|
shr edi, 12
|
||||||
lea edi, [page_tabs+edi*4]
|
lea edi, [page_tabs + edi*4]
|
||||||
@@:
|
@@:
|
||||||
stosd
|
stosd
|
||||||
invlpg [ebx]
|
invlpg [ebx]
|
||||||
@@ -264,7 +264,7 @@ release_pages:
|
|||||||
mov edi, eax
|
mov edi, eax
|
||||||
|
|
||||||
shr esi, 12
|
shr esi, 12
|
||||||
lea esi, [page_tabs+esi*4]
|
lea esi, [page_tabs + esi*4]
|
||||||
|
|
||||||
push ecx
|
push ecx
|
||||||
mov ecx, pg_data.mutex
|
mov ecx, pg_data.mutex
|
||||||
@@ -342,7 +342,7 @@ proc map_page_table stdcall, lin_addr:dword, phis_addr:dword
|
|||||||
mov eax, [phis_addr]
|
mov eax, [phis_addr]
|
||||||
and eax, not 0xFFF
|
and eax, not 0xFFF
|
||||||
or eax, PG_UWR
|
or eax, PG_UWR
|
||||||
mov dword [master_tab+ebx*4], eax
|
mov dword [master_tab + ebx*4], eax
|
||||||
mov eax, [lin_addr]
|
mov eax, [lin_addr]
|
||||||
shr eax, 10
|
shr eax, 10
|
||||||
add eax, page_tabs
|
add eax, page_tabs
|
||||||
@@ -394,7 +394,7 @@ proc create_trampoline_pgmap
|
|||||||
mov esi, master_tab
|
mov esi, master_tab
|
||||||
mov ecx, 1024
|
mov ecx, 1024
|
||||||
rep movsd
|
rep movsd
|
||||||
mov ecx, [master_tab+(OS_BASE shr 20)]
|
mov ecx, [master_tab + (OS_BASE shr 20)]
|
||||||
mov [eax], ecx
|
mov [eax], ecx
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
call get_pg_addr
|
call get_pg_addr
|
||||||
@@ -412,9 +412,9 @@ proc new_mem_resize stdcall, new_size:dword
|
|||||||
push edi
|
push edi
|
||||||
|
|
||||||
mov edx, [current_slot]
|
mov edx, [current_slot]
|
||||||
mov ebx, [edx+APPDATA.process]
|
mov ebx, [edx + APPDATA.process]
|
||||||
|
|
||||||
cmp [ebx+PROC.heap_base], 0
|
cmp [ebx + PROC.heap_base], 0
|
||||||
jne .exit
|
jne .exit
|
||||||
|
|
||||||
mov edi, [new_size]
|
mov edi, [new_size]
|
||||||
@@ -422,7 +422,7 @@ proc new_mem_resize stdcall, new_size:dword
|
|||||||
and edi, not 4095
|
and edi, not 4095
|
||||||
mov [new_size], edi
|
mov [new_size], edi
|
||||||
|
|
||||||
mov esi, [ebx+PROC.mem_used]
|
mov esi, [ebx + PROC.mem_used]
|
||||||
add esi, 4095
|
add esi, 4095
|
||||||
and esi, not 4095
|
and esi, not 4095
|
||||||
|
|
||||||
@@ -437,11 +437,11 @@ proc new_mem_resize stdcall, new_size:dword
|
|||||||
mov ecx, pg_data.mutex
|
mov ecx, pg_data.mutex
|
||||||
call mutex_lock
|
call mutex_lock
|
||||||
@@:
|
@@:
|
||||||
mov eax, [app_page_tabs+edi*4]
|
mov eax, [app_page_tabs + edi*4]
|
||||||
test eax, 1
|
test eax, 1
|
||||||
jz .next
|
jz .next
|
||||||
|
|
||||||
mov dword [app_page_tabs+edi*4], 0
|
mov dword [app_page_tabs + edi*4], 0
|
||||||
invlpg [ebx]
|
invlpg [ebx]
|
||||||
call free_page
|
call free_page
|
||||||
|
|
||||||
@@ -457,8 +457,8 @@ proc new_mem_resize stdcall, new_size:dword
|
|||||||
.update_size:
|
.update_size:
|
||||||
mov edx, [current_slot]
|
mov edx, [current_slot]
|
||||||
mov ebx, [new_size]
|
mov ebx, [new_size]
|
||||||
mov edx, [edx+APPDATA.process]
|
mov edx, [edx + APPDATA.process]
|
||||||
mov [edx+PROC.mem_used], ebx
|
mov [edx + PROC.mem_used], ebx
|
||||||
.exit:
|
.exit:
|
||||||
pop edi
|
pop edi
|
||||||
pop esi
|
pop esi
|
||||||
@@ -546,7 +546,7 @@ get_pg_addr:
|
|||||||
cmp eax, 0x400000
|
cmp eax, 0x400000
|
||||||
jb @f
|
jb @f
|
||||||
shr eax, 12
|
shr eax, 12
|
||||||
mov eax, [page_tabs+(eax+(OS_BASE shr 12))*4]
|
mov eax, [page_tabs + (eax+(OS_BASE shr 12))*4]
|
||||||
@@:
|
@@:
|
||||||
and eax, 0xFFFFF000
|
and eax, 0xFFFFF000
|
||||||
ret
|
ret
|
||||||
@@ -589,12 +589,12 @@ proc page_fault_handler
|
|||||||
shr ebx, 12
|
shr ebx, 12
|
||||||
mov ecx, ebx
|
mov ecx, ebx
|
||||||
shr ecx, 10
|
shr ecx, 10
|
||||||
mov edx, [master_tab+ecx*4]
|
mov edx, [master_tab + ecx*4]
|
||||||
test edx, PG_READ
|
test edx, PG_READ
|
||||||
jz .fail ;page table is not created
|
jz .fail ;page table is not created
|
||||||
;incorrect address in program
|
;incorrect address in program
|
||||||
|
|
||||||
mov eax, [page_tabs+ebx*4]
|
mov eax, [page_tabs + ebx*4]
|
||||||
test eax, 2
|
test eax, 2
|
||||||
jz .fail ;address is not reserved for usage. Error
|
jz .fail ;address is not reserved for usage. Error
|
||||||
|
|
||||||
@@ -621,19 +621,19 @@ proc page_fault_handler
|
|||||||
; check list of HDLLs
|
; check list of HDLLs
|
||||||
and ebx, not 0xFFF
|
and ebx, not 0xFFF
|
||||||
mov eax, [current_process]
|
mov eax, [current_process]
|
||||||
mov eax, [eax+PROC.dlls_list_ptr]
|
mov eax, [eax + PROC.dlls_list_ptr]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
mov esi, [eax+HDLL.fd]
|
mov esi, [eax + HDLL.fd]
|
||||||
.scan_hdll:
|
.scan_hdll:
|
||||||
cmp esi, eax
|
cmp esi, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
mov edx, ebx
|
mov edx, ebx
|
||||||
sub edx, [esi+HDLL.base]
|
sub edx, [esi + HDLL.base]
|
||||||
cmp edx, [esi+HDLL.size]
|
cmp edx, [esi + HDLL.size]
|
||||||
jb .fault_in_hdll
|
jb .fault_in_hdll
|
||||||
.scan_hdll.next:
|
.scan_hdll.next:
|
||||||
mov esi, [esi+HDLL.fd]
|
mov esi, [esi + HDLL.fd]
|
||||||
jmp .scan_hdll
|
jmp .scan_hdll
|
||||||
.fault_in_hdll:
|
.fault_in_hdll:
|
||||||
; allocate new page, map it as rw and copy data
|
; allocate new page, map it as rw and copy data
|
||||||
@@ -643,9 +643,9 @@ proc page_fault_handler
|
|||||||
stdcall map_page, ebx, eax, PG_UWR
|
stdcall map_page, ebx, eax, PG_UWR
|
||||||
mov edi, ebx
|
mov edi, ebx
|
||||||
mov ecx, 1024
|
mov ecx, 1024
|
||||||
sub ebx, [esi+HDLL.base]
|
sub ebx, [esi + HDLL.base]
|
||||||
mov esi, [esi+HDLL.parent]
|
mov esi, [esi + HDLL.parent]
|
||||||
mov esi, [esi+DLLDESCR.data]
|
mov esi, [esi + DLLDESCR.data]
|
||||||
add esi, ebx
|
add esi, ebx
|
||||||
rep movsd
|
rep movsd
|
||||||
jmp .exit
|
jmp .exit
|
||||||
@@ -687,7 +687,7 @@ proc page_fault_handler
|
|||||||
shr ebx, 12
|
shr ebx, 12
|
||||||
mov edx, [current_slot]
|
mov edx, [current_slot]
|
||||||
or eax, PG_SWR
|
or eax, PG_SWR
|
||||||
mov [edx+APPDATA.io_map+ebx*4], eax
|
mov [edx + APPDATA.io_map + ebx*4], eax
|
||||||
|
|
||||||
add esi, [default_io_map]
|
add esi, [default_io_map]
|
||||||
mov ecx, 4096/4
|
mov ecx, 4096/4
|
||||||
@@ -709,15 +709,15 @@ proc map_mem_ipc stdcall, lin_addr:dword,slot:dword,\
|
|||||||
jz .exit
|
jz .exit
|
||||||
|
|
||||||
mov eax, [slot]
|
mov eax, [slot]
|
||||||
shl eax, 8
|
shl eax, BSF sizeof.APPDATA
|
||||||
mov eax, [SLOT_BASE+eax+APPDATA.process]
|
mov eax, [SLOT_BASE + eax + APPDATA.process]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .exit
|
jz .exit
|
||||||
|
|
||||||
mov [process], eax
|
mov [process], eax
|
||||||
mov ebx, [ofs]
|
mov ebx, [ofs]
|
||||||
shr ebx, 22
|
shr ebx, 22
|
||||||
mov eax, [eax+PROC.pdt_0+ebx*4] ;get page table
|
mov eax, [eax + PROC.pdt_0 + ebx*4] ;get page table
|
||||||
mov esi, [ipc_ptab]
|
mov esi, [ipc_ptab]
|
||||||
and eax, 0xFFFFF000
|
and eax, 0xFFFFF000
|
||||||
jz .exit
|
jz .exit
|
||||||
@@ -748,7 +748,7 @@ proc map_mem_ipc stdcall, lin_addr:dword,slot:dword,\
|
|||||||
|
|
||||||
inc ebx
|
inc ebx
|
||||||
mov eax, [process]
|
mov eax, [process]
|
||||||
mov eax, [eax+PROC.pdt_0+ebx*4]
|
mov eax, [eax + PROC.pdt_0 + ebx*4]
|
||||||
and eax, 0xFFFFF000
|
and eax, 0xFFFFF000
|
||||||
jz .exit
|
jz .exit
|
||||||
|
|
||||||
@@ -772,15 +772,15 @@ proc map_memEx stdcall, lin_addr:dword,slot:dword,\
|
|||||||
jz .exit
|
jz .exit
|
||||||
|
|
||||||
mov eax, [slot]
|
mov eax, [slot]
|
||||||
shl eax, 8
|
shl eax, BSF sizeof.APPDATA
|
||||||
mov eax, [SLOT_BASE+eax+APPDATA.process]
|
mov eax, [SLOT_BASE + eax + APPDATA.process]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .exit
|
jz .exit
|
||||||
|
|
||||||
mov [process], eax
|
mov [process], eax
|
||||||
mov ebx, [ofs]
|
mov ebx, [ofs]
|
||||||
shr ebx, 22
|
shr ebx, 22
|
||||||
mov eax, [eax+PROC.pdt_0+ebx*4] ;get page table
|
mov eax, [eax + PROC.pdt_0 + ebx*4] ;get page table
|
||||||
mov esi, [proc_mem_tab]
|
mov esi, [proc_mem_tab]
|
||||||
and eax, 0xFFFFF000
|
and eax, 0xFFFFF000
|
||||||
jz .exit
|
jz .exit
|
||||||
@@ -811,7 +811,7 @@ proc map_memEx stdcall, lin_addr:dword,slot:dword,\
|
|||||||
|
|
||||||
inc ebx
|
inc ebx
|
||||||
mov eax, [process]
|
mov eax, [process]
|
||||||
mov eax, [eax+PROC.pdt_0+ebx*4]
|
mov eax, [eax + PROC.pdt_0 + ebx*4]
|
||||||
and eax, 0xFFFFF000
|
and eax, 0xFFFFF000
|
||||||
jz .exit
|
jz .exit
|
||||||
|
|
||||||
@@ -829,7 +829,7 @@ endp
|
|||||||
; out: CF cleared <=> failed
|
; out: CF cleared <=> failed
|
||||||
; destroys: only eax
|
; destroys: only eax
|
||||||
proc safe_map_page stdcall, slot:dword, req_access:dword, ofs:dword
|
proc safe_map_page stdcall, slot:dword, req_access:dword, ofs:dword
|
||||||
mov eax, [esi+edx*4]
|
mov eax, [esi + edx*4]
|
||||||
test al, PG_READ
|
test al, PG_READ
|
||||||
jz .not_present
|
jz .not_present
|
||||||
test al, PG_WRITE
|
test al, PG_WRITE
|
||||||
@@ -851,7 +851,7 @@ proc safe_map_page stdcall, slot:dword, req_access:dword, ofs:dword
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
or al, PG_UWR
|
or al, PG_UWR
|
||||||
mov [esi+edx*4], eax
|
mov [esi + edx*4], eax
|
||||||
jmp .map
|
jmp .map
|
||||||
.resolve_readonly:
|
.resolve_readonly:
|
||||||
; readonly page, probably copy-on-write
|
; readonly page, probably copy-on-write
|
||||||
@@ -864,21 +864,21 @@ proc safe_map_page stdcall, slot:dword, req_access:dword, ofs:dword
|
|||||||
cld
|
cld
|
||||||
push ebx ecx
|
push ebx ecx
|
||||||
mov eax, [slot]
|
mov eax, [slot]
|
||||||
shl eax, 8
|
shl eax, BSF sizeof.APPDATA
|
||||||
mov eax, [SLOT_BASE+eax+APPDATA.process]
|
mov eax, [SLOT_BASE + eax + APPDATA.process]
|
||||||
mov eax, [eax+PROC.dlls_list_ptr]
|
mov eax, [eax + PROC.dlls_list_ptr]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .no_hdll
|
jz .no_hdll
|
||||||
mov ecx, [eax+HDLL.fd]
|
mov ecx, [eax + HDLL.fd]
|
||||||
.scan_hdll:
|
.scan_hdll:
|
||||||
cmp ecx, eax
|
cmp ecx, eax
|
||||||
jz .no_hdll
|
jz .no_hdll
|
||||||
mov ebx, [ofs]
|
mov ebx, [ofs]
|
||||||
and ebx, not 0xFFF
|
and ebx, not 0xFFF
|
||||||
sub ebx, [ecx+HDLL.base]
|
sub ebx, [ecx + HDLL.base]
|
||||||
cmp ebx, [ecx+HDLL.size]
|
cmp ebx, [ecx + HDLL.size]
|
||||||
jb .hdll_found
|
jb .hdll_found
|
||||||
mov ecx, [ecx+HDLL.fd]
|
mov ecx, [ecx + HDLL.fd]
|
||||||
jmp .scan_hdll
|
jmp .scan_hdll
|
||||||
.no_hdll:
|
.no_hdll:
|
||||||
pop ecx ebx
|
pop ecx ebx
|
||||||
@@ -887,13 +887,13 @@ proc safe_map_page stdcall, slot:dword, req_access:dword, ofs:dword
|
|||||||
ret
|
ret
|
||||||
.hdll_found:
|
.hdll_found:
|
||||||
; allocate page, save it in page table, map it, copy contents from base
|
; allocate page, save it in page table, map it, copy contents from base
|
||||||
mov eax, [ecx+HDLL.parent]
|
mov eax, [ecx + HDLL.parent]
|
||||||
add ebx, [eax+DLLDESCR.data]
|
add ebx, [eax + DLLDESCR.data]
|
||||||
call alloc_page
|
call alloc_page
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .no_hdll
|
jz .no_hdll
|
||||||
or al, PG_UWR
|
or al, PG_UWR
|
||||||
mov [esi+edx*4], eax
|
mov [esi + edx*4], eax
|
||||||
stdcall map_page, edi, eax, [req_access]
|
stdcall map_page, edi, eax, [req_access]
|
||||||
push esi edi
|
push esi edi
|
||||||
mov esi, ebx
|
mov esi, ebx
|
||||||
@@ -922,8 +922,8 @@ sys_IPC:
|
|||||||
mov eax, [current_slot]
|
mov eax, [current_slot]
|
||||||
pushf
|
pushf
|
||||||
cli
|
cli
|
||||||
mov [eax+APPDATA.ipc_start], ecx ;set fields in extended information area
|
mov [eax + APPDATA.ipc_start], ecx ;set fields in extended information area
|
||||||
mov [eax+APPDATA.ipc_size], edx
|
mov [eax + APPDATA.ipc_size], edx
|
||||||
|
|
||||||
add edx, ecx
|
add edx, ecx
|
||||||
add edx, 4095
|
add edx, 4095
|
||||||
@@ -970,8 +970,8 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
|
|||||||
jz .no_pid
|
jz .no_pid
|
||||||
|
|
||||||
mov [dst_slot], eax
|
mov [dst_slot], eax
|
||||||
shl eax, 8
|
shl eax, BSF sizeof.APPDATA
|
||||||
mov edi, [eax+SLOT_BASE+APPDATA.ipc_start] ;is ipc area defined?
|
mov edi, [SLOT_BASE + eax + APPDATA.ipc_start] ;is ipc area defined?
|
||||||
test edi, edi
|
test edi, edi
|
||||||
jz .no_ipc_area
|
jz .no_ipc_area
|
||||||
|
|
||||||
@@ -979,7 +979,7 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
|
|||||||
and ebx, 0xFFF
|
and ebx, 0xFFF
|
||||||
mov [dst_offset], ebx
|
mov [dst_offset], ebx
|
||||||
|
|
||||||
mov esi, [eax+SLOT_BASE+APPDATA.ipc_size]
|
mov esi, [SLOT_BASE + eax + APPDATA.ipc_size]
|
||||||
mov [buf_size], esi
|
mov [buf_size], esi
|
||||||
|
|
||||||
mov ecx, [ipc_tmp]
|
mov ecx, [ipc_tmp]
|
||||||
@@ -1024,26 +1024,26 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
|
|||||||
mov edx, ebx
|
mov edx, ebx
|
||||||
shr ebx, 12
|
shr ebx, 12
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [page_tabs+ebx*4], eax
|
mov [page_tabs + ebx*4], eax
|
||||||
invlpg [edx]
|
invlpg [edx]
|
||||||
|
|
||||||
mov ebx, [ipc_pdir]
|
mov ebx, [ipc_pdir]
|
||||||
mov edx, ebx
|
mov edx, ebx
|
||||||
shr ebx, 12
|
shr ebx, 12
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [page_tabs+ebx*4], eax
|
mov [page_tabs + ebx*4], eax
|
||||||
invlpg [edx]
|
invlpg [edx]
|
||||||
|
|
||||||
mov ebx, [ipc_ptab]
|
mov ebx, [ipc_ptab]
|
||||||
mov edx, ebx
|
mov edx, ebx
|
||||||
shr ebx, 12
|
shr ebx, 12
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [page_tabs+ebx*4], eax
|
mov [page_tabs + ebx*4], eax
|
||||||
invlpg [edx]
|
invlpg [edx]
|
||||||
|
|
||||||
mov eax, [dst_slot]
|
mov eax, [dst_slot]
|
||||||
shl eax, BSF sizeof.APPDATA
|
shl eax, BSF sizeof.APPDATA
|
||||||
or [eax+SLOT_BASE+APPDATA.occurred_events], EVENT_IPC
|
or [SLOT_BASE + eax + APPDATA.occurred_events], EVENT_IPC
|
||||||
push 0
|
push 0
|
||||||
jmp .ret
|
jmp .ret
|
||||||
.no_pid:
|
.no_pid:
|
||||||
@@ -1106,25 +1106,25 @@ f68:
|
|||||||
cmp ebx, 31
|
cmp ebx, 31
|
||||||
ja undefined_syscall
|
ja undefined_syscall
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
jmp dword [f68call+ebx*4-11*4]
|
jmp dword [f68call + ebx*4-11*4]
|
||||||
.11:
|
.11:
|
||||||
call init_heap
|
call init_heap
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
.12:
|
.12:
|
||||||
stdcall user_alloc, ecx
|
stdcall user_alloc, ecx
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
.13:
|
.13:
|
||||||
stdcall user_free, ecx
|
stdcall user_free, ecx
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
.14:
|
.14:
|
||||||
cmp ecx, OS_BASE
|
cmp ecx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
mov edi, ecx
|
mov edi, ecx
|
||||||
call get_event_ex
|
call get_event_ex
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
.16:
|
.16:
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
@@ -1132,11 +1132,11 @@ f68:
|
|||||||
cmp ecx, OS_BASE
|
cmp ecx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
stdcall get_service, ecx
|
stdcall get_service, ecx
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
.17:
|
.17:
|
||||||
call srv_handlerEx ;ecx
|
call srv_handlerEx ;ecx
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
.18:
|
.18:
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
@@ -1144,13 +1144,13 @@ f68:
|
|||||||
cmp ecx, OS_BASE
|
cmp ecx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
stdcall load_library, ecx, eax
|
stdcall load_library, ecx, eax
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
.20:
|
.20:
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
mov ebx, ecx
|
mov ebx, ecx
|
||||||
call user_realloc ;in: eax = pointer, ebx = new size
|
call user_realloc ;in: eax = pointer, ebx = new size
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
.21:
|
.21:
|
||||||
cmp ecx, OS_BASE
|
cmp ecx, OS_BASE
|
||||||
@@ -1158,48 +1158,48 @@ f68:
|
|||||||
cmp edx, OS_BASE
|
cmp edx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
stdcall load_pe_driver, ecx, edx
|
stdcall load_pe_driver, ecx, edx
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
.22:
|
.22:
|
||||||
cmp ecx, OS_BASE
|
cmp ecx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
stdcall shmem_open, ecx, edx, esi
|
stdcall shmem_open, ecx, edx, esi
|
||||||
mov [esp+SYSCALL_STACK._edx], edx
|
mov [esp + SYSCALL_STACK._edx], edx
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
.23:
|
.23:
|
||||||
cmp ecx, OS_BASE
|
cmp ecx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
stdcall shmem_close, ecx
|
stdcall shmem_close, ecx
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
.24:
|
.24:
|
||||||
mov eax, [current_slot]
|
mov eax, [current_slot]
|
||||||
xchg ecx, [eax+APPDATA.exc_handler]
|
xchg ecx, [eax + APPDATA.exc_handler]
|
||||||
xchg edx, [eax+APPDATA.except_mask]
|
xchg edx, [eax + APPDATA.except_mask]
|
||||||
mov [esp+SYSCALL_STACK._ebx], edx
|
mov [esp + SYSCALL_STACK._ebx], edx
|
||||||
mov [esp+SYSCALL_STACK._eax], ecx
|
mov [esp + SYSCALL_STACK._eax], ecx
|
||||||
ret
|
ret
|
||||||
.25:
|
.25:
|
||||||
cmp ecx, 32
|
cmp ecx, 32
|
||||||
jae .fail
|
jae .fail
|
||||||
mov eax, [current_slot]
|
mov eax, [current_slot]
|
||||||
btr [eax+APPDATA.except_mask], ecx
|
btr [eax + APPDATA.except_mask], ecx
|
||||||
setc byte[esp+SYSCALL_STACK._eax]
|
setc byte[esp + SYSCALL_STACK._eax]
|
||||||
jecxz @f
|
jecxz @f
|
||||||
bts [eax+APPDATA.except_mask], ecx
|
bts [eax + APPDATA.except_mask], ecx
|
||||||
@@:
|
@@:
|
||||||
ret
|
ret
|
||||||
.26:
|
.26:
|
||||||
stdcall user_unmap, ecx, edx, esi
|
stdcall user_unmap, ecx, edx, esi
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
.27:
|
.27:
|
||||||
cmp ecx, OS_BASE
|
cmp ecx, OS_BASE
|
||||||
jae .fail
|
jae .fail
|
||||||
stdcall load_file_umode, ecx
|
stdcall load_file_umode, ecx
|
||||||
mov [esp+SYSCALL_STACK._edx], edx
|
mov [esp + SYSCALL_STACK._edx], edx
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
.28:
|
.28:
|
||||||
cmp ecx, OS_BASE
|
cmp ecx, OS_BASE
|
||||||
@@ -1214,15 +1214,15 @@ f68:
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz @f
|
jz @f
|
||||||
stdcall load_file_umode, ebp
|
stdcall load_file_umode, ebp
|
||||||
mov [esp+SYSCALL_STACK._edx], edx
|
mov [esp + SYSCALL_STACK._edx], edx
|
||||||
@@:
|
@@:
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
stdcall kernel_free, ebp
|
stdcall kernel_free, ebp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.29:
|
.29:
|
||||||
stdcall user_ring, ecx
|
stdcall user_ring, ecx
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; unload driver
|
; unload driver
|
||||||
@@ -1237,7 +1237,7 @@ f68:
|
|||||||
cmp [ecx+SRV.size], sizeof.SRV
|
cmp [ecx+SRV.size], sizeof.SRV
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
mov eax, [ecx+SRV.entry]
|
mov eax, [ecx + SRV.entry]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
push ecx ;save handl
|
push ecx ;save handl
|
||||||
@@ -1248,20 +1248,20 @@ f68:
|
|||||||
lea esp, [esp+8]
|
lea esp, [esp+8]
|
||||||
push ecx
|
push ecx
|
||||||
|
|
||||||
mov ebx, [ecx+SRV.base]
|
mov ebx, [ecx + SRV.base]
|
||||||
mov eax, -2 ;error free RAM
|
mov eax, -2 ;error free RAM
|
||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
jz .fail
|
jz .fail
|
||||||
stdcall kernel_free, ebx ;del driver
|
stdcall kernel_free, ebx ;del driver
|
||||||
|
|
||||||
mov eax, [ecx+SRV.fd]
|
mov eax, [ecx + SRV.fd]
|
||||||
mov edx, [ecx+SRV.bk]
|
mov edx, [ecx + SRV.bk]
|
||||||
mov [edx+SRV.fd], eax
|
mov [edx + SRV.fd], eax
|
||||||
mov [eax+SRV.bk], edx
|
mov [eax + SRV.bk], edx
|
||||||
stdcall free, ecx
|
stdcall free, ecx
|
||||||
;dec [count_services]
|
;dec [count_services]
|
||||||
|
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
.31: ; get list service
|
.31: ; get list service
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
@@ -1271,9 +1271,9 @@ f68:
|
|||||||
|
|
||||||
mov ebx, [srv.fd]
|
mov ebx, [srv.fd]
|
||||||
mov ecx, [srv.bk]
|
mov ecx, [srv.bk]
|
||||||
mov [esp+SYSCALL_STACK._ebx], ebx ;fd
|
mov [esp + SYSCALL_STACK._ebx], ebx ;fd
|
||||||
mov [esp+SYSCALL_STACK._ecx], ecx ;bk
|
mov [esp + SYSCALL_STACK._ecx], ecx ;bk
|
||||||
mov [esp+SYSCALL_STACK._eax], 0
|
mov [esp + SYSCALL_STACK._eax], 0
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
dec ecx
|
dec ecx
|
||||||
@@ -1284,9 +1284,9 @@ f68:
|
|||||||
jbe .fail
|
jbe .fail
|
||||||
stdcall is_region_userspace, edi, 40 ;16+4*6=40 <-max size buffer
|
stdcall is_region_userspace, edi, 40 ;16+4*6=40 <-max size buffer
|
||||||
jnz .fail ; edi = pointer on buffer
|
jnz .fail ; edi = pointer on buffer
|
||||||
cmp [edx+SRV.magic], ' SRV'
|
cmp [edx + SRV.magic], ' SRV'
|
||||||
jne .fail
|
jne .fail
|
||||||
cmp [edx+SRV.size], sizeof.SRV
|
cmp [edx + SRV.size], sizeof.SRV
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
mov esi, edx
|
mov esi, edx
|
||||||
@@ -1303,10 +1303,8 @@ f68:
|
|||||||
;movsd ; SRV.srv_proc_ex
|
;movsd ; SRV.srv_proc_ex
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
|
||||||
ret
|
|
||||||
.fail:
|
.fail:
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@@ -1353,8 +1351,8 @@ proc load_pe_driver stdcall, file:dword, cmdline:dword
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail_init
|
jz .fail_init
|
||||||
|
|
||||||
mov [eax+SRV.base], ebx
|
mov [eax + SRV.base], ebx
|
||||||
mov [eax+SRV.entry], esi
|
mov [eax + SRV.entry], esi
|
||||||
pop esi
|
pop esi
|
||||||
ret
|
ret
|
||||||
.fail_init:
|
.fail_init:
|
||||||
@@ -1403,8 +1401,8 @@ proc create_ring_buffer stdcall, size:dword, flags:dword
|
|||||||
shl edx, 2
|
shl edx, 2
|
||||||
shr edi, 10
|
shr edi, 10
|
||||||
@@:
|
@@:
|
||||||
mov [page_tabs+edi], eax
|
mov [page_tabs + edi], eax
|
||||||
mov [page_tabs+edi+edx], eax
|
mov [page_tabs + edi + edx], eax
|
||||||
invlpg [ebx]
|
invlpg [ebx]
|
||||||
invlpg [ebx+0x10000]
|
invlpg [ebx+0x10000]
|
||||||
add eax, 0x1000
|
add eax, 0x1000
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -122,7 +122,7 @@ proc mtrr_reconfigure
|
|||||||
; 1. Prepare local variables.
|
; 1. Prepare local variables.
|
||||||
; 1a. Create list of MAX_RANGES free (aka not yet allocated) ranges.
|
; 1a. Create list of MAX_RANGES free (aka not yet allocated) ranges.
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
lea ecx, [eax+MAX_RANGES]
|
lea ecx, [eax + MAX_RANGES]
|
||||||
.init_ranges:
|
.init_ranges:
|
||||||
sub esp, sizeof.mtrr_range - 4
|
sub esp, sizeof.mtrr_range - 4
|
||||||
push eax
|
push eax
|
||||||
@@ -262,14 +262,14 @@ end virtual
|
|||||||
jz .found_place_wb
|
jz .found_place_wb
|
||||||
mov eax, ebx
|
mov eax, ebx
|
||||||
mov edx, ebp
|
mov edx, ebp
|
||||||
sub eax, dword [edi+mtrr_range.start]
|
sub eax, dword [edi + mtrr_range.start]
|
||||||
sbb edx, dword [edi+mtrr_range.start+4]
|
sbb edx, dword [edi + mtrr_range.start+4]
|
||||||
jb .found_place_wb
|
jb .found_place_wb
|
||||||
; Otherwise, if end of the next range is greater than or equal to ebp:ebx,
|
; Otherwise, if end of the next range is greater than or equal to ebp:ebx,
|
||||||
; exit the loop to 5e.
|
; exit the loop to 5e.
|
||||||
mov esi, edi
|
mov esi, edi
|
||||||
sub eax, dword [edi+mtrr_range.length]
|
sub eax, dword [edi + mtrr_range.length]
|
||||||
sbb edx, dword [edi+mtrr_range.length+4]
|
sbb edx, dword [edi + mtrr_range.length+4]
|
||||||
jb .expand_wb
|
jb .expand_wb
|
||||||
or eax, edx
|
or eax, edx
|
||||||
jnz .find_range_wb
|
jnz .find_range_wb
|
||||||
@@ -282,10 +282,10 @@ end virtual
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .abort
|
jz .abort
|
||||||
mov [esi], eax
|
mov [esi], eax
|
||||||
mov edx, [eax+mtrr_range.next]
|
mov edx, [eax + mtrr_range.next]
|
||||||
mov [.first_free_range], edx
|
mov [.first_free_range], edx
|
||||||
mov dword [eax+mtrr_range.start], ebx
|
mov dword [eax + mtrr_range.start], ebx
|
||||||
mov dword [eax+mtrr_range.start+4], ebp
|
mov dword [eax + mtrr_range.start+4], ebp
|
||||||
; Don't fill [eax+mtrr_range.next] and [eax+mtrr_range.length] yet,
|
; Don't fill [eax+mtrr_range.next] and [eax+mtrr_range.length] yet,
|
||||||
; they will be calculated including merges at step 5e.
|
; they will be calculated including merges at step 5e.
|
||||||
mov esi, edi
|
mov esi, edi
|
||||||
@@ -306,21 +306,21 @@ end virtual
|
|||||||
jz .expand_wb_done
|
jz .expand_wb_done
|
||||||
mov eax, ebx
|
mov eax, ebx
|
||||||
mov edx, ebp
|
mov edx, ebp
|
||||||
sub eax, dword [esi+mtrr_range.start]
|
sub eax, dword [esi + mtrr_range.start]
|
||||||
sbb edx, dword [esi+mtrr_range.start+4]
|
sbb edx, dword [esi + mtrr_range.start+4]
|
||||||
jb .expand_wb_done
|
jb .expand_wb_done
|
||||||
; Otherwise, if end of the next range is greater than or equal to ebp:ebx,
|
; Otherwise, if end of the next range is greater than or equal to ebp:ebx,
|
||||||
; exit the loop to 5f.
|
; exit the loop to 5f.
|
||||||
sub eax, dword [esi+mtrr_range.length]
|
sub eax, dword [esi + mtrr_range.length]
|
||||||
sbb edx, dword [esi+mtrr_range.length+4]
|
sbb edx, dword [esi + mtrr_range.length+4]
|
||||||
jb .expand_wb_last
|
jb .expand_wb_last
|
||||||
; Otherwise, the current range is completely within the new range.
|
; Otherwise, the current range is completely within the new range.
|
||||||
; Free it and continue the loop.
|
; Free it and continue the loop.
|
||||||
mov edx, [esi+mtrr_range.next]
|
mov edx, [esi + mtrr_range.next]
|
||||||
cmp esi, edi
|
cmp esi, edi
|
||||||
jz @f
|
jz @f
|
||||||
mov eax, [.first_free_range]
|
mov eax, [.first_free_range]
|
||||||
mov [esi+mtrr_range.next], eax
|
mov [esi + mtrr_range.next], eax
|
||||||
mov [.first_free_range], esi
|
mov [.first_free_range], esi
|
||||||
@@:
|
@@:
|
||||||
mov esi, edx
|
mov esi, edx
|
||||||
@@ -334,13 +334,13 @@ end virtual
|
|||||||
jz .next_wb_range
|
jz .next_wb_range
|
||||||
; Otherwise, set end of interval at esi to end of interval at edi
|
; Otherwise, set end of interval at esi to end of interval at edi
|
||||||
; and free range described by edi.
|
; and free range described by edi.
|
||||||
mov ebx, dword [esi+mtrr_range.start]
|
mov ebx, dword [esi + mtrr_range.start]
|
||||||
mov ebp, dword [esi+mtrr_range.start+4]
|
mov ebp, dword [esi + mtrr_range.start+4]
|
||||||
add ebx, dword [esi+mtrr_range.length]
|
add ebx, dword [esi + mtrr_range.length]
|
||||||
adc ebp, dword [esi+mtrr_range.length+4]
|
adc ebp, dword [esi + mtrr_range.length+4]
|
||||||
mov edx, [esi+mtrr_range.next]
|
mov edx, [esi + mtrr_range.next]
|
||||||
mov eax, [.first_free_range]
|
mov eax, [.first_free_range]
|
||||||
mov [esi+mtrr_range.next], eax
|
mov [esi + mtrr_range.next], eax
|
||||||
mov [.first_free_range], esi
|
mov [.first_free_range], esi
|
||||||
mov esi, edx
|
mov esi, edx
|
||||||
.expand_wb_done:
|
.expand_wb_done:
|
||||||
@@ -348,11 +348,11 @@ end virtual
|
|||||||
; the new end of range (maybe ebp:ebx from the new range
|
; the new end of range (maybe ebp:ebx from the new range
|
||||||
; or end of another existing interval calculated at step 5f).
|
; or end of another existing interval calculated at step 5f).
|
||||||
; Write them to range at edi.
|
; Write them to range at edi.
|
||||||
mov [edi+mtrr_range.next], esi
|
mov [edi + mtrr_range.next], esi
|
||||||
sub ebx, dword [edi+mtrr_range.start]
|
sub ebx, dword [edi + mtrr_range.start]
|
||||||
sbb ebp, dword [edi+mtrr_range.start+4]
|
sbb ebp, dword [edi + mtrr_range.start+4]
|
||||||
mov dword [edi+mtrr_range.length], ebx
|
mov dword [edi + mtrr_range.length], ebx
|
||||||
mov dword [edi+mtrr_range.length+4], ebp
|
mov dword [edi + mtrr_range.length+4], ebp
|
||||||
.next_wb_range:
|
.next_wb_range:
|
||||||
; 5h. Continue the loop 5b-5g over all configured MTRRs.
|
; 5h. Continue the loop 5b-5g over all configured MTRRs.
|
||||||
add ecx, 16
|
add ecx, 16
|
||||||
@@ -379,16 +379,16 @@ end virtual
|
|||||||
jz .next_uc_range
|
jz .next_uc_range
|
||||||
; If start of the next range is greater than or equal to ebp:ebx,
|
; If start of the next range is greater than or equal to ebp:ebx,
|
||||||
; exit the loop to 6e.
|
; exit the loop to 6e.
|
||||||
mov eax, dword [edi+mtrr_range.start]
|
mov eax, dword [edi + mtrr_range.start]
|
||||||
mov edx, dword [edi+mtrr_range.start+4]
|
mov edx, dword [edi + mtrr_range.start+4]
|
||||||
sub eax, ebx
|
sub eax, ebx
|
||||||
sbb edx, ebp
|
sbb edx, ebp
|
||||||
jnb .truncate_uc
|
jnb .truncate_uc
|
||||||
; Otherwise, continue the loop if end of the next range is less than ebp:ebx,
|
; Otherwise, continue the loop if end of the next range is less than ebp:ebx,
|
||||||
; exit the loop to 6d otherwise.
|
; exit the loop to 6d otherwise.
|
||||||
mov esi, edi
|
mov esi, edi
|
||||||
add eax, dword [edi+mtrr_range.length]
|
add eax, dword [edi + mtrr_range.length]
|
||||||
adc edx, dword [edi+mtrr_range.length+4]
|
adc edx, dword [edi + mtrr_range.length+4]
|
||||||
jnb .find_range_uc
|
jnb .find_range_uc
|
||||||
; 6d. ebp:ebx is inside (or at end of) an existing range.
|
; 6d. ebp:ebx is inside (or at end of) an existing range.
|
||||||
; Split the range. (The second range, maybe containing completely within UC-range,
|
; Split the range. (The second range, maybe containing completely within UC-range,
|
||||||
@@ -396,21 +396,21 @@ end virtual
|
|||||||
mov edi, [.first_free_range]
|
mov edi, [.first_free_range]
|
||||||
test edi, edi
|
test edi, edi
|
||||||
jz .abort
|
jz .abort
|
||||||
mov dword [edi+mtrr_range.start], ebx
|
mov dword [edi + mtrr_range.start], ebx
|
||||||
mov dword [edi+mtrr_range.start+4], ebp
|
mov dword [edi + mtrr_range.start+4], ebp
|
||||||
mov dword [edi+mtrr_range.length], eax
|
mov dword [edi + mtrr_range.length], eax
|
||||||
mov dword [edi+mtrr_range.length+4], edx
|
mov dword [edi + mtrr_range.length+4], edx
|
||||||
mov eax, [edi+mtrr_range.next]
|
mov eax, [edi + mtrr_range.next]
|
||||||
mov [.first_free_range], eax
|
mov [.first_free_range], eax
|
||||||
mov eax, [esi+mtrr_range.next]
|
mov eax, [esi + mtrr_range.next]
|
||||||
mov [edi+mtrr_range.next], eax
|
mov [edi + mtrr_range.next], eax
|
||||||
; don't change [esi+mtrr_range.next] yet, it will be filled at step 6e
|
; don't change [esi+mtrr_range.next] yet, it will be filled at step 6e
|
||||||
mov eax, ebx
|
mov eax, ebx
|
||||||
mov edx, ebp
|
mov edx, ebp
|
||||||
sub eax, dword [esi+mtrr_range.start]
|
sub eax, dword [esi + mtrr_range.start]
|
||||||
sbb edx, dword [esi+mtrr_range.start+4]
|
sbb edx, dword [esi + mtrr_range.start+4]
|
||||||
mov dword [esi+mtrr_range.length], eax
|
mov dword [esi + mtrr_range.length], eax
|
||||||
mov dword [esi+mtrr_range.length+4], edx
|
mov dword [esi + mtrr_range.length+4], edx
|
||||||
.truncate_uc:
|
.truncate_uc:
|
||||||
; 6e. edi is the first range after ebp:ebx, check it and next ranges
|
; 6e. edi is the first range after ebp:ebx, check it and next ranges
|
||||||
; for intersection with the new range, truncate heads.
|
; for intersection with the new range, truncate heads.
|
||||||
@@ -422,21 +422,21 @@ end virtual
|
|||||||
; exit the loop to 6g.
|
; exit the loop to 6g.
|
||||||
mov eax, ebx
|
mov eax, ebx
|
||||||
mov edx, ebp
|
mov edx, ebp
|
||||||
sub eax, dword [edi+mtrr_range.start]
|
sub eax, dword [edi + mtrr_range.start]
|
||||||
sbb edx, dword [edi+mtrr_range.start+4]
|
sbb edx, dword [edi + mtrr_range.start+4]
|
||||||
jb .truncate_uc_done
|
jb .truncate_uc_done
|
||||||
; Otherwise, if end of the next range is greater than ebp:ebx,
|
; Otherwise, if end of the next range is greater than ebp:ebx,
|
||||||
; exit the loop to 6f.
|
; exit the loop to 6f.
|
||||||
sub eax, dword [edi+mtrr_range.length]
|
sub eax, dword [edi + mtrr_range.length]
|
||||||
sbb edx, dword [edi+mtrr_range.length+4]
|
sbb edx, dword [edi + mtrr_range.length+4]
|
||||||
jb .truncate_uc_last
|
jb .truncate_uc_last
|
||||||
; Otherwise, the current range is completely within the new range.
|
; Otherwise, the current range is completely within the new range.
|
||||||
; Free it and continue the loop if there is a next range.
|
; Free it and continue the loop if there is a next range.
|
||||||
; If that was a last range, exit the loop to 6g.
|
; If that was a last range, exit the loop to 6g.
|
||||||
mov edx, [edi+mtrr_range.next]
|
mov edx, [edi + mtrr_range.next]
|
||||||
mov eax, [.first_free_range]
|
mov eax, [.first_free_range]
|
||||||
mov [.first_free_range], edi
|
mov [.first_free_range], edi
|
||||||
mov [edi+mtrr_range.next], eax
|
mov [edi + mtrr_range.next], eax
|
||||||
mov edi, edx
|
mov edi, edx
|
||||||
test edi, edi
|
test edi, edi
|
||||||
jnz .truncate_uc_loop
|
jnz .truncate_uc_loop
|
||||||
@@ -444,17 +444,17 @@ end virtual
|
|||||||
.truncate_uc_last:
|
.truncate_uc_last:
|
||||||
; 6f. The range at edi partially intersects with the UC-range described by MTRR.
|
; 6f. The range at edi partially intersects with the UC-range described by MTRR.
|
||||||
; Truncate it from the head.
|
; Truncate it from the head.
|
||||||
mov dword [edi+mtrr_range.start], ebx
|
mov dword [edi + mtrr_range.start], ebx
|
||||||
mov dword [edi+mtrr_range.start+4], ebp
|
mov dword [edi + mtrr_range.start+4], ebp
|
||||||
neg eax
|
neg eax
|
||||||
adc edx, 0
|
adc edx, 0
|
||||||
neg edx
|
neg edx
|
||||||
mov dword [edi+mtrr_range.length], eax
|
mov dword [edi + mtrr_range.length], eax
|
||||||
mov dword [edi+mtrr_range.length+4], edx
|
mov dword [edi + mtrr_range.length+4], edx
|
||||||
.truncate_uc_done:
|
.truncate_uc_done:
|
||||||
; 6g. We have found the next range (maybe 0) after intersection.
|
; 6g. We have found the next range (maybe 0) after intersection.
|
||||||
; Write it to [esi+mtrr_range.next].
|
; Write it to [esi+mtrr_range.next].
|
||||||
mov [esi+mtrr_range.next], edi
|
mov [esi + mtrr_range.next], edi
|
||||||
.next_uc_range:
|
.next_uc_range:
|
||||||
; 6h. Continue the loop 6b-6g over all configured MTRRs.
|
; 6h. Continue the loop 6b-6g over all configured MTRRs.
|
||||||
add ecx, 16
|
add ecx, 16
|
||||||
@@ -468,16 +468,16 @@ end virtual
|
|||||||
; 7. BIOS has not configured variable-range MTRRs.
|
; 7. BIOS has not configured variable-range MTRRs.
|
||||||
; Create one range from 0 to [MEM_AMOUNT].
|
; Create one range from 0 to [MEM_AMOUNT].
|
||||||
mov eax, [.first_free_range]
|
mov eax, [.first_free_range]
|
||||||
mov edx, [eax+mtrr_range.next]
|
mov edx, [eax + mtrr_range.next]
|
||||||
mov [.first_free_range], edx
|
mov [.first_free_range], edx
|
||||||
mov [.first_range], eax
|
mov [.first_range], eax
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
mov [eax+mtrr_range.next], edx
|
mov [eax + mtrr_range.next], edx
|
||||||
mov dword [eax+mtrr_range.start], edx
|
mov dword [eax + mtrr_range.start], edx
|
||||||
mov dword [eax+mtrr_range.start+4], edx
|
mov dword [eax + mtrr_range.start+4], edx
|
||||||
mov ecx, [MEM_AMOUNT]
|
mov ecx, [MEM_AMOUNT]
|
||||||
mov dword [eax+mtrr_range.length], ecx
|
mov dword [eax + mtrr_range.length], ecx
|
||||||
mov dword [eax+mtrr_range.length+4], edx
|
mov dword [eax + mtrr_range.length+4], edx
|
||||||
.ranges_ok:
|
.ranges_ok:
|
||||||
; 8. We have calculated list of WB-ranges.
|
; 8. We have calculated list of WB-ranges.
|
||||||
; Now we should calculate a list of MTRRs so that
|
; Now we should calculate a list of MTRRs so that
|
||||||
@@ -497,20 +497,20 @@ end virtual
|
|||||||
; append them to end of range.
|
; append them to end of range.
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edi, [.first_range]
|
mov edi, [.first_range]
|
||||||
cmp dword [edi+mtrr_range.start], eax
|
cmp dword [edi + mtrr_range.start], eax
|
||||||
jnz .abort
|
jnz .abort
|
||||||
cmp dword [edi+mtrr_range.start+4], eax
|
cmp dword [edi + mtrr_range.start+4], eax
|
||||||
jnz .abort
|
jnz .abort
|
||||||
cmp dword [edi+mtrr_range.length+4], eax
|
cmp dword [edi + mtrr_range.length+4], eax
|
||||||
jnz .abort
|
jnz .abort
|
||||||
mov edx, [edi+mtrr_range.next]
|
mov edx, [edi + mtrr_range.next]
|
||||||
test edx, edx
|
test edx, edx
|
||||||
jz @f
|
jz @f
|
||||||
cmp dword [edx+mtrr_range.start], eax
|
cmp dword [edx + mtrr_range.start], eax
|
||||||
jnz .abort
|
jnz .abort
|
||||||
cmp dword [edx+mtrr_range.start+4], 1
|
cmp dword [edx + mtrr_range.start+4], 1
|
||||||
jnz .abort
|
jnz .abort
|
||||||
cmp [edx+mtrr_range.next], eax
|
cmp [edx + mtrr_range.next], eax
|
||||||
jnz .abort
|
jnz .abort
|
||||||
@@:
|
@@:
|
||||||
; 8b. Initialize: no MTRRs filled.
|
; 8b. Initialize: no MTRRs filled.
|
||||||
@@ -522,10 +522,10 @@ end virtual
|
|||||||
; reset start to 2*start and return to this step.
|
; reset start to 2*start and return to this step.
|
||||||
; Example: [4G,24G) -> [4G,8G) {returning} + [8G,16G) {returning}
|
; Example: [4G,24G) -> [4G,8G) {returning} + [8G,16G) {returning}
|
||||||
; + [16G,24G) {advancing to ?}.
|
; + [16G,24G) {advancing to ?}.
|
||||||
mov eax, dword [edi+mtrr_range.length+4]
|
mov eax, dword [edi + mtrr_range.length+4]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .less4G
|
jz .less4G
|
||||||
mov edx, dword [edi+mtrr_range.start+4]
|
mov edx, dword [edi + mtrr_range.start+4]
|
||||||
cmp eax, edx
|
cmp eax, edx
|
||||||
jb .start_aligned
|
jb .start_aligned
|
||||||
inc [.num_used_mtrrs]
|
inc [.num_used_mtrrs]
|
||||||
@@ -536,10 +536,10 @@ end virtual
|
|||||||
mov dword [esi+8], 0
|
mov dword [esi+8], 0
|
||||||
mov dword [esi+12], edx
|
mov dword [esi+12], edx
|
||||||
add esi, 16
|
add esi, 16
|
||||||
add dword [edi+mtrr_range.start+4], edx
|
add dword [edi + mtrr_range.start+4], edx
|
||||||
sub dword [edi+mtrr_range.length+4], edx
|
sub dword [edi + mtrr_range.length+4], edx
|
||||||
jnz .range2mtrr_loop
|
jnz .range2mtrr_loop
|
||||||
cmp dword [edi+mtrr_range.length], 0
|
cmp dword [edi + mtrr_range.length], 0
|
||||||
jz .range2mtrr_next
|
jz .range2mtrr_next
|
||||||
.less4G:
|
.less4G:
|
||||||
; 8d. If we are dealing with low-memory range (before 4G)
|
; 8d. If we are dealing with low-memory range (before 4G)
|
||||||
@@ -549,25 +549,25 @@ end virtual
|
|||||||
; variants [0,0x80000000)+(another range to be splitted) and
|
; variants [0,0x80000000)+(another range to be splitted) and
|
||||||
; [0,0x100000000)-(another range to be splitted); we forbid the last variant,
|
; [0,0x100000000)-(another range to be splitted); we forbid the last variant,
|
||||||
; so the first variant must be used.
|
; so the first variant must be used.
|
||||||
bsr ecx, dword [edi+mtrr_range.length]
|
bsr ecx, dword [edi + mtrr_range.length]
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
inc edx
|
inc edx
|
||||||
shl edx, cl
|
shl edx, cl
|
||||||
lea eax, [edx*2]
|
lea eax, [edx*2]
|
||||||
add eax, dword [edi+mtrr_range.start]
|
add eax, dword [edi + mtrr_range.start]
|
||||||
jnz .start_aligned
|
jnz .start_aligned
|
||||||
inc [.num_used_mtrrs]
|
inc [.num_used_mtrrs]
|
||||||
cmp [.num_used_mtrrs], MAX_USEFUL_MTRRS
|
cmp [.num_used_mtrrs], MAX_USEFUL_MTRRS
|
||||||
ja .abort
|
ja .abort
|
||||||
mov eax, dword [edi+mtrr_range.start]
|
mov eax, dword [edi + mtrr_range.start]
|
||||||
mov dword [esi], eax
|
mov dword [esi], eax
|
||||||
or dword [esi], MEM_WB
|
or dword [esi], MEM_WB
|
||||||
mov dword [esi+4], 0
|
mov dword [esi+4], 0
|
||||||
mov dword [esi+8], edx
|
mov dword [esi+8], edx
|
||||||
mov dword [esi+12], 0
|
mov dword [esi+12], 0
|
||||||
add esi, 16
|
add esi, 16
|
||||||
add dword [edi+mtrr_range.start], edx
|
add dword [edi + mtrr_range.start], edx
|
||||||
sub dword [edi+mtrr_range.length], edx
|
sub dword [edi + mtrr_range.length], edx
|
||||||
jnz .less4G
|
jnz .less4G
|
||||||
jmp .range2mtrr_next
|
jmp .range2mtrr_next
|
||||||
.start_aligned:
|
.start_aligned:
|
||||||
@@ -594,9 +594,9 @@ end virtual
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
bsf edx, dword [edi+mtrr_range.length]
|
bsf edx, dword [edi + mtrr_range.length]
|
||||||
jnz @f
|
jnz @f
|
||||||
bsf edx, dword [edi+mtrr_range.length+4]
|
bsf edx, dword [edi + mtrr_range.length+4]
|
||||||
add edx, 32
|
add edx, 32
|
||||||
@@:
|
@@:
|
||||||
push edx ; save position of lowest 1-bit for step 8f
|
push edx ; save position of lowest 1-bit for step 8f
|
||||||
@@ -607,7 +607,7 @@ end virtual
|
|||||||
inc eax ; increment difference in hope for 1-bit
|
inc eax ; increment difference in hope for 1-bit
|
||||||
; Note: bt conveniently works with both .length and .length+4,
|
; Note: bt conveniently works with both .length and .length+4,
|
||||||
; depending on whether edx>=32.
|
; depending on whether edx>=32.
|
||||||
bt dword [edi+mtrr_range.length], edx
|
bt dword [edi + mtrr_range.length], edx
|
||||||
jc .calc_stat
|
jc .calc_stat
|
||||||
dec eax ; hope was wrong, decrement difference to correct 'inc'
|
dec eax ; hope was wrong, decrement difference to correct 'inc'
|
||||||
dec eax ; and again, now getting the real difference
|
dec eax ; and again, now getting the real difference
|
||||||
@@ -625,20 +625,20 @@ end virtual
|
|||||||
inc edx
|
inc edx
|
||||||
cmp edx, ecx
|
cmp edx, ecx
|
||||||
ja .fill_hi_init
|
ja .fill_hi_init
|
||||||
btc dword [edi+mtrr_range.length], edx
|
btc dword [edi + mtrr_range.length], edx
|
||||||
jmp @b
|
jmp @b
|
||||||
.fill_hi_init:
|
.fill_hi_init:
|
||||||
; 8g. Create MTRR ranges corresponding to upper 32 bits.
|
; 8g. Create MTRR ranges corresponding to upper 32 bits.
|
||||||
sub ecx, 32
|
sub ecx, 32
|
||||||
.fill_hi_loop:
|
.fill_hi_loop:
|
||||||
bsr edx, dword [edi+mtrr_range.length+4]
|
bsr edx, dword [edi + mtrr_range.length+4]
|
||||||
jz .fill_hi_done
|
jz .fill_hi_done
|
||||||
inc [.num_used_mtrrs]
|
inc [.num_used_mtrrs]
|
||||||
cmp [.num_used_mtrrs], MAX_USEFUL_MTRRS
|
cmp [.num_used_mtrrs], MAX_USEFUL_MTRRS
|
||||||
ja .abort
|
ja .abort
|
||||||
mov eax, dword [edi+mtrr_range.start]
|
mov eax, dword [edi + mtrr_range.start]
|
||||||
mov [esi], eax
|
mov [esi], eax
|
||||||
mov eax, dword [edi+mtrr_range.start+4]
|
mov eax, dword [edi + mtrr_range.start+4]
|
||||||
mov [esi+4], eax
|
mov [esi+4], eax
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [esi+8], eax
|
mov [esi+8], eax
|
||||||
@@ -647,14 +647,14 @@ end virtual
|
|||||||
cmp edx, ecx
|
cmp edx, ecx
|
||||||
jl .fill_hi_uc
|
jl .fill_hi_uc
|
||||||
or dword [esi], MEM_WB
|
or dword [esi], MEM_WB
|
||||||
add dword [edi+mtrr_range.start+4], eax
|
add dword [edi + mtrr_range.start+4], eax
|
||||||
jmp @f
|
jmp @f
|
||||||
.fill_hi_uc:
|
.fill_hi_uc:
|
||||||
sub dword [esi+4], eax
|
sub dword [esi+4], eax
|
||||||
sub dword [edi+mtrr_range.start+4], eax
|
sub dword [edi + mtrr_range.start+4], eax
|
||||||
@@:
|
@@:
|
||||||
add esi, 16
|
add esi, 16
|
||||||
sub dword [edi+mtrr_range.length], eax
|
sub dword [edi + mtrr_range.length], eax
|
||||||
jmp .fill_hi_loop
|
jmp .fill_hi_loop
|
||||||
.fill_hi_done:
|
.fill_hi_done:
|
||||||
; 8h. Create MTRR ranges corresponding to lower 32 bits.
|
; 8h. Create MTRR ranges corresponding to lower 32 bits.
|
||||||
@@ -665,9 +665,9 @@ end virtual
|
|||||||
inc [.num_used_mtrrs]
|
inc [.num_used_mtrrs]
|
||||||
cmp [.num_used_mtrrs], MAX_USEFUL_MTRRS
|
cmp [.num_used_mtrrs], MAX_USEFUL_MTRRS
|
||||||
ja .abort
|
ja .abort
|
||||||
mov eax, dword [edi+mtrr_range.start]
|
mov eax, dword [edi + mtrr_range.start]
|
||||||
mov [esi], eax
|
mov [esi], eax
|
||||||
mov eax, dword [edi+mtrr_range.start+4]
|
mov eax, dword [edi + mtrr_range.start+4]
|
||||||
mov [esi+4], eax
|
mov [esi+4], eax
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [esi+12], eax
|
mov [esi+12], eax
|
||||||
@@ -676,18 +676,18 @@ end virtual
|
|||||||
cmp edx, ecx
|
cmp edx, ecx
|
||||||
jl .fill_lo_uc
|
jl .fill_lo_uc
|
||||||
or dword [esi], MEM_WB
|
or dword [esi], MEM_WB
|
||||||
add dword [edi+mtrr_range.start], eax
|
add dword [edi + mtrr_range.start], eax
|
||||||
jmp @f
|
jmp @f
|
||||||
.fill_lo_uc:
|
.fill_lo_uc:
|
||||||
sub dword [esi], eax
|
sub dword [esi], eax
|
||||||
sub dword [edi+mtrr_range.start], eax
|
sub dword [edi + mtrr_range.start], eax
|
||||||
@@:
|
@@:
|
||||||
add esi, 16
|
add esi, 16
|
||||||
sub dword [edi+mtrr_range.length], eax
|
sub dword [edi + mtrr_range.length], eax
|
||||||
jmp .fill_lo_loop
|
jmp .fill_lo_loop
|
||||||
.range2mtrr_next:
|
.range2mtrr_next:
|
||||||
; 8i. Repeat the loop at 8c-8h for all ranges.
|
; 8i. Repeat the loop at 8c-8h for all ranges.
|
||||||
mov edi, [edi+mtrr_range.next]
|
mov edi, [edi + mtrr_range.next]
|
||||||
test edi, edi
|
test edi, edi
|
||||||
jnz .range2mtrr_loop
|
jnz .range2mtrr_loop
|
||||||
; 9. We have calculated needed MTRRs, now setup them in the CPU.
|
; 9. We have calculated needed MTRRs, now setup them in the CPU.
|
||||||
@@ -897,7 +897,7 @@ proc mtrr_validate
|
|||||||
dec eax
|
dec eax
|
||||||
; LFB is mapped to virtual address LFB_BASE,
|
; LFB is mapped to virtual address LFB_BASE,
|
||||||
; it uses global pages if supported by CPU.
|
; it uses global pages if supported by CPU.
|
||||||
mov ebx, [sys_proc+PROC.pdt_0+(LFB_BASE shr 20)]
|
mov ebx, [sys_proc + PROC.pdt_0 + (LFB_BASE shr 20)]
|
||||||
test ebx, PDE_LARGE
|
test ebx, PDE_LARGE
|
||||||
jnz @f
|
jnz @f
|
||||||
mov ebx, [page_tabs+(LFB_BASE shr 10)]
|
mov ebx, [page_tabs+(LFB_BASE shr 10)]
|
||||||
@@ -917,9 +917,9 @@ proc mtrr_validate
|
|||||||
mov eax, [pcidev_list.fd]
|
mov eax, [pcidev_list.fd]
|
||||||
cmp eax, pcidev_list ; sanity check: fail if no PCI devices
|
cmp eax, pcidev_list ; sanity check: fail if no PCI devices
|
||||||
jz .fail
|
jz .fail
|
||||||
cmp [eax+PCIDEV.vendor_device_id], 0x12378086
|
cmp [eax + PCIDEV.vendor_device_id], 0x12378086
|
||||||
jz .exit
|
jz .exit
|
||||||
cmp [eax+PCIDEV.vendor_device_id], 0x01228086
|
cmp [eax + PCIDEV.vendor_device_id], 0x01228086
|
||||||
jnz .fail
|
jnz .fail
|
||||||
.exit:
|
.exit:
|
||||||
ret
|
ret
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -27,14 +27,14 @@ proc load_PE stdcall, file_name:dword
|
|||||||
|
|
||||||
mov [image], eax
|
mov [image], eax
|
||||||
|
|
||||||
mov edx, [eax+STRIPPED_PE_HEADER.SizeOfImage]
|
mov edx, [eax + STRIPPED_PE_HEADER.SizeOfImage]
|
||||||
; mov cl, [eax+STRIPPED_PE_HEADER.Subsystem]
|
; mov cl, [eax + STRIPPED_PE_HEADER.Subsystem]
|
||||||
cmp word [eax], STRIPPED_PE_SIGNATURE
|
cmp word [eax], STRIPPED_PE_SIGNATURE
|
||||||
jz @f
|
jz @f
|
||||||
|
|
||||||
mov edx, [eax+60]
|
mov edx, [eax + 60]
|
||||||
; mov cl, [eax+5Ch+edx]
|
; mov cl, [eax + 5Ch + edx]
|
||||||
mov edx, [eax+80+edx]
|
mov edx, [eax + 80 + edx]
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
mov [entry], 0
|
mov [entry], 0
|
||||||
@@ -91,50 +91,50 @@ end virtual
|
|||||||
jz .stripped
|
jz .stripped
|
||||||
|
|
||||||
mov edx, ebx
|
mov edx, ebx
|
||||||
add edx, [ebx+60]
|
add edx, [ebx + 60]
|
||||||
movzx eax, word [edx+6]
|
movzx eax, word [edx + 6]
|
||||||
mov [.numsections], eax
|
mov [.numsections], eax
|
||||||
mov eax, [edx+40]
|
mov eax, [edx + 40]
|
||||||
mov [.AddressOfEntryPoint], eax
|
mov [.AddressOfEntryPoint], eax
|
||||||
mov eax, [edx+52]
|
mov eax, [edx + 52]
|
||||||
mov [.ImageBase], eax
|
mov [.ImageBase], eax
|
||||||
mov ecx, [edx+84]
|
mov ecx, [edx + 84]
|
||||||
mov [.section_header_size], 40
|
mov [.section_header_size], 40
|
||||||
mov eax, [edx+128]
|
mov eax, [edx + 128]
|
||||||
mov [.import_descr], eax
|
mov [.import_descr], eax
|
||||||
mov eax, [edx+160]
|
mov eax, [edx + 160]
|
||||||
mov [.relocs_rva], eax
|
mov [.relocs_rva], eax
|
||||||
mov eax, [edx+164]
|
mov eax, [edx + 164]
|
||||||
mov [.relocs_size], eax
|
mov [.relocs_size], eax
|
||||||
add edx, 256
|
add edx, 256
|
||||||
|
|
||||||
jmp .common
|
jmp .common
|
||||||
.stripped:
|
.stripped:
|
||||||
mov eax, [ebx+STRIPPED_PE_HEADER.AddressOfEntryPoint]
|
mov eax, [ebx + STRIPPED_PE_HEADER.AddressOfEntryPoint]
|
||||||
mov [.AddressOfEntryPoint], eax
|
mov [.AddressOfEntryPoint], eax
|
||||||
mov eax, [ebx+STRIPPED_PE_HEADER.ImageBase]
|
mov eax, [ebx + STRIPPED_PE_HEADER.ImageBase]
|
||||||
mov [.ImageBase], eax
|
mov [.ImageBase], eax
|
||||||
movzx eax, [ebx+STRIPPED_PE_HEADER.NumberOfSections]
|
movzx eax, [ebx + STRIPPED_PE_HEADER.NumberOfSections]
|
||||||
mov [.numsections], eax
|
mov [.numsections], eax
|
||||||
movzx ecx, [ebx+STRIPPED_PE_HEADER.NumberOfRvaAndSizes]
|
movzx ecx, [ebx + STRIPPED_PE_HEADER.NumberOfRvaAndSizes]
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [.relocs_rva], eax
|
mov [.relocs_rva], eax
|
||||||
mov [.relocs_size], eax
|
mov [.relocs_size], eax
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz @f
|
jz @f
|
||||||
mov eax, [ebx+sizeof.STRIPPED_PE_HEADER+SPE_DIRECTORY_IMPORT*8]
|
mov eax, [ebx + sizeof.STRIPPED_PE_HEADER + SPE_DIRECTORY_IMPORT*8]
|
||||||
@@:
|
@@:
|
||||||
mov [.import_descr], eax
|
mov [.import_descr], eax
|
||||||
cmp ecx, SPE_DIRECTORY_BASERELOC
|
cmp ecx, SPE_DIRECTORY_BASERELOC
|
||||||
jbe @f
|
jbe @f
|
||||||
mov eax, [ebx+sizeof.STRIPPED_PE_HEADER+SPE_DIRECTORY_BASERELOC*8]
|
mov eax, [ebx + sizeof.STRIPPED_PE_HEADER + SPE_DIRECTORY_BASERELOC*8]
|
||||||
mov [.relocs_rva], eax
|
mov [.relocs_rva], eax
|
||||||
mov eax, [ebx+sizeof.STRIPPED_PE_HEADER+SPE_DIRECTORY_BASERELOC*8+4]
|
mov eax, [ebx + sizeof.STRIPPED_PE_HEADER + SPE_DIRECTORY_BASERELOC*8+4]
|
||||||
mov [.relocs_size], eax
|
mov [.relocs_size], eax
|
||||||
@@:
|
@@:
|
||||||
mov [.section_header_size], 28
|
mov [.section_header_size], 28
|
||||||
lea edx, [ebx+ecx*8+sizeof.STRIPPED_PE_HEADER+8]
|
lea edx, [ebx + ecx*8 + sizeof.STRIPPED_PE_HEADER + 8]
|
||||||
mov ecx, [ebx+STRIPPED_PE_HEADER.SizeOfHeaders]
|
mov ecx, [ebx + STRIPPED_PE_HEADER.SizeOfHeaders]
|
||||||
|
|
||||||
.common:
|
.common:
|
||||||
mov esi, ebx
|
mov esi, ebx
|
||||||
@@ -145,14 +145,14 @@ end virtual
|
|||||||
cmp [.numsections], 0
|
cmp [.numsections], 0
|
||||||
jz .nosections
|
jz .nosections
|
||||||
.copy_sections:
|
.copy_sections:
|
||||||
mov eax, [edx+8]
|
mov eax, [edx + 8]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
je .no_section_data
|
je .no_section_data
|
||||||
mov esi, ebx
|
mov esi, ebx
|
||||||
mov edi, ebp
|
mov edi, ebp
|
||||||
add esi, [edx+12]
|
add esi, [edx + 12]
|
||||||
mov ecx, eax
|
mov ecx, eax
|
||||||
add edi, [edx+4]
|
add edi, [edx + 4]
|
||||||
|
|
||||||
add ecx, 3
|
add ecx, 3
|
||||||
shr ecx, 2
|
shr ecx, 2
|
||||||
@@ -163,7 +163,7 @@ end virtual
|
|||||||
cmp ecx, eax
|
cmp ecx, eax
|
||||||
jbe .no_section_fill
|
jbe .no_section_fill
|
||||||
sub ecx, eax
|
sub ecx, eax
|
||||||
add eax, [edx+4]
|
add eax, [edx + 4]
|
||||||
lea edi, [eax+ebp]
|
lea edi, [eax+ebp]
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
@@ -183,7 +183,7 @@ end virtual
|
|||||||
.relocs_block:
|
.relocs_block:
|
||||||
mov edi, [ecx]
|
mov edi, [ecx]
|
||||||
add edi, ebp
|
add edi, ebp
|
||||||
mov ebx, [ecx+4]
|
mov ebx, [ecx + 4]
|
||||||
add ecx, 8
|
add ecx, 8
|
||||||
sub [.relocs_size], ebx
|
sub [.relocs_size], ebx
|
||||||
sub ebx, 8
|
sub ebx, 8
|
||||||
@@ -211,13 +211,13 @@ end virtual
|
|||||||
mov [.bad_import], 0
|
mov [.bad_import], 0
|
||||||
.import_block:
|
.import_block:
|
||||||
mov ecx, [.import_descr]
|
mov ecx, [.import_descr]
|
||||||
cmp dword [ecx+4], 0
|
cmp dword [ecx + 4], 0
|
||||||
jne @f
|
jne @f
|
||||||
cmp dword [ecx+12], 0
|
cmp dword [ecx + 12], 0
|
||||||
je .done_imports
|
je .done_imports
|
||||||
@@:
|
@@:
|
||||||
mov edx, dword [ecx]
|
mov edx, dword [ecx]
|
||||||
mov ecx, dword [ecx+16]
|
mov ecx, dword [ecx + 16]
|
||||||
test edx, edx
|
test edx, edx
|
||||||
jnz @f
|
jnz @f
|
||||||
mov edx, ecx
|
mov edx, ecx
|
||||||
@@ -230,18 +230,18 @@ end virtual
|
|||||||
.import_func:
|
.import_func:
|
||||||
mov esi, [.import_idx]
|
mov esi, [.import_idx]
|
||||||
mov edi, [.import_names]
|
mov edi, [.import_names]
|
||||||
mov eax, [edi+esi*4]
|
mov eax, [edi + esi*4]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
je .next_import_block
|
je .next_import_block
|
||||||
js .next_import_block
|
js .next_import_block
|
||||||
lea edi, [ebp+eax]
|
lea edi, [ebp + eax]
|
||||||
mov eax, [.import_targets]
|
mov eax, [.import_targets]
|
||||||
mov dword [eax+esi*4], 0
|
mov dword [eax + esi*4], 0
|
||||||
lea esi, [edi+2]
|
lea esi, [edi + 2]
|
||||||
movzx ebx, word [edi]
|
movzx ebx, word [edi]
|
||||||
push 32
|
push 32
|
||||||
mov ecx, [__exports+32]
|
mov ecx, [__exports + 32]
|
||||||
mov eax, [ecx+OS_BASE+ebx*4]
|
mov eax, [ecx + OS_BASE + ebx*4]
|
||||||
add eax, OS_BASE
|
add eax, OS_BASE
|
||||||
push eax
|
push eax
|
||||||
push esi
|
push esi
|
||||||
@@ -251,8 +251,8 @@ end virtual
|
|||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
.import_func_candidate:
|
.import_func_candidate:
|
||||||
push 32
|
push 32
|
||||||
mov ecx, [__exports+32]
|
mov ecx, [__exports + 32]
|
||||||
mov eax, [ecx+OS_BASE+ebx*4]
|
mov eax, [ecx + OS_BASE + ebx*4]
|
||||||
add eax, OS_BASE
|
add eax, OS_BASE
|
||||||
push eax
|
push eax
|
||||||
push esi
|
push esi
|
||||||
@@ -260,12 +260,12 @@ end virtual
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
je .import_func_found
|
je .import_func_found
|
||||||
inc ebx
|
inc ebx
|
||||||
cmp ebx, [__exports+24]
|
cmp ebx, [__exports + 24]
|
||||||
jb .import_func_candidate
|
jb .import_func_candidate
|
||||||
|
|
||||||
mov esi, msg_unresolved
|
mov esi, msg_unresolved
|
||||||
call sys_msg_board_str
|
call sys_msg_board_str
|
||||||
lea esi, [edi+2]
|
lea esi, [edi + 2]
|
||||||
call sys_msg_board_str
|
call sys_msg_board_str
|
||||||
mov esi, msg_CR
|
mov esi, msg_CR
|
||||||
call sys_msg_board_str
|
call sys_msg_board_str
|
||||||
@@ -273,12 +273,12 @@ end virtual
|
|||||||
mov [.bad_import], 1
|
mov [.bad_import], 1
|
||||||
jmp .next_import_func
|
jmp .next_import_func
|
||||||
.import_func_found:
|
.import_func_found:
|
||||||
mov esi, [__exports+28]
|
mov esi, [__exports + 28]
|
||||||
mov edx, [.import_idx]
|
mov edx, [.import_idx]
|
||||||
mov ecx, [.import_targets]
|
mov ecx, [.import_targets]
|
||||||
mov eax, [esi+OS_BASE+ebx*4]
|
mov eax, [esi + OS_BASE + ebx*4]
|
||||||
add eax, OS_BASE
|
add eax, OS_BASE
|
||||||
mov [ecx+edx*4], eax
|
mov [ecx + edx*4], eax
|
||||||
.next_import_func:
|
.next_import_func:
|
||||||
inc [.import_idx]
|
inc [.import_idx]
|
||||||
jmp .import_func
|
jmp .import_func
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
|
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -73,8 +73,8 @@ update_counters:
|
|||||||
rdtsc
|
rdtsc
|
||||||
;sub eax, [edi+TASKDATA.counter_add] ; time stamp counter add
|
;sub eax, [edi+TASKDATA.counter_add] ; time stamp counter add
|
||||||
;add [edi+TASKDATA.counter_sum], eax ; counter sum
|
;add [edi+TASKDATA.counter_sum], eax ; counter sum
|
||||||
sub eax, [esi-sizeof.APPDATA+APPDATA.counter_add] ; time stamp counter add
|
sub eax, [esi - sizeof.APPDATA + APPDATA.counter_add] ; time stamp counter add
|
||||||
add [esi-sizeof.APPDATA+APPDATA.counter_sum], eax ; counter sum
|
add [esi - sizeof.APPDATA + APPDATA.counter_sum], eax ; counter sum
|
||||||
ret
|
ret
|
||||||
align 4
|
align 4
|
||||||
updatecputimes:
|
updatecputimes:
|
||||||
@@ -85,9 +85,9 @@ updatecputimes:
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
;xchg eax, [edi+TASKDATA.counter_sum]
|
;xchg eax, [edi+TASKDATA.counter_sum]
|
||||||
;mov [edi+TASKDATA.cpu_usage], eax
|
;mov [edi+TASKDATA.cpu_usage], eax
|
||||||
xchg eax, [esi+APPDATA.counter_sum]
|
xchg eax, [esi + APPDATA.counter_sum]
|
||||||
;add edi, 0x20
|
;add edi, 0x20
|
||||||
mov [esi+APPDATA.cpu_usage], eax
|
mov [esi + APPDATA.cpu_usage], eax
|
||||||
add esi, sizeof.APPDATA
|
add esi, sizeof.APPDATA
|
||||||
loop .newupdate
|
loop .newupdate
|
||||||
ret
|
ret
|
||||||
@@ -100,38 +100,38 @@ do_change_task:
|
|||||||
;param:
|
;param:
|
||||||
; ebx = address of the APPDATA for incoming task (new)
|
; ebx = address of the APPDATA for incoming task (new)
|
||||||
;warning:
|
;warning:
|
||||||
; [current_slot_idx] and [TASK_BASE] must be changed before (e.g. in find_next_task)
|
; [current_slot_idx] must be changed before (e.g. in find_next_task)
|
||||||
; [current_slot] is the outcoming (old), and set here to a new value (ebx)
|
; [current_slot] is the outcoming (old), and set here to a new value (ebx)
|
||||||
;scratched: eax,ecx,esi
|
;scratched: eax,ecx,esi
|
||||||
mov esi, ebx
|
mov esi, ebx
|
||||||
xchg esi, [current_slot]
|
xchg esi, [current_slot]
|
||||||
; set new stack after saving old
|
; set new stack after saving old
|
||||||
mov [esi+APPDATA.saved_esp], esp
|
mov [esi + APPDATA.saved_esp], esp
|
||||||
mov esp, [ebx+APPDATA.saved_esp]
|
mov esp, [ebx + APPDATA.saved_esp]
|
||||||
; set new thread io-map
|
; set new thread io-map
|
||||||
mov eax, [ebx+APPDATA.io_map]
|
mov eax, [ebx + APPDATA.io_map]
|
||||||
mov dword [page_tabs+((tss._io_map_0 and -4096) shr 10)], eax
|
mov dword [page_tabs + ((tss._io_map_0 and -4096) shr 10)], eax
|
||||||
mov eax, [ebx+APPDATA.io_map+4]
|
mov eax, [ebx + APPDATA.io_map+4]
|
||||||
mov dword [page_tabs+((tss._io_map_1 and -4096) shr 10)], eax
|
mov dword [page_tabs + ((tss._io_map_1 and -4096) shr 10)], eax
|
||||||
; set new thread memory-map
|
; set new thread memory-map
|
||||||
mov eax, [ebx+APPDATA.process]
|
mov eax, [ebx + APPDATA.process]
|
||||||
cmp eax, [current_process]
|
cmp eax, [current_process]
|
||||||
je @f
|
je @f
|
||||||
mov [current_process], eax
|
mov [current_process], eax
|
||||||
mov eax, [eax+PROC.pdt_0_phys]
|
mov eax, [eax + PROC.pdt_0_phys]
|
||||||
mov cr3, eax
|
mov cr3, eax
|
||||||
@@:
|
@@:
|
||||||
; set tss.esp0
|
; set tss.esp0
|
||||||
|
|
||||||
mov eax, [ebx+APPDATA.saved_esp0]
|
mov eax, [ebx + APPDATA.saved_esp0]
|
||||||
mov [tss._esp0], eax
|
mov [tss._esp0], eax
|
||||||
|
|
||||||
mov edx, [ebx+APPDATA.tls_base]
|
mov edx, [ebx + APPDATA.tls_base]
|
||||||
|
|
||||||
mov [tls_data_l+2], dx
|
mov [tls_data_l + 2], dx
|
||||||
shr edx, 16
|
shr edx, 16
|
||||||
mov [tls_data_l+4], dl
|
mov [tls_data_l + 4], dl
|
||||||
mov [tls_data_l+7], dh
|
mov [tls_data_l + 7], dh
|
||||||
|
|
||||||
mov dx, app_tls
|
mov dx, app_tls
|
||||||
mov fs, dx
|
mov fs, dx
|
||||||
@@ -141,16 +141,16 @@ do_change_task:
|
|||||||
Mov gs, ax
|
Mov gs, ax
|
||||||
; TS flag is not triggered by AVX* instructions, therefore
|
; TS flag is not triggered by AVX* instructions, therefore
|
||||||
; we have to xsave/xrstor SIMD registers each task change
|
; we have to xsave/xrstor SIMD registers each task change
|
||||||
bt [cpu_caps+(CAPS_OSXSAVE/32)*4], CAPS_OSXSAVE mod 32
|
bt [cpu_caps + (CAPS_OSXSAVE/32)*4], CAPS_OSXSAVE mod 32
|
||||||
jnc .no_xsave
|
jnc .no_xsave
|
||||||
mov ecx, [esi+APPDATA.fpu_state]
|
mov ecx, [esi + APPDATA.fpu_state]
|
||||||
mov eax, [xsave_eax]
|
mov eax, [xsave_eax]
|
||||||
mov edx, [xsave_edx]
|
mov edx, [xsave_edx]
|
||||||
xsave [ecx]
|
xsave [ecx]
|
||||||
mov ecx, [current_slot_idx]
|
mov ecx, [current_slot_idx]
|
||||||
mov [fpu_owner], ecx
|
mov [fpu_owner], ecx
|
||||||
mov ecx, [current_slot]
|
mov ecx, [current_slot]
|
||||||
mov ecx, [ecx+APPDATA.fpu_state]
|
mov ecx, [ecx + APPDATA.fpu_state]
|
||||||
xrstor [ecx]
|
xrstor [ecx]
|
||||||
.no_xsave:
|
.no_xsave:
|
||||||
; set CR0.TS
|
; set CR0.TS
|
||||||
@@ -163,11 +163,11 @@ do_change_task:
|
|||||||
@@: ; set context_counter (only for user pleasure ???)
|
@@: ; set context_counter (only for user pleasure ???)
|
||||||
inc [context_counter] ;noname & halyavin
|
inc [context_counter] ;noname & halyavin
|
||||||
; set debug-registers, if it's necessary
|
; set debug-registers, if it's necessary
|
||||||
test byte[ebx+APPDATA.dbg_state], 1
|
test byte[ebx + APPDATA.dbg_state], 1
|
||||||
jz @f
|
jz @f
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov dr6, eax
|
mov dr6, eax
|
||||||
lea esi, [ebx+APPDATA.dbg_regs]
|
lea esi, [ebx + APPDATA.dbg_regs]
|
||||||
cld
|
cld
|
||||||
macro lodsReg [reg] {
|
macro lodsReg [reg] {
|
||||||
lodsd
|
lodsd
|
||||||
@@ -199,26 +199,26 @@ proc scheduler_add_thread
|
|||||||
; 1. Acquire the lock.
|
; 1. Acquire the lock.
|
||||||
spin_lock_irqsave SchedulerLock
|
spin_lock_irqsave SchedulerLock
|
||||||
; 2. Store the priority in APPDATA structure.
|
; 2. Store the priority in APPDATA structure.
|
||||||
mov [edx+APPDATA.priority], ecx
|
mov [edx + APPDATA.priority], ecx
|
||||||
; 3. There are two different cases: the given list is empty or not empty.
|
; 3. There are two different cases: the given list is empty or not empty.
|
||||||
; In first case, go to 6. Otherwise, advance to 4.
|
; In first case, go to 6. Otherwise, advance to 4.
|
||||||
mov eax, [scheduler_current+ecx*4]
|
mov eax, [scheduler_current+ecx*4]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .new_list
|
jz .new_list
|
||||||
; 4. Insert the new item immediately before the current item.
|
; 4. Insert the new item immediately before the current item.
|
||||||
mov ecx, [eax+APPDATA.in_schedule.prev]
|
mov ecx, [eax + APPDATA.in_schedule.prev]
|
||||||
mov [edx+APPDATA.in_schedule.next], eax
|
mov [edx + APPDATA.in_schedule.next], eax
|
||||||
mov [edx+APPDATA.in_schedule.prev], ecx
|
mov [edx + APPDATA.in_schedule.prev], ecx
|
||||||
mov [eax+APPDATA.in_schedule.prev], edx
|
mov [eax + APPDATA.in_schedule.prev], edx
|
||||||
mov [ecx+APPDATA.in_schedule.next], edx
|
mov [ecx + APPDATA.in_schedule.next], edx
|
||||||
; 5. Release the lock and return.
|
; 5. Release the lock and return.
|
||||||
spin_unlock_irqrestore SchedulerLock
|
spin_unlock_irqrestore SchedulerLock
|
||||||
ret
|
ret
|
||||||
.new_list:
|
.new_list:
|
||||||
; 6. Initialize the list with one item and make it the current item.
|
; 6. Initialize the list with one item and make it the current item.
|
||||||
mov [edx+APPDATA.in_schedule.next], edx
|
mov [edx + APPDATA.in_schedule.next], edx
|
||||||
mov [edx+APPDATA.in_schedule.prev], edx
|
mov [edx + APPDATA.in_schedule.prev], edx
|
||||||
mov [scheduler_current+ecx*4], edx
|
mov [scheduler_current + ecx*4], edx
|
||||||
; 7. Release the lock and return.
|
; 7. Release the lock and return.
|
||||||
spin_unlock_irqrestore SchedulerLock
|
spin_unlock_irqrestore SchedulerLock
|
||||||
ret
|
ret
|
||||||
@@ -230,23 +230,23 @@ proc scheduler_remove_thread
|
|||||||
; 1. Acquire the lock.
|
; 1. Acquire the lock.
|
||||||
spin_lock_irqsave SchedulerLock
|
spin_lock_irqsave SchedulerLock
|
||||||
; 2. Remove the item from the corresponding list.
|
; 2. Remove the item from the corresponding list.
|
||||||
mov eax, [edx+APPDATA.in_schedule.next]
|
mov eax, [edx + APPDATA.in_schedule.next]
|
||||||
mov ecx, [edx+APPDATA.in_schedule.prev]
|
mov ecx, [edx + APPDATA.in_schedule.prev]
|
||||||
mov [eax+APPDATA.in_schedule.prev], ecx
|
mov [eax + APPDATA.in_schedule.prev], ecx
|
||||||
mov [ecx+APPDATA.in_schedule.next], eax
|
mov [ecx + APPDATA.in_schedule.next], eax
|
||||||
; 3. If the given thread is the current item in the list,
|
; 3. If the given thread is the current item in the list,
|
||||||
; advance the current item.
|
; advance the current item.
|
||||||
; 3a. Check whether the given thread is the current item;
|
; 3a. Check whether the given thread is the current item;
|
||||||
; if no, skip the rest of this step.
|
; if no, skip the rest of this step.
|
||||||
mov ecx, [edx+APPDATA.priority]
|
mov ecx, [edx + APPDATA.priority]
|
||||||
cmp [scheduler_current+ecx*4], edx
|
cmp [scheduler_current + ecx*4], edx
|
||||||
jnz .return
|
jnz .return
|
||||||
; 3b. Set the current item to eax; step 2 has set eax = next item.
|
; 3b. Set the current item to eax; step 2 has set eax = next item.
|
||||||
mov [scheduler_current+ecx*4], eax
|
mov [scheduler_current + ecx*4], eax
|
||||||
; 3c. If there were only one item in the list, zero the current item.
|
; 3c. If there were only one item in the list, zero the current item.
|
||||||
cmp eax, edx
|
cmp eax, edx
|
||||||
jnz .return
|
jnz .return
|
||||||
mov [scheduler_current+ecx*4], 0
|
mov [scheduler_current + ecx*4], 0
|
||||||
.return:
|
.return:
|
||||||
; 4. Release the lock and return.
|
; 4. Release the lock and return.
|
||||||
spin_unlock_irqrestore SchedulerLock
|
spin_unlock_irqrestore SchedulerLock
|
||||||
@@ -280,7 +280,7 @@ proc find_next_task
|
|||||||
test bl, bl
|
test bl, bl
|
||||||
jz .start
|
jz .start
|
||||||
mov ebx, [current_slot]
|
mov ebx, [current_slot]
|
||||||
mov eax, [ebx+APPDATA.priority]
|
mov eax, [ebx + APPDATA.priority]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .unlock_found
|
jz .unlock_found
|
||||||
mov [esp], eax
|
mov [esp], eax
|
||||||
@@ -291,28 +291,28 @@ proc find_next_task
|
|||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
jz .priority_next
|
jz .priority_next
|
||||||
.task_loop:
|
.task_loop:
|
||||||
mov ebx, [ebx+APPDATA.in_schedule.next]
|
mov ebx, [ebx + APPDATA.in_schedule.next]
|
||||||
mov al, [ebx+APPDATA.state]
|
mov al, [ebx + APPDATA.state]
|
||||||
test al, al
|
test al, al
|
||||||
jz .task_found ; state == 0
|
jz .task_found ; state == 0
|
||||||
cmp al, 5
|
cmp al, 5
|
||||||
jne .task_next ; state == 1,2,3,4,9
|
jne .task_next ; state == 1,2,3,4,9
|
||||||
; state == 5
|
; state == 5
|
||||||
pushad ; more freedom for [APPDATA.wait_test]
|
pushad ; more freedom for [APPDATA.wait_test]
|
||||||
call [ebx+APPDATA.wait_test]
|
call [ebx + APPDATA.wait_test]
|
||||||
mov [esp+28], eax
|
mov [esp + 28], eax
|
||||||
popad
|
popad
|
||||||
or eax, eax
|
or eax, eax
|
||||||
jnz @f
|
jnz @f
|
||||||
; testing for timeout
|
; testing for timeout
|
||||||
mov eax, [timer_ticks]
|
mov eax, [timer_ticks]
|
||||||
sub eax, [ebx+APPDATA.wait_begin]
|
sub eax, [ebx + APPDATA.wait_begin]
|
||||||
cmp eax, [ebx+APPDATA.wait_timeout]
|
cmp eax, [ebx + APPDATA.wait_timeout]
|
||||||
jb .task_next
|
jb .task_next
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
@@:
|
@@:
|
||||||
mov [ebx+APPDATA.wait_param], eax ; retval for wait
|
mov [ebx + APPDATA.wait_param], eax ; retval for wait
|
||||||
mov [ebx+APPDATA.state], TSTATE_RUNNING
|
mov [ebx + APPDATA.state], TSTATE_RUNNING
|
||||||
.task_found:
|
.task_found:
|
||||||
mov [scheduler_current+ecx*4], ebx
|
mov [scheduler_current+ecx*4], ebx
|
||||||
; If we have selected a thread with higher priority
|
; If we have selected a thread with higher priority
|
||||||
@@ -323,8 +323,8 @@ proc find_next_task
|
|||||||
cmp ecx, NR_SCHED_QUEUES
|
cmp ecx, NR_SCHED_QUEUES
|
||||||
jz .unlock_found
|
jz .unlock_found
|
||||||
mov eax, [current_slot]
|
mov eax, [current_slot]
|
||||||
mov eax, [eax+APPDATA.in_schedule.prev]
|
mov eax, [eax + APPDATA.in_schedule.prev]
|
||||||
mov [scheduler_current+ecx*4], eax
|
mov [scheduler_current + ecx*4], eax
|
||||||
.unlock_found:
|
.unlock_found:
|
||||||
pop ecx
|
pop ecx
|
||||||
spin_unlock_irqrestore SchedulerLock
|
spin_unlock_irqrestore SchedulerLock
|
||||||
@@ -334,7 +334,7 @@ proc find_next_task
|
|||||||
mov byte [current_slot_idx], bh
|
mov byte [current_slot_idx], bh
|
||||||
|
|
||||||
rdtsc ;call _rdtsc
|
rdtsc ;call _rdtsc
|
||||||
mov [ebx-sizeof.APPDATA+APPDATA.counter_add], eax; for next using update_counters
|
mov [ebx - sizeof.APPDATA + APPDATA.counter_add], eax; for next using update_counters
|
||||||
;mov [edi+TASKDATA.counter_add], eax; for next using update_counters
|
;mov [edi+TASKDATA.counter_add], eax; for next using update_counters
|
||||||
cmp ebx, [current_slot]
|
cmp ebx, [current_slot]
|
||||||
ret
|
ret
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2013-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2013-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; Author: Kees J. Bot 1 Jan 1994 ;;
|
;; Author: Kees J. Bot 1 Jan 1994 ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Synhronization for MenuetOS. ;;
|
;; Synhronization for MenuetOS. ;;
|
||||||
@@ -18,9 +18,9 @@ RWSEM_WAITING_FOR_READ = 1
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
mutex_init:
|
mutex_init:
|
||||||
mov [ecx+MUTEX.wait_list.next], ecx
|
mov [ecx + MUTEX.wait_list.next], ecx
|
||||||
mov [ecx+MUTEX.wait_list.prev], ecx
|
mov [ecx + MUTEX.wait_list.prev], ecx
|
||||||
mov [ecx+MUTEX.count], 1
|
mov [ecx + MUTEX.count], 1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;void __fastcall mutex_lock(struct mutex *lock)
|
;void __fastcall mutex_lock(struct mutex *lock)
|
||||||
@@ -28,7 +28,7 @@ mutex_init:
|
|||||||
align 4
|
align 4
|
||||||
mutex_lock:
|
mutex_lock:
|
||||||
|
|
||||||
dec [ecx+MUTEX.count]
|
dec [ecx + MUTEX.count]
|
||||||
jns .done
|
jns .done
|
||||||
|
|
||||||
pushfd
|
pushfd
|
||||||
@@ -39,12 +39,12 @@ mutex_lock:
|
|||||||
list_add_tail esp, ecx ;esp= new waiter, ecx= list head
|
list_add_tail esp, ecx ;esp= new waiter, ecx= list head
|
||||||
|
|
||||||
mov edx, [current_slot]
|
mov edx, [current_slot]
|
||||||
mov [esp+MUTEX_WAITER.task], edx
|
mov [esp + MUTEX_WAITER.task], edx
|
||||||
|
|
||||||
.forever:
|
.forever:
|
||||||
|
|
||||||
mov eax, -1
|
mov eax, -1
|
||||||
xchg eax, [ecx+MUTEX.count]
|
xchg eax, [ecx + MUTEX.count]
|
||||||
dec eax
|
dec eax
|
||||||
jz @F
|
jz @F
|
||||||
|
|
||||||
@@ -55,10 +55,10 @@ mutex_lock:
|
|||||||
mov eax, ecx
|
mov eax, ecx
|
||||||
list_del esp
|
list_del esp
|
||||||
|
|
||||||
cmp [eax+MUTEX.wait_list.next], eax
|
cmp [eax + MUTEX.wait_list.next], eax
|
||||||
jne @F
|
jne @F
|
||||||
|
|
||||||
mov [eax+MUTEX.count], 0
|
mov [eax + MUTEX.count], 0
|
||||||
@@:
|
@@:
|
||||||
add esp, sizeof.MUTEX_WAITER
|
add esp, sizeof.MUTEX_WAITER
|
||||||
|
|
||||||
@@ -74,12 +74,12 @@ mutex_unlock:
|
|||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
|
|
||||||
mov eax, [ecx+MUTEX.wait_list.next]
|
mov eax, [ecx + MUTEX.wait_list.next]
|
||||||
cmp eax, ecx
|
cmp eax, ecx
|
||||||
mov [ecx+MUTEX.count], 1
|
mov [ecx + MUTEX.count], 1
|
||||||
je @F
|
je @F
|
||||||
|
|
||||||
mov eax, [eax+MUTEX_WAITER.task]
|
mov eax, [eax + MUTEX_WAITER.task]
|
||||||
mov [eax + APPDATA.state], TSTATE_RUNNING
|
mov [eax + APPDATA.state], TSTATE_RUNNING
|
||||||
@@:
|
@@:
|
||||||
popfd
|
popfd
|
||||||
@@ -90,9 +90,9 @@ mutex_unlock:
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
init_rwsem:
|
init_rwsem:
|
||||||
mov [ecx+RWSEM.wait_list.next], ecx
|
mov [ecx + RWSEM.wait_list.next], ecx
|
||||||
mov [ecx+RWSEM.wait_list.prev], ecx
|
mov [ecx + RWSEM.wait_list.prev], ecx
|
||||||
mov [ecx+RWSEM.count], 0
|
mov [ecx + RWSEM.count], 0
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;void __fastcall down_read(struct rw_semaphore *sem)
|
;void __fastcall down_read(struct rw_semaphore *sem)
|
||||||
@@ -102,18 +102,18 @@ down_read:
|
|||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
|
|
||||||
mov eax, [ecx+RWSEM.count]
|
mov eax, [ecx + RWSEM.count]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
js @F
|
js @F
|
||||||
|
|
||||||
cmp ecx, [ecx+RWSEM.wait_list.next]
|
cmp ecx, [ecx + RWSEM.wait_list.next]
|
||||||
je .ok
|
je .ok
|
||||||
@@:
|
@@:
|
||||||
sub esp, sizeof.MUTEX_WAITER
|
sub esp, sizeof.MUTEX_WAITER
|
||||||
|
|
||||||
mov eax, [current_slot]
|
mov eax, [current_slot]
|
||||||
mov [esp+MUTEX_WAITER.task], eax
|
mov [esp + MUTEX_WAITER.task], eax
|
||||||
mov [esp+MUTEX_WAITER.type], RWSEM_WAITING_FOR_READ
|
mov [esp + MUTEX_WAITER.type], RWSEM_WAITING_FOR_READ
|
||||||
mov [eax + APPDATA.state], TSTATE_RUN_SUSPENDED
|
mov [eax + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||||
|
|
||||||
list_add_tail esp, ecx ;esp= new waiter, ecx= list head
|
list_add_tail esp, ecx ;esp= new waiter, ecx= list head
|
||||||
@@ -125,7 +125,7 @@ down_read:
|
|||||||
ret
|
ret
|
||||||
.ok:
|
.ok:
|
||||||
inc eax
|
inc eax
|
||||||
mov [ecx+RWSEM.count], eax
|
mov [ecx + RWSEM.count], eax
|
||||||
|
|
||||||
popfd
|
popfd
|
||||||
ret
|
ret
|
||||||
@@ -139,8 +139,8 @@ down_write:
|
|||||||
sub esp, sizeof.MUTEX_WAITER
|
sub esp, sizeof.MUTEX_WAITER
|
||||||
|
|
||||||
mov edx, [current_slot]
|
mov edx, [current_slot]
|
||||||
mov [esp+MUTEX_WAITER.task], edx
|
mov [esp + MUTEX_WAITER.task], edx
|
||||||
mov [esp+MUTEX_WAITER.type], RWSEM_WAITING_FOR_WRITE
|
mov [esp + MUTEX_WAITER.type], RWSEM_WAITING_FOR_WRITE
|
||||||
mov [edx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
mov [edx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||||
|
|
||||||
list_add_tail esp, ecx ;esp= new waiter, ecx= list head
|
list_add_tail esp, ecx ;esp= new waiter, ecx= list head
|
||||||
@@ -149,14 +149,14 @@ down_write:
|
|||||||
not eax
|
not eax
|
||||||
|
|
||||||
.forever:
|
.forever:
|
||||||
test eax, [ecx+RWSEM.count]
|
test eax, [ecx + RWSEM.count]
|
||||||
jz @F
|
jz @F
|
||||||
|
|
||||||
mov [edx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
mov [edx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||||
call change_task
|
call change_task
|
||||||
jmp .forever
|
jmp .forever
|
||||||
@@:
|
@@:
|
||||||
mov [ecx+RWSEM.count], eax
|
mov [ecx + RWSEM.count], eax
|
||||||
list_del esp
|
list_del esp
|
||||||
|
|
||||||
add esp, sizeof.MUTEX_WAITER
|
add esp, sizeof.MUTEX_WAITER
|
||||||
@@ -170,14 +170,14 @@ up_read:
|
|||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
|
|
||||||
dec [ecx+RWSEM.count]
|
dec [ecx + RWSEM.count]
|
||||||
jnz @F
|
jnz @F
|
||||||
|
|
||||||
mov eax, [ecx+RWSEM.wait_list.next]
|
mov eax, [ecx + RWSEM.wait_list.next]
|
||||||
cmp eax, ecx
|
cmp eax, ecx
|
||||||
je @F
|
je @F
|
||||||
|
|
||||||
mov eax, [eax+MUTEX_WAITER.task]
|
mov eax, [eax + MUTEX_WAITER.task]
|
||||||
mov [eax + APPDATA.state], TSTATE_RUNNING
|
mov [eax + APPDATA.state], TSTATE_RUNNING
|
||||||
@@:
|
@@:
|
||||||
popfd
|
popfd
|
||||||
@@ -191,17 +191,17 @@ up_write:
|
|||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
|
|
||||||
mov eax, [ecx+RWSEM.wait_list.next]
|
mov eax, [ecx + RWSEM.wait_list.next]
|
||||||
mov [ecx+RWSEM.count], 0
|
mov [ecx + RWSEM.count], 0
|
||||||
|
|
||||||
cmp ecx, eax
|
cmp ecx, eax
|
||||||
je .done
|
je .done
|
||||||
|
|
||||||
mov edx, [eax+MUTEX_WAITER.type]
|
mov edx, [eax + MUTEX_WAITER.type]
|
||||||
test edx, edx
|
test edx, edx
|
||||||
jnz .wake
|
jnz .wake
|
||||||
|
|
||||||
mov eax, [eax+MUTEX_WAITER.task]
|
mov eax, [eax + MUTEX_WAITER.task]
|
||||||
mov [eax + APPDATA.state], TSTATE_RUNNING
|
mov [eax + APPDATA.state], TSTATE_RUNNING
|
||||||
.done:
|
.done:
|
||||||
popfd
|
popfd
|
||||||
@@ -217,15 +217,15 @@ up_write:
|
|||||||
|
|
||||||
.wake_list:
|
.wake_list:
|
||||||
|
|
||||||
mov ebx, [eax+MUTEX_WAITER.list.next]
|
mov ebx, [eax + MUTEX_WAITER.list.next]
|
||||||
list_del eax
|
list_del eax
|
||||||
mov edx, [eax+MUTEX_WAITER.task]
|
mov edx, [eax + MUTEX_WAITER.task]
|
||||||
mov [edx + APPDATA.state], TSTATE_RUNNING
|
mov [edx + APPDATA.state], TSTATE_RUNNING
|
||||||
inc esi
|
inc esi
|
||||||
cmp edi, ebx
|
cmp edi, ebx
|
||||||
je .wake_done
|
je .wake_done
|
||||||
|
|
||||||
mov ecx, [ebx+MUTEX_WAITER.type]
|
mov ecx, [ebx + MUTEX_WAITER.type]
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz .wake_done
|
jz .wake_done
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ up_write:
|
|||||||
jmp .wake_list
|
jmp .wake_list
|
||||||
|
|
||||||
.wake_done:
|
.wake_done:
|
||||||
add [edi+RWSEM.count], esi
|
add [edi + RWSEM.count], esi
|
||||||
|
|
||||||
pop edi
|
pop edi
|
||||||
pop esi
|
pop esi
|
||||||
@@ -270,8 +270,8 @@ start_wait=$
|
|||||||
jmp start_wait
|
jmp start_wait
|
||||||
ok=$
|
ok=$
|
||||||
push eax
|
push eax
|
||||||
mov eax, dword [TASK_BASE+second_base_address]
|
mov eax, dword [current_slot]
|
||||||
mov eax, [eax+TASKDATA.pid]
|
mov eax, [eax + APPDATA.tid]
|
||||||
mov [name], eax
|
mov [name], eax
|
||||||
pop eax
|
pop eax
|
||||||
sti
|
sti
|
||||||
@@ -304,8 +304,8 @@ macro WaitSimpleCriticalSection name
|
|||||||
{
|
{
|
||||||
local start_wait,first_wait,inc_counter,end_wait
|
local start_wait,first_wait,inc_counter,end_wait
|
||||||
push eax
|
push eax
|
||||||
mov eax, [TASK_BASE+second_base_address]
|
mov eax, [current_slot]
|
||||||
mov eax, [eax+TASKDATA.pid]
|
mov eax, [eax + APPDATA.tid]
|
||||||
start_wait=$
|
start_wait=$
|
||||||
cli
|
cli
|
||||||
cmp [name], dword 0
|
cmp [name], dword 0
|
||||||
@@ -317,10 +317,10 @@ start_wait=$
|
|||||||
jmp start_wait
|
jmp start_wait
|
||||||
first_wait=$
|
first_wait=$
|
||||||
mov [name], eax
|
mov [name], eax
|
||||||
mov [name+4], dword 1
|
mov [name + 4], dword 1
|
||||||
jmp end_wait
|
jmp end_wait
|
||||||
inc_counter=$
|
inc_counter=$
|
||||||
inc dword [name+4]
|
inc dword [name + 4]
|
||||||
end_wait=$
|
end_wait=$
|
||||||
sti
|
sti
|
||||||
pop eax
|
pop eax
|
||||||
@@ -328,7 +328,7 @@ end_wait=$
|
|||||||
macro ReleaseSimpleCriticalSection name
|
macro ReleaseSimpleCriticalSection name
|
||||||
{
|
{
|
||||||
local release_end
|
local release_end
|
||||||
dec dword [name+4]
|
dec dword [name + 4]
|
||||||
jnz release_end
|
jnz release_end
|
||||||
mov [name], dword 0
|
mov [name], dword 0
|
||||||
release_end=$
|
release_end=$
|
||||||
@@ -336,8 +336,8 @@ release_end=$
|
|||||||
macro TryWaitSimpleCriticalSection name ;result in eax and in flags
|
macro TryWaitSimpleCriticalSection name ;result in eax and in flags
|
||||||
{
|
{
|
||||||
local ok,try_end
|
local ok,try_end
|
||||||
mov eax, [CURRENT_TASK+second_base_address]
|
mov eax, [current_slot]
|
||||||
mov eax, [eax+TASKDATA.pid]
|
mov eax, [eax + APPDATA.tid]
|
||||||
cmp [name], eax
|
cmp [name], eax
|
||||||
jz ok
|
jz ok
|
||||||
cmp [name], 0
|
cmp [name], 0
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2013-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2013-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License. ;;
|
;; Distributed under terms of the GNU General Public License. ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -139,14 +139,14 @@ exc_c: ; exceptions (all but 7th - #NM)
|
|||||||
call page_fault_handler ; SEE: core/memory.inc
|
call page_fault_handler ; SEE: core/memory.inc
|
||||||
@@:
|
@@:
|
||||||
mov esi, [current_slot]
|
mov esi, [current_slot]
|
||||||
btr [esi+APPDATA.except_mask], ebx
|
btr [esi + APPDATA.except_mask], ebx
|
||||||
jnc @f
|
jnc @f
|
||||||
mov eax, [esi+APPDATA.exc_handler]
|
mov eax, [esi + APPDATA.exc_handler]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz IRetToUserHook
|
jnz IRetToUserHook
|
||||||
@@:
|
@@:
|
||||||
cli
|
cli
|
||||||
mov eax, [esi+APPDATA.debugger_slot]
|
mov eax, [esi + APPDATA.debugger_slot]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .debug
|
jnz .debug
|
||||||
; not debuggee => say error and terminate
|
; not debuggee => say error and terminate
|
||||||
@@ -288,27 +288,6 @@ show_error_parameters:
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .error_ESP
|
jnz .error_ESP
|
||||||
DEBUGF 1, " [ESP+32]: %x\n",[ebx]
|
DEBUGF 1, " [ESP+32]: %x\n",[ebx]
|
||||||
;for input instruction
|
|
||||||
mov ebx, [reg_eip+4]
|
|
||||||
call .check_ESP
|
|
||||||
test eax, eax
|
|
||||||
jnz .error_ESP
|
|
||||||
DEBUGF 1, "K : [EIP]: %x",[ebx]
|
|
||||||
add ebx, 4
|
|
||||||
call .check_ESP
|
|
||||||
test eax, eax
|
|
||||||
jnz .error_ESP
|
|
||||||
DEBUGF 1, " [EIP+4]: %x",[ebx]
|
|
||||||
add ebx, 4
|
|
||||||
call .check_ESP
|
|
||||||
test eax, eax
|
|
||||||
jnz .error_ESP
|
|
||||||
DEBUGF 1, " [EIP+8]: %x\n",[ebx]
|
|
||||||
add ebx, 4
|
|
||||||
call .check_ESP
|
|
||||||
test eax, eax
|
|
||||||
jnz .error_ESP
|
|
||||||
DEBUGF 1, "K : [EIP+12]: %x\n",[ebx]
|
|
||||||
pop edx ecx ebx eax
|
pop edx ecx ebx eax
|
||||||
ret
|
ret
|
||||||
.error_ESP:
|
.error_ESP:
|
||||||
@@ -322,12 +301,12 @@ show_error_parameters:
|
|||||||
shr ebx, 12
|
shr ebx, 12
|
||||||
mov ecx, ebx
|
mov ecx, ebx
|
||||||
shr ecx, 10
|
shr ecx, 10
|
||||||
mov edx, [master_tab+ecx*4]
|
mov edx, [master_tab + ecx*4]
|
||||||
test edx, PG_READ
|
test edx, PG_READ
|
||||||
jz .fail ; page table is not created
|
jz .fail ; page table is not created
|
||||||
; incorrect address in the program
|
; incorrect address in the program
|
||||||
|
|
||||||
mov eax, [page_tabs+ebx*4]
|
mov eax, [page_tabs + ebx*4]
|
||||||
test eax, 2
|
test eax, 2
|
||||||
jz .fail ; address not reserved for use. error
|
jz .fail ; address not reserved for use. error
|
||||||
|
|
||||||
@@ -434,7 +413,7 @@ destroy_thread:
|
|||||||
push esi ;save .slot
|
push esi ;save .slot
|
||||||
|
|
||||||
shl esi, BSF sizeof.APPDATA
|
shl esi, BSF sizeof.APPDATA
|
||||||
mov edx, [SLOT_BASE+esi+APPDATA.process]
|
mov edx, [SLOT_BASE + esi + APPDATA.process]
|
||||||
test edx, edx
|
test edx, edx
|
||||||
jnz @F
|
jnz @F
|
||||||
mov [SLOT_BASE + esi + APPDATA.state], TSTATE_FREE
|
mov [SLOT_BASE + esi + APPDATA.state], TSTATE_FREE
|
||||||
@@ -442,33 +421,33 @@ destroy_thread:
|
|||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
push edx ;save .process
|
push edx ;save .process
|
||||||
lea edx, [SLOT_BASE+esi]
|
lea edx, [SLOT_BASE + esi]
|
||||||
call scheduler_remove_thread
|
call scheduler_remove_thread
|
||||||
call lock_application_table
|
call lock_application_table
|
||||||
|
|
||||||
; if the process is in V86 mode...
|
; if the process is in V86 mode...
|
||||||
mov eax, [.slot]
|
mov eax, [.slot]
|
||||||
shl eax, BSF sizeof.APPDATA
|
shl eax, BSF sizeof.APPDATA
|
||||||
mov esi, [eax+SLOT_BASE+APPDATA.pl0_stack]
|
mov esi, [SLOT_BASE + eax + APPDATA.pl0_stack]
|
||||||
add esi, RING0_STACK_SIZE
|
add esi, RING0_STACK_SIZE
|
||||||
cmp [eax+SLOT_BASE+APPDATA.saved_esp0], esi
|
cmp [SLOT_BASE + eax + APPDATA.saved_esp0], esi
|
||||||
jz .nov86
|
jz .nov86
|
||||||
; ...it has page directory for V86 mode
|
; ...it has page directory for V86 mode
|
||||||
mov esi, [eax+SLOT_BASE+APPDATA.saved_esp0]
|
mov esi, [SLOT_BASE + eax + APPDATA.saved_esp0]
|
||||||
mov ecx, [esi+4]
|
mov ecx, [esi+4]
|
||||||
mov [eax+SLOT_BASE+APPDATA.process], ecx
|
mov [SLOT_BASE + eax + APPDATA.process], ecx
|
||||||
; ...and I/O permission map for V86 mode
|
; ...and I/O permission map for V86 mode
|
||||||
mov ecx, [esi+12]
|
mov ecx, [esi+12]
|
||||||
mov [eax+SLOT_BASE+APPDATA.io_map], ecx
|
mov [SLOT_BASE + eax + APPDATA.io_map], ecx
|
||||||
mov ecx, [esi+8]
|
mov ecx, [esi+8]
|
||||||
mov [eax+SLOT_BASE+APPDATA.io_map+4], ecx
|
mov [SLOT_BASE + eax + APPDATA.io_map+4], ecx
|
||||||
.nov86:
|
.nov86:
|
||||||
; destroy per-thread kernel objects
|
; destroy per-thread kernel objects
|
||||||
mov esi, [.slot]
|
mov esi, [.slot]
|
||||||
shl esi, BSF sizeof.APPDATA
|
shl esi, BSF sizeof.APPDATA
|
||||||
add esi, SLOT_BASE+APP_OBJ_OFFSET
|
add esi, SLOT_BASE + APP_OBJ_OFFSET
|
||||||
@@:
|
@@:
|
||||||
mov eax, [esi+APPOBJ.fd]
|
mov eax, [esi + APPOBJ.fd]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @F
|
jz @F
|
||||||
|
|
||||||
@@ -476,7 +455,7 @@ destroy_thread:
|
|||||||
je @F
|
je @F
|
||||||
|
|
||||||
push esi
|
push esi
|
||||||
call [eax+APPOBJ.destroy]
|
call [eax + APPOBJ.destroy]
|
||||||
DEBUGF 1,"%s",msg_obj_destroy
|
DEBUGF 1,"%s",msg_obj_destroy
|
||||||
pop esi
|
pop esi
|
||||||
jmp @B
|
jmp @B
|
||||||
@@ -486,7 +465,7 @@ destroy_thread:
|
|||||||
jne @F
|
jne @F
|
||||||
|
|
||||||
mov [fpu_owner], 2
|
mov [fpu_owner], 2
|
||||||
mov eax, [sizeof.APPDATA*2+SLOT_BASE+APPDATA.fpu_state]
|
mov eax, [SLOT_BASE + sizeof.APPDATA*2 + APPDATA.fpu_state]
|
||||||
clts
|
clts
|
||||||
bt [cpu_caps], CAPS_SSE
|
bt [cpu_caps], CAPS_SSE
|
||||||
jnc .no_SSE
|
jnc .no_SSE
|
||||||
@@ -575,13 +554,13 @@ destroy_thread:
|
|||||||
cld
|
cld
|
||||||
shl esi, BSF sizeof.WDATA
|
shl esi, BSF sizeof.WDATA
|
||||||
add esi, window_data
|
add esi, window_data
|
||||||
mov eax, [esi+WDATA.box.left]
|
mov eax, [esi + WDATA.box.left]
|
||||||
mov [draw_limits.left], eax
|
mov [draw_limits.left], eax
|
||||||
add eax, [esi+WDATA.box.width]
|
add eax, [esi + WDATA.box.width]
|
||||||
mov [draw_limits.right], eax
|
mov [draw_limits.right], eax
|
||||||
mov eax, [esi+WDATA.box.top]
|
mov eax, [esi + WDATA.box.top]
|
||||||
mov [draw_limits.top], eax
|
mov [draw_limits.top], eax
|
||||||
add eax, [esi+WDATA.box.height]
|
add eax, [esi + WDATA.box.height]
|
||||||
mov [draw_limits.bottom], eax
|
mov [draw_limits.bottom], eax
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
@@ -589,7 +568,7 @@ destroy_thread:
|
|||||||
mov ecx, sizeof.WDATA/4
|
mov ecx, sizeof.WDATA/4
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
lea edi, [esi-window_data+draw_data]
|
lea edi, [esi - window_data + draw_data]
|
||||||
mov ecx, sizeof.WDATA/4
|
mov ecx, sizeof.WDATA/4
|
||||||
rep stosd
|
rep stosd
|
||||||
popa
|
popa
|
||||||
@@ -613,20 +592,20 @@ destroy_thread:
|
|||||||
mov ebx, [.slot]
|
mov ebx, [.slot]
|
||||||
shl ebx, BSF sizeof.APPDATA
|
shl ebx, BSF sizeof.APPDATA
|
||||||
push ebx
|
push ebx
|
||||||
mov ebx, [SLOT_BASE+ebx+APPDATA.pl0_stack]
|
mov ebx, [SLOT_BASE + ebx + APPDATA.pl0_stack]
|
||||||
|
|
||||||
stdcall kernel_free, ebx
|
stdcall kernel_free, ebx
|
||||||
|
|
||||||
pop ebx
|
pop ebx
|
||||||
mov ebx, [SLOT_BASE+ebx+APPDATA.cur_dir]
|
mov ebx, [SLOT_BASE + ebx + APPDATA.cur_dir]
|
||||||
stdcall kernel_free, ebx
|
stdcall kernel_free, ebx
|
||||||
|
|
||||||
mov edi, [.slot]
|
mov edi, [.slot]
|
||||||
shl edi, BSF sizeof.APPDATA
|
shl edi, BSF sizeof.APPDATA
|
||||||
add edi, SLOT_BASE
|
add edi, SLOT_BASE
|
||||||
|
|
||||||
mov eax, [edi+APPDATA.io_map]
|
mov eax, [edi + APPDATA.io_map]
|
||||||
cmp eax, [SLOT_BASE+sizeof.APPDATA+APPDATA.io_map]
|
cmp eax, [SLOT_BASE + sizeof.APPDATA+APPDATA.io_map]
|
||||||
je @F
|
je @F
|
||||||
call free_page
|
call free_page
|
||||||
@@:
|
@@:
|
||||||
@@ -635,7 +614,7 @@ destroy_thread:
|
|||||||
je @F
|
je @F
|
||||||
call free_page
|
call free_page
|
||||||
@@:
|
@@:
|
||||||
lea ebx, [edi+APPDATA.list]
|
lea ebx, [edi + APPDATA.list]
|
||||||
list_del ebx ;destroys edx, ecx
|
list_del ebx ;destroys edx, ecx
|
||||||
|
|
||||||
mov eax, 0x20202020
|
mov eax, 0x20202020
|
||||||
@@ -655,7 +634,7 @@ destroy_thread:
|
|||||||
dec eax
|
dec eax
|
||||||
cmp eax, 1
|
cmp eax, 1
|
||||||
jbe .nothing_to_activate
|
jbe .nothing_to_activate
|
||||||
lea esi, [WIN_POS+eax*2]
|
lea esi, [WIN_POS + eax*2]
|
||||||
movzx edi, word [esi] ; edi = process
|
movzx edi, word [esi] ; edi = process
|
||||||
shl edi, BSF sizeof.APPDATA
|
shl edi, BSF sizeof.APPDATA
|
||||||
cmp [SLOT_BASE + edi + APPDATA.state], TSTATE_FREE ; skip free slots
|
cmp [SLOT_BASE + edi + APPDATA.state], TSTATE_FREE ; skip free slots
|
||||||
@@ -674,7 +653,7 @@ destroy_thread:
|
|||||||
|
|
||||||
push esi ; remove hd1 & cd & flp reservation
|
push esi ; remove hd1 & cd & flp reservation
|
||||||
shl esi, BSF sizeof.APPDATA
|
shl esi, BSF sizeof.APPDATA
|
||||||
mov esi, [esi + SLOT_BASE + APPDATA.tid]
|
mov esi, [SLOT_BASE + esi + APPDATA.tid]
|
||||||
cmp [cd_status], esi
|
cmp [cd_status], esi
|
||||||
jnz @f
|
jnz @f
|
||||||
call free_cd_channel
|
call free_cd_channel
|
||||||
@@ -690,7 +669,7 @@ destroy_thread:
|
|||||||
pusha ; remove all port reservations
|
pusha ; remove all port reservations
|
||||||
mov edx, esi
|
mov edx, esi
|
||||||
shl edx, BSF sizeof.APPDATA
|
shl edx, BSF sizeof.APPDATA
|
||||||
mov edx, [edx + SLOT_BASE + APPDATA.tid]
|
mov edx, [SLOT_BASE + edx + APPDATA.tid]
|
||||||
|
|
||||||
rmpr0:
|
rmpr0:
|
||||||
|
|
||||||
@@ -733,10 +712,10 @@ destroy_thread:
|
|||||||
popa
|
popa
|
||||||
mov edi, esi ; do not run this process slot
|
mov edi, esi ; do not run this process slot
|
||||||
shl edi, BSF sizeof.APPDATA
|
shl edi, BSF sizeof.APPDATA
|
||||||
mov [edi + SLOT_BASE + APPDATA.state], TSTATE_FREE
|
mov [SLOT_BASE + edi + APPDATA.state], TSTATE_FREE
|
||||||
; debugger test - terminate all debuggees
|
; debugger test - terminate all debuggees
|
||||||
mov eax, 2
|
mov eax, 2
|
||||||
mov ecx, SLOT_BASE+2*sizeof.APPDATA + APPDATA.debugger_slot
|
mov ecx, SLOT_BASE + 2*sizeof.APPDATA + APPDATA.debugger_slot
|
||||||
.xd0:
|
.xd0:
|
||||||
cmp eax, [thread_count]
|
cmp eax, [thread_count]
|
||||||
ja .xd1
|
ja .xd1
|
||||||
@@ -758,8 +737,8 @@ destroy_thread:
|
|||||||
bts [thr_slot_map], esi
|
bts [thr_slot_map], esi
|
||||||
|
|
||||||
mov ecx, [.process]
|
mov ecx, [.process]
|
||||||
lea eax, [ecx+PROC.thr_list]
|
lea eax, [ecx + PROC.thr_list]
|
||||||
cmp eax, [eax+LHEAD.next]
|
cmp eax, [eax + LHEAD.next]
|
||||||
jne @F
|
jne @F
|
||||||
|
|
||||||
call destroy_process.internal
|
call destroy_process.internal
|
||||||
@@ -812,7 +791,7 @@ proc protect_from_terminate
|
|||||||
mov edx, [current_slot]
|
mov edx, [current_slot]
|
||||||
; Atomically increment depth of critical areas and get the old value.
|
; Atomically increment depth of critical areas and get the old value.
|
||||||
mov eax, 1
|
mov eax, 1
|
||||||
lock xadd [edx+APPDATA.terminate_protection], eax
|
lock xadd [edx + APPDATA.terminate_protection], eax
|
||||||
; If the old value was zero, somebody has started to terminate us,
|
; If the old value was zero, somebody has started to terminate us,
|
||||||
; so we are destructing and cannot do anything protected.
|
; so we are destructing and cannot do anything protected.
|
||||||
; Otherwise, return to the caller.
|
; Otherwise, return to the caller.
|
||||||
@@ -829,7 +808,7 @@ endp
|
|||||||
proc unprotect_from_terminate
|
proc unprotect_from_terminate
|
||||||
mov edx, [current_slot]
|
mov edx, [current_slot]
|
||||||
; Atomically decrement depth of critical areas.
|
; Atomically decrement depth of critical areas.
|
||||||
lock dec [edx+APPDATA.terminate_protection]
|
lock dec [edx + APPDATA.terminate_protection]
|
||||||
; If the result of decrement is zero, somebody has requested termination,
|
; If the result of decrement is zero, somebody has requested termination,
|
||||||
; but at that moment we were inside a critical area; terminate now.
|
; but at that moment we were inside a critical area; terminate now.
|
||||||
jz sys_end
|
jz sys_end
|
||||||
@@ -843,10 +822,10 @@ proc request_terminate
|
|||||||
xor eax, eax ; set return value
|
xor eax, eax ; set return value
|
||||||
; Atomically clear the upper bit. If it was already zero, then
|
; Atomically clear the upper bit. If it was already zero, then
|
||||||
; somebody has requested termination before us, so just exit.
|
; somebody has requested termination before us, so just exit.
|
||||||
lock btr [edx+APPDATA.terminate_protection], 31
|
lock btr [edx + APPDATA.terminate_protection], 31
|
||||||
jnc .unsafe
|
jnc .unsafe
|
||||||
; Atomically decrement depth of critical areas.
|
; Atomically decrement depth of critical areas.
|
||||||
lock dec [edx+APPDATA.terminate_protection]
|
lock dec [edx + APPDATA.terminate_protection]
|
||||||
; If the result of decrement is nonzero, the target thread is inside a
|
; If the result of decrement is nonzero, the target thread is inside a
|
||||||
; critical area; leave termination to leaving that area.
|
; critical area; leave termination to leaving that area.
|
||||||
jnz .unsafe
|
jnz .unsafe
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License. ;;
|
;; Distributed under terms of the GNU General Public License. ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -127,8 +127,8 @@ proc fs_execute
|
|||||||
jz .err_0
|
jz .err_0
|
||||||
|
|
||||||
mov [slot], eax
|
mov [slot], eax
|
||||||
shl eax, 8
|
shl eax, BSF sizeof.APPDATA
|
||||||
lea edi, [SLOT_BASE+eax]
|
lea edi, [SLOT_BASE + eax]
|
||||||
mov [slot_base], edi
|
mov [slot_base], edi
|
||||||
; clean extended information about process
|
; clean extended information about process
|
||||||
mov ecx, sizeof.APPDATA/4
|
mov ecx, sizeof.APPDATA/4
|
||||||
@@ -169,26 +169,26 @@ proc fs_execute
|
|||||||
jz .err_hdr
|
jz .err_hdr
|
||||||
|
|
||||||
; add new process to the list
|
; add new process to the list
|
||||||
mov ebx, [sys_proc+LHEAD.prev]
|
mov ebx, [sys_proc + LHEAD.prev]
|
||||||
__list_add eax, ebx, sys_proc
|
__list_add eax, ebx, sys_proc
|
||||||
; fill the structure fields:
|
; fill the structure fields:
|
||||||
mov ebx, [hdr_emem]
|
mov ebx, [hdr_emem]
|
||||||
mov [eax+PROC.mem_used], ebx
|
mov [eax + PROC.mem_used], ebx
|
||||||
|
|
||||||
; write that main thread of app belongs to new process
|
; write that main thread of app belongs to new process
|
||||||
mov ebx, [slot_base]
|
mov ebx, [slot_base]
|
||||||
mov [ebx+APPDATA.process], eax
|
mov [ebx + APPDATA.process], eax
|
||||||
|
|
||||||
; initialize the thread list of process: at this moment it consists only of one main thread
|
; initialize the thread list of process: at this moment it consists only of one main thread
|
||||||
lea edx, [ebx+APPDATA.list]
|
lea edx, [ebx + APPDATA.list]
|
||||||
lea ecx, [eax+PROC.thr_list]
|
lea ecx, [eax + PROC.thr_list]
|
||||||
list_add_tail edx, ecx
|
list_add_tail edx, ecx
|
||||||
|
|
||||||
; allocate space and copy app header data locals and cmdline string there, put pointer to exec_params of new thread
|
; allocate space and copy app header data locals and cmdline string there, put pointer to exec_params of new thread
|
||||||
mov eax, [cmdline_size]
|
mov eax, [cmdline_size]
|
||||||
add eax, sizeof.APP_HDR
|
add eax, sizeof.APP_HDR
|
||||||
stdcall kernel_alloc, eax
|
stdcall kernel_alloc, eax
|
||||||
mov [ebx+APPDATA.exec_params], eax
|
mov [ebx + APPDATA.exec_params], eax
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
lea esi, [hdr_cmdline]
|
lea esi, [hdr_cmdline]
|
||||||
mov ecx, sizeof.APP_HDR/4
|
mov ecx, sizeof.APP_HDR/4
|
||||||
@@ -231,17 +231,17 @@ test_app_header:
|
|||||||
jne .check_01_header
|
jne .check_01_header
|
||||||
|
|
||||||
mov ecx, [APP_HEADER_00.start]
|
mov ecx, [APP_HEADER_00.start]
|
||||||
mov [ebx+APP_HDR.eip], ecx
|
mov [ebx + APP_HDR.eip], ecx
|
||||||
mov edx, [APP_HEADER_00.mem_size]
|
mov edx, [APP_HEADER_00.mem_size]
|
||||||
mov [ebx+APP_HDR._emem], edx
|
mov [ebx + APP_HDR._emem], edx
|
||||||
shr edx, 1
|
shr edx, 1
|
||||||
sub edx, 0x10
|
sub edx, 0x10
|
||||||
mov [ebx+APP_HDR.esp], edx
|
mov [ebx + APP_HDR.esp], edx
|
||||||
mov ecx, [APP_HEADER_00.i_param]
|
mov ecx, [APP_HEADER_00.i_param]
|
||||||
mov [ebx+APP_HDR.cmdline], ecx
|
mov [ebx + APP_HDR.cmdline], ecx
|
||||||
mov [ebx+APP_HDR.path], 0
|
mov [ebx + APP_HDR.path], 0
|
||||||
mov edx, [APP_HEADER_00.i_end]
|
mov edx, [APP_HEADER_00.i_end]
|
||||||
mov [ebx+APP_HDR._edata], edx
|
mov [ebx + APP_HDR._edata], edx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.check_01_header:
|
.check_01_header:
|
||||||
@@ -252,7 +252,7 @@ test_app_header:
|
|||||||
jne .fail
|
jne .fail
|
||||||
@@:
|
@@:
|
||||||
mov ecx, [APP_HEADER_01.start]
|
mov ecx, [APP_HEADER_01.start]
|
||||||
mov [ebx+0x08], ecx
|
mov [ebx + 0x08], ecx
|
||||||
mov edx, [APP_HEADER_01.mem_size]
|
mov edx, [APP_HEADER_01.mem_size]
|
||||||
|
|
||||||
; \begin{diamond}[20.08.2006]
|
; \begin{diamond}[20.08.2006]
|
||||||
@@ -262,15 +262,15 @@ test_app_header:
|
|||||||
jb .fail
|
jb .fail
|
||||||
; \end{diamond}[20.08.2006]
|
; \end{diamond}[20.08.2006]
|
||||||
|
|
||||||
mov [ebx+APP_HDR._emem], edx
|
mov [ebx + APP_HDR._emem], edx
|
||||||
mov ecx, [APP_HEADER_01.stack_top]
|
mov ecx, [APP_HEADER_01.stack_top]
|
||||||
mov [ebx+APP_HDR.esp], ecx
|
mov [ebx + APP_HDR.esp], ecx
|
||||||
mov edx, [APP_HEADER_01.i_param]
|
mov edx, [APP_HEADER_01.i_param]
|
||||||
mov [ebx+APP_HDR.cmdline], edx
|
mov [ebx + APP_HDR.cmdline], edx
|
||||||
mov ecx, [APP_HEADER_01.i_icon]
|
mov ecx, [APP_HEADER_01.i_icon]
|
||||||
mov [ebx+APP_HDR.path], ecx
|
mov [ebx + APP_HDR.path], ecx
|
||||||
mov edx, [APP_HEADER_01.i_end]
|
mov edx, [APP_HEADER_01.i_end]
|
||||||
mov [ebx+APP_HDR._edata], edx
|
mov [ebx + APP_HDR._edata], edx
|
||||||
ret
|
ret
|
||||||
.fail:
|
.fail:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
@@ -294,7 +294,7 @@ alloc_thread_slot:
|
|||||||
bsf eax, [edx]
|
bsf eax, [edx]
|
||||||
jnz .found
|
jnz .found
|
||||||
add edx, 4
|
add edx, 4
|
||||||
cmp edx, thr_slot_map+32
|
cmp edx, thr_slot_map + 32
|
||||||
jb .l1
|
jb .l1
|
||||||
|
|
||||||
popfd
|
popfd
|
||||||
@@ -303,7 +303,7 @@ alloc_thread_slot:
|
|||||||
.found:
|
.found:
|
||||||
btr [edx], eax
|
btr [edx], eax
|
||||||
sub edx, thr_slot_map
|
sub edx, thr_slot_map
|
||||||
lea eax, [eax+edx*8]
|
lea eax, [eax + edx*8]
|
||||||
popfd
|
popfd
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -331,8 +331,8 @@ proc create_process stdcall, app_size:dword
|
|||||||
jz .fail
|
jz .fail
|
||||||
mov [process], eax
|
mov [process], eax
|
||||||
|
|
||||||
lea edi, [eax+PROC.heap_lock]
|
lea edi, [eax + PROC.heap_lock]
|
||||||
mov ecx, (PROC.ht_free-PROC.heap_lock)/4
|
mov ecx, (PROC.ht_free - PROC.heap_lock)/4
|
||||||
|
|
||||||
list_init eax
|
list_init eax
|
||||||
add eax, PROC.thr_list
|
add eax, PROC.thr_list
|
||||||
@@ -355,19 +355,19 @@ proc create_process stdcall, app_size:dword
|
|||||||
|
|
||||||
mov eax, edi
|
mov eax, edi
|
||||||
call get_pg_addr
|
call get_pg_addr
|
||||||
mov [edi-4096+PROC.pdt_0_phys], eax
|
mov [edi - 4096 + PROC.pdt_0_phys], eax
|
||||||
|
|
||||||
mov ecx, (OS_BASE shr 20)/4
|
mov ecx, (OS_BASE shr 20)/4
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
mov ecx, (OS_BASE shr 20)/4
|
mov ecx, (OS_BASE shr 20)/4
|
||||||
mov esi, sys_proc+PROC.pdt_0+(OS_BASE shr 20)
|
mov esi, sys_proc + PROC.pdt_0 + (OS_BASE shr 20)
|
||||||
rep movsd
|
rep movsd
|
||||||
|
|
||||||
mov eax, [edi-8192+PROC.pdt_0_phys]
|
mov eax, [edi - 8192 + PROC.pdt_0_phys]
|
||||||
or eax, PG_SWR
|
or eax, PG_SWR
|
||||||
mov [edi-4096+(page_tabs shr 20)], eax
|
mov [edi - 4096 + (page_tabs shr 20)], eax
|
||||||
|
|
||||||
lea edx, [edi-4096]
|
lea edx, [edi-4096]
|
||||||
mov esi, [app_tabs]
|
mov esi, [app_tabs]
|
||||||
@@ -447,7 +447,7 @@ align 4
|
|||||||
mov esi, ecx
|
mov esi, ecx
|
||||||
list_del esi
|
list_del esi
|
||||||
|
|
||||||
mov esi, [esi+PROC.dlls_list_ptr]
|
mov esi, [esi + PROC.dlls_list_ptr]
|
||||||
call destroy_all_hdlls
|
call destroy_all_hdlls
|
||||||
|
|
||||||
mov esi, [esp]
|
mov esi, [esp]
|
||||||
@@ -475,7 +475,7 @@ align 4
|
|||||||
align 4
|
align 4
|
||||||
get_pid:
|
get_pid:
|
||||||
mov eax, [current_slot]
|
mov eax, [current_slot]
|
||||||
mov eax, [eax+APPDATA.tid]
|
mov eax, [eax + APPDATA.tid]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
pid_to_slot:
|
pid_to_slot:
|
||||||
@@ -488,10 +488,7 @@ pid_to_slot:
|
|||||||
push ecx
|
push ecx
|
||||||
mov ebx, [thread_count]
|
mov ebx, [thread_count]
|
||||||
shl ebx, BSF sizeof.APPDATA ; multiply by size
|
shl ebx, BSF sizeof.APPDATA ; multiply by size
|
||||||
; add 2*32 cause:
|
|
||||||
; [TASK_TABLE; TASK_TABLE + 32) isnt a task actually
|
|
||||||
; skip first process in the task table
|
; skip first process in the task table
|
||||||
;mov ecx, 2*32 ;sizeof.TASKDATA
|
|
||||||
mov ecx, sizeof.APPDATA
|
mov ecx, sizeof.APPDATA
|
||||||
|
|
||||||
.loop:
|
.loop:
|
||||||
@@ -499,7 +496,7 @@ pid_to_slot:
|
|||||||
;ebx = maximum permitted offset
|
;ebx = maximum permitted offset
|
||||||
cmp [SLOT_BASE + ecx + APPDATA.state], TSTATE_FREE
|
cmp [SLOT_BASE + ecx + APPDATA.state], TSTATE_FREE
|
||||||
jz .endloop ;skip empty slots
|
jz .endloop ;skip empty slots
|
||||||
cmp [ecx + SLOT_BASE + APPDATA.tid], eax;check PID
|
cmp [SLOT_BASE + ecx + APPDATA.tid], eax
|
||||||
jz .pid_found
|
jz .pid_found
|
||||||
.endloop:
|
.endloop:
|
||||||
add ecx, sizeof.APPDATA
|
add ecx, sizeof.APPDATA
|
||||||
@@ -698,7 +695,7 @@ proc new_sys_threads
|
|||||||
mov ebx, esi ;ebx=esi - pointer to extended information about current thread
|
mov ebx, esi ;ebx=esi - pointer to extended information about current thread
|
||||||
|
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
shl edi, 8
|
shl edi, BSF sizeof.APPDATA
|
||||||
add edi, SLOT_BASE
|
add edi, SLOT_BASE
|
||||||
mov edx, edi ;edx=edi - pointer to extended infomation about new thread
|
mov edx, edi ;edx=edi - pointer to extended infomation about new thread
|
||||||
mov ecx, sizeof.APPDATA/4
|
mov ecx, sizeof.APPDATA/4
|
||||||
@@ -711,7 +708,7 @@ proc new_sys_threads
|
|||||||
rep movsb ;copy process name
|
rep movsb ;copy process name
|
||||||
|
|
||||||
|
|
||||||
mov eax, [ebx+APPDATA.tls_base]
|
mov eax, [ebx + APPDATA.tls_base]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @F
|
jz @F
|
||||||
|
|
||||||
@@ -721,13 +718,13 @@ proc new_sys_threads
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .failed1;eax=0
|
jz .failed1;eax=0
|
||||||
@@:
|
@@:
|
||||||
mov [edx+APPDATA.tls_base], eax
|
mov [edx + APPDATA.tls_base], eax
|
||||||
|
|
||||||
mov eax, [ebx+APPDATA.process]
|
mov eax, [ebx + APPDATA.process]
|
||||||
mov [edx+APPDATA.process], eax
|
mov [edx + APPDATA.process], eax
|
||||||
|
|
||||||
lea ebx, [edx+APPDATA.list]
|
lea ebx, [edx + APPDATA.list]
|
||||||
lea ecx, [eax+PROC.thr_list]
|
lea ecx, [eax + PROC.thr_list]
|
||||||
list_add_tail ebx, ecx ;add thread to process child's list
|
list_add_tail ebx, ecx ;add thread to process child's list
|
||||||
|
|
||||||
lea eax, [app_cmdline]
|
lea eax, [app_cmdline]
|
||||||
@@ -796,16 +793,16 @@ endp
|
|||||||
align 4
|
align 4
|
||||||
common_app_entry:
|
common_app_entry:
|
||||||
mov ebp, [current_slot]
|
mov ebp, [current_slot]
|
||||||
mov ebp, [ebp+APPDATA.exec_params]
|
mov ebp, [ebp + APPDATA.exec_params]
|
||||||
test ebp, ebp
|
test ebp, ebp
|
||||||
jz .exit
|
jz .exit
|
||||||
; APPDATA.exec_params have first thread only,
|
; APPDATA.exec_params have first thread only,
|
||||||
; so second and next threads don't get here (they jump to .exit)
|
; so second and next threads don't get here (they jump to .exit)
|
||||||
stdcall map_process_image, [ebp+APP_HDR._emem],\
|
stdcall map_process_image, [ebp + APP_HDR._emem],\
|
||||||
[ebp+APP_HDR.img_base], [ebp+APP_HDR.img_size]
|
[ebp + APP_HDR.img_base], [ebp + APP_HDR.img_size]
|
||||||
mov esi, [ebp+APP_HDR.path_string]
|
mov esi, [ebp + APP_HDR.path_string]
|
||||||
mov edi, [ebp+APP_HDR.path]
|
mov edi, [ebp + APP_HDR.path]
|
||||||
mov ecx, [ebp+APP_HDR.filename_size]
|
mov ecx, [ebp + APP_HDR.filename_size]
|
||||||
cmp ecx, 1023
|
cmp ecx, 1023
|
||||||
jc @f
|
jc @f
|
||||||
mov ecx, 1022
|
mov ecx, 1022
|
||||||
@@ -813,7 +810,7 @@ common_app_entry:
|
|||||||
push esi
|
push esi
|
||||||
test edi, edi
|
test edi, edi
|
||||||
jz @f
|
jz @f
|
||||||
stdcall is_region_userspace, edi, [ebp+APP_HDR.filename_size]
|
stdcall is_region_userspace, edi, [ebp + APP_HDR.filename_size]
|
||||||
jnz @f
|
jnz @f
|
||||||
mov al, '/'
|
mov al, '/'
|
||||||
stosb
|
stosb
|
||||||
@@ -821,14 +818,14 @@ common_app_entry:
|
|||||||
mov byte [edi], 0
|
mov byte [edi], 0
|
||||||
@@:
|
@@:
|
||||||
call kernel_free
|
call kernel_free
|
||||||
mov edi, [ebp+APP_HDR.cmdline]
|
mov edi, [ebp + APP_HDR.cmdline]
|
||||||
test edi, edi
|
test edi, edi
|
||||||
jz .check_tls_header
|
jz .check_tls_header
|
||||||
lea esi, [ebp+sizeof.APP_HDR]
|
lea esi, [ebp + sizeof.APP_HDR]
|
||||||
mov ecx, [ebp+APP_HDR.cmdline_size]
|
mov ecx, [ebp + APP_HDR.cmdline_size]
|
||||||
cmp ecx, 256
|
cmp ecx, 256
|
||||||
jb .copy_cmdline
|
jb .copy_cmdline
|
||||||
mov edi, [ebp+APP_HDR._emem]
|
mov edi, [ebp + APP_HDR._emem]
|
||||||
add edi, 4095
|
add edi, 4095
|
||||||
and edi, -4096
|
and edi, -4096
|
||||||
sub edi, ecx
|
sub edi, ecx
|
||||||
@@ -852,7 +849,7 @@ common_app_entry:
|
|||||||
call init_heap
|
call init_heap
|
||||||
stdcall user_alloc, 4096
|
stdcall user_alloc, 4096
|
||||||
mov edx, [current_slot]
|
mov edx, [current_slot]
|
||||||
mov [edx+APPDATA.tls_base], eax
|
mov [edx + APPDATA.tls_base], eax
|
||||||
mov [tls_data_l+2], ax
|
mov [tls_data_l+2], ax
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
mov [tls_data_l+4], al
|
mov [tls_data_l+4], al
|
||||||
@@ -862,7 +859,7 @@ common_app_entry:
|
|||||||
; { Patch by Coldy, For DLL autoload
|
; { Patch by Coldy, For DLL autoload
|
||||||
.try_load_dll:
|
.try_load_dll:
|
||||||
; Test app header version
|
; Test app header version
|
||||||
mov ecx, dword[ebp+APP_HDR.img_base]
|
mov ecx, dword[ebp + APP_HDR.img_base]
|
||||||
cmp dword[ecx+8], 2
|
cmp dword[ecx+8], 2
|
||||||
jne .cleanup
|
jne .cleanup
|
||||||
;if APP_HEADER.version = 2 => load lib/dll.obj & change eip to APP_STARTUP_THUNK
|
;if APP_HEADER.version = 2 => load lib/dll.obj & change eip to APP_STARTUP_THUNK
|
||||||
@@ -887,7 +884,7 @@ common_app_entry:
|
|||||||
|
|
||||||
;.change_eip:
|
;.change_eip:
|
||||||
mov ecx, [current_slot]
|
mov ecx, [current_slot]
|
||||||
mov ecx, [ecx+APPDATA.pl0_stack]
|
mov ecx, [ecx + APPDATA.pl0_stack]
|
||||||
mov [ecx+REG_EIP], eax
|
mov [ecx+REG_EIP], eax
|
||||||
|
|
||||||
; } End patch by Coldy, For DLL autoload
|
; } End patch by Coldy, For DLL autoload
|
||||||
@@ -895,9 +892,9 @@ common_app_entry:
|
|||||||
stdcall free_kernel_space, [ebp+APP_HDR.img_base]
|
stdcall free_kernel_space, [ebp+APP_HDR.img_base]
|
||||||
stdcall kernel_free, ebp
|
stdcall kernel_free, ebp
|
||||||
mov ebx, [current_slot]
|
mov ebx, [current_slot]
|
||||||
cmp [ebx+APPDATA.debugger_slot], 0
|
cmp [ebx + APPDATA.debugger_slot], 0
|
||||||
je .exit
|
je .exit
|
||||||
mov [ebx+APPDATA.state], TSTATE_RUN_SUSPENDED
|
mov [ebx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||||
mov [ebx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
mov [ebx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||||
call change_task
|
call change_task
|
||||||
.exit:
|
.exit:
|
||||||
@@ -927,16 +924,16 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
|
|||||||
mov ebx, eax
|
mov ebx, eax
|
||||||
|
|
||||||
shl eax, BSF sizeof.APPDATA
|
shl eax, BSF sizeof.APPDATA
|
||||||
mov [eax+SLOT_BASE+APPDATA.fpu_state], edi
|
mov [SLOT_BASE + eax + APPDATA.fpu_state], edi
|
||||||
mov [eax+SLOT_BASE+APPDATA.exc_handler], 0
|
mov [SLOT_BASE + eax + APPDATA.exc_handler], 0
|
||||||
mov [eax+SLOT_BASE+APPDATA.except_mask], 0
|
mov [SLOT_BASE + eax + APPDATA.except_mask], 0
|
||||||
mov [eax+SLOT_BASE+APPDATA.terminate_protection], 80000001h
|
mov [SLOT_BASE + eax + APPDATA.terminate_protection], 80000001h
|
||||||
|
|
||||||
;set default io permission map
|
;set default io permission map
|
||||||
mov ecx, [SLOT_BASE+sizeof.APPDATA+APPDATA.io_map]
|
mov ecx, [SLOT_BASE + sizeof.APPDATA + APPDATA.io_map]
|
||||||
mov [eax+SLOT_BASE+APPDATA.io_map], ecx
|
mov [SLOT_BASE + eax + APPDATA.io_map], ecx
|
||||||
mov ecx, [SLOT_BASE+sizeof.APPDATA+APPDATA.io_map+4]
|
mov ecx, [SLOT_BASE + sizeof.APPDATA + APPDATA.io_map + 4]
|
||||||
mov [eax+SLOT_BASE+APPDATA.io_map+4], ecx
|
mov [SLOT_BASE + eax + APPDATA.io_map + 4], ecx
|
||||||
|
|
||||||
mov esi, fpu_data
|
mov esi, fpu_data
|
||||||
mov ecx, [xsave_area_size]
|
mov ecx, [xsave_area_size]
|
||||||
@@ -947,45 +944,45 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
|
|||||||
cmp [thread_count], ebx
|
cmp [thread_count], ebx
|
||||||
adc [thread_count], 0 ; update number of processes
|
adc [thread_count], 0 ; update number of processes
|
||||||
shl ebx, BSF sizeof.APPDATA
|
shl ebx, BSF sizeof.APPDATA
|
||||||
lea edx, [ebx+SLOT_BASE+APP_EV_OFFSET]
|
lea edx, [SLOT_BASE + ebx + APP_EV_OFFSET]
|
||||||
mov [SLOT_BASE+APPDATA.fd_ev+ebx], edx
|
mov [SLOT_BASE + ebx + APPDATA.fd_ev], edx
|
||||||
mov [SLOT_BASE+APPDATA.bk_ev+ebx], edx
|
mov [SLOT_BASE + ebx + APPDATA.bk_ev], edx
|
||||||
|
|
||||||
add edx, APP_OBJ_OFFSET-APP_EV_OFFSET
|
add edx, APP_OBJ_OFFSET - APP_EV_OFFSET
|
||||||
mov [SLOT_BASE+APPDATA.fd_obj+ebx], edx
|
mov [SLOT_BASE + ebx + APPDATA.fd_obj], edx
|
||||||
mov [SLOT_BASE+APPDATA.bk_obj+ebx], edx
|
mov [SLOT_BASE + ebx + APPDATA.bk_obj], edx
|
||||||
|
|
||||||
mov ecx, [def_cursor]
|
mov ecx, [def_cursor]
|
||||||
mov [SLOT_BASE+APPDATA.cursor+ebx], ecx
|
mov [SLOT_BASE + ebx + APPDATA.cursor], ecx
|
||||||
mov eax, [pl0_stack]
|
mov eax, [pl0_stack]
|
||||||
mov [SLOT_BASE+APPDATA.pl0_stack+ebx], eax
|
mov [SLOT_BASE + ebx + APPDATA.pl0_stack], eax
|
||||||
add eax, RING0_STACK_SIZE
|
add eax, RING0_STACK_SIZE
|
||||||
mov [SLOT_BASE+APPDATA.saved_esp0+ebx], eax
|
mov [SLOT_BASE + ebx + APPDATA.saved_esp0], eax
|
||||||
|
|
||||||
push ebx
|
push ebx
|
||||||
stdcall kernel_alloc, maxPathLength
|
stdcall kernel_alloc, maxPathLength
|
||||||
pop ebx
|
pop ebx
|
||||||
mov esi, [current_slot]
|
mov esi, [current_slot]
|
||||||
mov esi, [esi+APPDATA.cur_dir]
|
mov esi, [esi + APPDATA.cur_dir]
|
||||||
mov ecx, maxPathLength/4
|
mov ecx, maxPathLength/4
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
mov [ebx+SLOT_BASE+APPDATA.cur_dir], eax
|
mov [SLOT_BASE + ebx + APPDATA.cur_dir], eax
|
||||||
rep movsd
|
rep movsd
|
||||||
|
|
||||||
mov [ebx+SLOT_BASE+APPDATA.event_mask], dword 1+2+4;set default event flags (see 40 function)
|
mov [SLOT_BASE + ebx + APPDATA.event_mask], dword 1+2+4;set default event flags (see 40 function)
|
||||||
inc dword [process_number]
|
inc dword [process_number]
|
||||||
mov eax, [process_number]
|
mov eax, [process_number]
|
||||||
mov [ebx+SLOT_BASE+APPDATA.tid], eax ;set TID
|
mov [SLOT_BASE + ebx + APPDATA.tid], eax ;set TID
|
||||||
|
|
||||||
mov eax, [slot]
|
mov eax, [slot]
|
||||||
mov [ebx+SLOT_BASE+APPDATA.wnd_number], al
|
mov [SLOT_BASE + ebx + APPDATA.wnd_number], al
|
||||||
mov ebx, eax
|
mov ebx, eax
|
||||||
shl ebx, BSF sizeof.WDATA
|
shl ebx, BSF sizeof.WDATA
|
||||||
lea ecx, [draw_data+ebx];ecx - pointer to draw data
|
lea ecx, [draw_data + ebx];ecx - pointer to draw data
|
||||||
|
|
||||||
; set window state to 'normal' (non-minimized/maximized/rolled-up) state
|
; set window state to 'normal' (non-minimized/maximized/rolled-up) state
|
||||||
mov [ebx+window_data+WDATA.fl_wstate], WSTATE_NORMAL
|
mov [window_data + ebx + WDATA.fl_wstate], WSTATE_NORMAL
|
||||||
mov [ebx+window_data+WDATA.fl_redraw], 1
|
mov [window_data + ebx + WDATA.fl_redraw], 1
|
||||||
|
|
||||||
;set draw data to full screen
|
;set draw data to full screen
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
@@ -998,50 +995,50 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
|
|||||||
|
|
||||||
mov ebx, [pl0_stack]
|
mov ebx, [pl0_stack]
|
||||||
mov esi, [params]
|
mov esi, [params]
|
||||||
lea ecx, [ebx+REG_EIP]
|
lea ecx, [ebx + REG_EIP]
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
|
|
||||||
mov [ebx+REG_RET], dword common_app_entry
|
mov [ebx + REG_RET], dword common_app_entry
|
||||||
mov [ebx+REG_EDI], eax
|
mov [ebx + REG_EDI], eax
|
||||||
mov [ebx+REG_ESI], eax
|
mov [ebx + REG_ESI], eax
|
||||||
mov [ebx+REG_EBP], eax
|
mov [ebx + REG_EBP], eax
|
||||||
mov [ebx+REG_ESP], ecx;ebx+REG_EIP
|
mov [ebx + REG_ESP], ecx;ebx+REG_EIP
|
||||||
mov [ebx+REG_EBX], eax
|
mov [ebx + REG_EBX], eax
|
||||||
mov [ebx+REG_EDX], eax
|
mov [ebx + REG_EDX], eax
|
||||||
mov [ebx+REG_ECX], eax
|
mov [ebx + REG_ECX], eax
|
||||||
mov [ebx+REG_EAX], eax
|
mov [ebx + REG_EAX], eax
|
||||||
|
|
||||||
mov eax, [esi+APP_HDR.eip]
|
mov eax, [esi + APP_HDR.eip]
|
||||||
mov [ebx+REG_EIP], eax
|
mov [ebx + REG_EIP], eax
|
||||||
mov [ebx+REG_CS], dword app_code
|
mov [ebx + REG_CS], dword app_code
|
||||||
mov ecx, USER_PRIORITY
|
mov ecx, USER_PRIORITY
|
||||||
|
|
||||||
test byte [flags], 2
|
test byte [flags], 2
|
||||||
jz @F
|
jz @F
|
||||||
|
|
||||||
mov [ebx+REG_CS], dword os_code ; kernel thread
|
mov [ebx + REG_CS], dword os_code ; kernel thread
|
||||||
mov ecx, MAX_PRIORITY
|
mov ecx, MAX_PRIORITY
|
||||||
@@:
|
@@:
|
||||||
mov [ebx+REG_EFLAGS], dword EFL_IOPL1+EFL_IF
|
mov [ebx + REG_EFLAGS], dword EFL_IOPL1+EFL_IF
|
||||||
|
|
||||||
mov eax, [esi+APP_HDR.esp]
|
mov eax, [esi + APP_HDR.esp]
|
||||||
mov [ebx+REG_APP_ESP], eax
|
mov [ebx + REG_APP_ESP], eax
|
||||||
mov [ebx+REG_SS], dword app_data
|
mov [ebx + REG_SS], dword app_data
|
||||||
|
|
||||||
lea edx, [ebx+REG_RET]
|
lea edx, [ebx + REG_RET]
|
||||||
mov ebx, [slot]
|
mov ebx, [slot]
|
||||||
shl ebx, BSF sizeof.APPDATA
|
shl ebx, BSF sizeof.APPDATA
|
||||||
mov [ebx+SLOT_BASE+APPDATA.saved_esp], edx
|
mov [SLOT_BASE + ebx + APPDATA.saved_esp], edx
|
||||||
|
|
||||||
xor edx, edx; process state - running
|
xor edx, edx; process state - running
|
||||||
; set if debuggee
|
; set if debuggee
|
||||||
test byte [flags], 1
|
test byte [flags], 1
|
||||||
jz .no_debug
|
jz .no_debug
|
||||||
mov eax, [current_slot_idx]
|
mov eax, [current_slot_idx]
|
||||||
mov [SLOT_BASE+ebx+APPDATA.debugger_slot], eax
|
mov [SLOT_BASE + ebx + APPDATA.debugger_slot], eax
|
||||||
.no_debug:
|
.no_debug:
|
||||||
mov [SLOT_BASE + ebx + APPDATA.state], dl
|
mov [SLOT_BASE + ebx + APPDATA.state], dl
|
||||||
lea edx, [SLOT_BASE+ebx]
|
lea edx, [SLOT_BASE + ebx]
|
||||||
call scheduler_add_thread
|
call scheduler_add_thread
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@@ -1049,7 +1046,7 @@ endp
|
|||||||
align 4
|
align 4
|
||||||
get_stack_base:
|
get_stack_base:
|
||||||
mov eax, [current_slot]
|
mov eax, [current_slot]
|
||||||
mov eax, [eax+APPDATA.pl0_stack]
|
mov eax, [eax + APPDATA.pl0_stack]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2009-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2009-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2012-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2012-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -91,11 +91,11 @@ proc timer_hs stdcall uses ebx, deltaStart:dword, interval:dword, \
|
|||||||
xchg ebx, eax
|
xchg ebx, eax
|
||||||
; 2a. Copy values from the arguments.
|
; 2a. Copy values from the arguments.
|
||||||
mov ecx, [interval]
|
mov ecx, [interval]
|
||||||
mov [ebx+TIMER.Interval], ecx
|
mov [ebx + TIMER.Interval], ecx
|
||||||
mov ecx, [timerFunc]
|
mov ecx, [timerFunc]
|
||||||
mov [ebx+TIMER.TimerFunc], ecx
|
mov [ebx + TIMER.TimerFunc], ecx
|
||||||
mov ecx, [userData]
|
mov ecx, [userData]
|
||||||
mov [ebx+TIMER.UserData], ecx
|
mov [ebx + TIMER.UserData], ecx
|
||||||
; 2b. Get time of the next activation.
|
; 2b. Get time of the next activation.
|
||||||
mov ecx, [deltaStart]
|
mov ecx, [deltaStart]
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
@@ -103,17 +103,17 @@ proc timer_hs stdcall uses ebx, deltaStart:dword, interval:dword, \
|
|||||||
mov ecx, [interval]
|
mov ecx, [interval]
|
||||||
@@:
|
@@:
|
||||||
add ecx, [timer_ticks]
|
add ecx, [timer_ticks]
|
||||||
mov [ebx+TIMER.Time], ecx
|
mov [ebx + TIMER.Time], ecx
|
||||||
; 3. Insert the TIMER structure to the global list.
|
; 3. Insert the TIMER structure to the global list.
|
||||||
; 3a. Acquire the lock.
|
; 3a. Acquire the lock.
|
||||||
call lock_timer_list
|
call lock_timer_list
|
||||||
; 3b. Insert an item at ebx to the tail of the timer_list.
|
; 3b. Insert an item at ebx to the tail of the timer_list.
|
||||||
mov eax, timer_list
|
mov eax, timer_list
|
||||||
mov ecx, [eax+TIMER.Prev]
|
mov ecx, [eax + TIMER.Prev]
|
||||||
mov [ebx+TIMER.Next], eax
|
mov [ebx + TIMER.Next], eax
|
||||||
mov [ebx+TIMER.Prev], ecx
|
mov [ebx + TIMER.Prev], ecx
|
||||||
mov [eax+TIMER.Prev], ebx
|
mov [eax + TIMER.Prev], ebx
|
||||||
mov [ecx+TIMER.Next], ebx
|
mov [ecx + TIMER.Next], ebx
|
||||||
; 3c. Release the lock.
|
; 3c. Release the lock.
|
||||||
call unlock_timer_list
|
call unlock_timer_list
|
||||||
; 4. Return with eax = pointer to TIMER structure.
|
; 4. Return with eax = pointer to TIMER structure.
|
||||||
@@ -132,10 +132,10 @@ cancel_timer_hs:
|
|||||||
call lock_timer_list
|
call lock_timer_list
|
||||||
mov ebx, [esp+4+4]
|
mov ebx, [esp+4+4]
|
||||||
; 1b. Delete an item at ebx from the double-linked list.
|
; 1b. Delete an item at ebx from the double-linked list.
|
||||||
mov eax, [ebx+TIMER.Next]
|
mov eax, [ebx + TIMER.Next]
|
||||||
mov ecx, [ebx+TIMER.Prev]
|
mov ecx, [ebx + TIMER.Prev]
|
||||||
mov [eax+TIMER.Prev], ecx
|
mov [eax + TIMER.Prev], ecx
|
||||||
mov [ecx+TIMER.Next], eax
|
mov [ecx + TIMER.Next], eax
|
||||||
; 1c. If we are removing the next timer in currently processing chain,
|
; 1c. If we are removing the next timer in currently processing chain,
|
||||||
; the next timer for this timer becomes new next timer.
|
; the next timer for this timer becomes new next timer.
|
||||||
cmp ebx, [timer_next]
|
cmp ebx, [timer_next]
|
||||||
@@ -158,14 +158,14 @@ check_timers:
|
|||||||
call lock_timer_list
|
call lock_timer_list
|
||||||
; 2. Loop over all registered timers, checking time.
|
; 2. Loop over all registered timers, checking time.
|
||||||
; 2a. Get the first item.
|
; 2a. Get the first item.
|
||||||
mov eax, [timer_list+TIMER.Next]
|
mov eax, [timer_list + TIMER.Next]
|
||||||
mov [timer_next], eax
|
mov [timer_next], eax
|
||||||
.loop:
|
.loop:
|
||||||
; 2b. Check for end of list.
|
; 2b. Check for end of list.
|
||||||
cmp eax, timer_list
|
cmp eax, timer_list
|
||||||
jz .done
|
jz .done
|
||||||
; 2c. Get and store the next timer.
|
; 2c. Get and store the next timer.
|
||||||
mov edx, [eax+TIMER.Next]
|
mov edx, [eax + TIMER.Next]
|
||||||
mov [timer_next], edx
|
mov [timer_next], edx
|
||||||
; 2d. Check time for timer activation.
|
; 2d. Check time for timer activation.
|
||||||
; We can't just compare [timer_ticks] and [TIMER.Time], since overflows are
|
; We can't just compare [timer_ticks] and [TIMER.Time], since overflows are
|
||||||
@@ -176,16 +176,16 @@ check_timers:
|
|||||||
; not over or we have not processed this timer for 2^31 ticks, what is very
|
; not over or we have not processed this timer for 2^31 ticks, what is very
|
||||||
; unlikely.
|
; unlikely.
|
||||||
mov edx, [timer_ticks]
|
mov edx, [timer_ticks]
|
||||||
sub edx, [eax+TIMER.Time]
|
sub edx, [eax + TIMER.Time]
|
||||||
js .next
|
js .next
|
||||||
; The timer should be activated now.
|
; The timer should be activated now.
|
||||||
; 2e. Store the timer data in the stack. This is required since 2f can delete
|
; 2e. Store the timer data in the stack. This is required since 2f can delete
|
||||||
; the timer, invalidating the content.
|
; the timer, invalidating the content.
|
||||||
push [eax+TIMER.UserData] ; parameter for TimerFunc
|
push [eax + TIMER.UserData] ; parameter for TimerFunc
|
||||||
push [eax+TIMER.TimerFunc] ; to be restored in 2g
|
push [eax + TIMER.TimerFunc] ; to be restored in 2g
|
||||||
; 2f. Calculate time of next activation or delete the timer if it is one-shot.
|
; 2f. Calculate time of next activation or delete the timer if it is one-shot.
|
||||||
mov ecx, [eax+TIMER.Interval]
|
mov ecx, [eax + TIMER.Interval]
|
||||||
add [eax+TIMER.Time], ecx
|
add [eax + TIMER.Time], ecx
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jnz .nodelete
|
jnz .nodelete
|
||||||
stdcall cancel_timer_hs, eax
|
stdcall cancel_timer_hs, eax
|
||||||
@@ -208,14 +208,14 @@ check_timers:
|
|||||||
proc check_timers_has_work?
|
proc check_timers_has_work?
|
||||||
pushf
|
pushf
|
||||||
cli
|
cli
|
||||||
mov eax, [timer_list+TIMER.Next]
|
mov eax, [timer_list + TIMER.Next]
|
||||||
.loop:
|
.loop:
|
||||||
cmp eax, timer_list
|
cmp eax, timer_list
|
||||||
jz .done_nowork
|
jz .done_nowork
|
||||||
mov edx, [timer_ticks]
|
mov edx, [timer_ticks]
|
||||||
sub edx, [eax+TIMER.Time]
|
sub edx, [eax + TIMER.Time]
|
||||||
jns .done_haswork
|
jns .done_haswork
|
||||||
mov eax, [eax+TIMER.Next]
|
mov eax, [eax + TIMER.Next]
|
||||||
jmp .loop
|
jmp .loop
|
||||||
.done_nowork:
|
.done_nowork:
|
||||||
popf
|
popf
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2007-2021. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2007-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -33,7 +33,7 @@ v86_create:
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
; initialize mutex
|
; initialize mutex
|
||||||
and dword [eax+V86_machine.mutex], 0
|
and dword [eax + V86_machine.mutex], 0
|
||||||
; allocate tables
|
; allocate tables
|
||||||
mov ebx, eax
|
mov ebx, eax
|
||||||
|
|
||||||
@@ -41,15 +41,15 @@ v86_create:
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail2
|
jz .fail2
|
||||||
|
|
||||||
mov [eax+PROC.mem_used], 4096
|
mov [eax + PROC.mem_used], 4096
|
||||||
mov [ebx+V86_machine.process], eax
|
mov [ebx + V86_machine.process], eax
|
||||||
|
|
||||||
push 2000h
|
push 2000h
|
||||||
call kernel_alloc
|
call kernel_alloc
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail2
|
jz .fail2
|
||||||
|
|
||||||
mov [ebx+V86_machine.iopm], eax
|
mov [ebx + V86_machine.iopm], eax
|
||||||
|
|
||||||
; initialize tables
|
; initialize tables
|
||||||
push edi
|
push edi
|
||||||
@@ -58,8 +58,8 @@ v86_create:
|
|||||||
mov ecx, 2000h/4
|
mov ecx, 2000h/4
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
mov eax, [ebx+V86_machine.process]
|
mov eax, [ebx + V86_machine.process]
|
||||||
mov eax, [eax+PROC.pdt_0_phys]
|
mov eax, [eax + PROC.pdt_0_phys]
|
||||||
|
|
||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
@@ -107,7 +107,7 @@ v86_create:
|
|||||||
add eax, edx
|
add eax, edx
|
||||||
loop @b
|
loop @b
|
||||||
|
|
||||||
mov eax, [sys_proc+PROC.pdt_0_phys]
|
mov eax, [sys_proc + PROC.pdt_0_phys]
|
||||||
mov cr3, eax
|
mov cr3, eax
|
||||||
popfd
|
popfd
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ v86_get_lin_addr:
|
|||||||
push ecx edx
|
push ecx edx
|
||||||
mov ecx, eax
|
mov ecx, eax
|
||||||
shr ecx, 12
|
shr ecx, 12
|
||||||
mov edx, [page_tabs+ecx*4]
|
mov edx, [page_tabs + ecx*4]
|
||||||
and eax, 0xFFF
|
and eax, 0xFFF
|
||||||
and edx, 0xFFFFF000
|
and edx, 0xFFFFF000
|
||||||
or eax, edx
|
or eax, edx
|
||||||
@@ -210,7 +210,7 @@ init_sys_v86:
|
|||||||
mov esi, eax
|
mov esi, eax
|
||||||
if ~DEBUG_SHOW_IO
|
if ~DEBUG_SHOW_IO
|
||||||
; allow access to all ports
|
; allow access to all ports
|
||||||
mov ecx, [esi+V86_machine.iopm]
|
mov ecx, [esi + V86_machine.iopm]
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edi, ecx
|
mov edi, ecx
|
||||||
mov ecx, 10000h/8/4
|
mov ecx, 10000h/8/4
|
||||||
@@ -258,30 +258,30 @@ v86_start:
|
|||||||
|
|
||||||
mov ecx, [current_slot]
|
mov ecx, [current_slot]
|
||||||
|
|
||||||
push dword [ecx+APPDATA.io_map]
|
push dword [ecx + APPDATA.io_map]
|
||||||
push dword [ecx+APPDATA.io_map+4]
|
push dword [ecx + APPDATA.io_map+4]
|
||||||
push [ecx+APPDATA.process]
|
push [ecx + APPDATA.process]
|
||||||
push [ecx+APPDATA.saved_esp0]
|
push [ecx + APPDATA.saved_esp0]
|
||||||
mov [ecx+APPDATA.saved_esp0], esp
|
mov [ecx + APPDATA.saved_esp0], esp
|
||||||
mov [tss._esp0], esp
|
mov [tss._esp0], esp
|
||||||
|
|
||||||
mov eax, [esi+V86_machine.iopm]
|
mov eax, [esi + V86_machine.iopm]
|
||||||
call get_pg_addr
|
call get_pg_addr
|
||||||
inc eax
|
inc eax
|
||||||
mov dword [ecx+APPDATA.io_map], eax
|
mov dword [ecx + APPDATA.io_map], eax
|
||||||
mov dword [page_tabs + (tss._io_map_0 shr 10)], eax
|
mov dword [page_tabs + (tss._io_map_0 shr 10)], eax
|
||||||
|
|
||||||
mov eax, [esi+V86_machine.iopm]
|
mov eax, [esi + V86_machine.iopm]
|
||||||
add eax, 0x1000
|
add eax, 0x1000
|
||||||
call get_pg_addr
|
call get_pg_addr
|
||||||
inc eax
|
inc eax
|
||||||
mov dword [ecx+APPDATA.io_map+4], eax
|
mov dword [ecx + APPDATA.io_map + 4], eax
|
||||||
mov dword [page_tabs + (tss._io_map_1 shr 10)], eax
|
mov dword [page_tabs + (tss._io_map_1 shr 10)], eax
|
||||||
|
|
||||||
mov eax, [esi+V86_machine.process]
|
mov eax, [esi + V86_machine.process]
|
||||||
mov [ecx+APPDATA.process], eax
|
mov [ecx + APPDATA.process], eax
|
||||||
mov [current_process], eax
|
mov [current_process], eax
|
||||||
mov eax, [eax+PROC.pdt_0_phys]
|
mov eax, [eax + PROC.pdt_0_phys]
|
||||||
mov cr3, eax
|
mov cr3, eax
|
||||||
|
|
||||||
; We do not enable interrupts, because V86 IRQ redirector assumes that
|
; We do not enable interrupts, because V86 IRQ redirector assumes that
|
||||||
@@ -301,18 +301,18 @@ v86_start:
|
|||||||
uglobal
|
uglobal
|
||||||
v86_irqhooks rd IRQ_RESERVED * 2
|
v86_irqhooks rd IRQ_RESERVED * 2
|
||||||
endg
|
endg
|
||||||
cmp [v86_irqhooks+edx*8], 0
|
cmp [v86_irqhooks + edx*8], 0
|
||||||
jz @f
|
jz @f
|
||||||
cmp [v86_irqhooks+edx*8], eax
|
cmp [v86_irqhooks + edx*8], eax
|
||||||
jz @f
|
jz @f
|
||||||
mov esi, v86_irqerr
|
mov esi, v86_irqerr
|
||||||
call sys_msg_board_str
|
call sys_msg_board_str
|
||||||
inc [v86_irqhooks+edx*8+4]
|
inc [v86_irqhooks + edx*8 + 4]
|
||||||
mov eax, 3
|
mov eax, 3
|
||||||
jmp v86_exc_c.exit
|
jmp v86_exc_c.exit
|
||||||
@@:
|
@@:
|
||||||
mov [v86_irqhooks+edx*8], eax
|
mov [v86_irqhooks + edx*8], eax
|
||||||
inc [v86_irqhooks+edx*8+4]
|
inc [v86_irqhooks + edx*8 + 4]
|
||||||
.noirqhook:
|
.noirqhook:
|
||||||
|
|
||||||
popad
|
popad
|
||||||
@@ -343,26 +343,26 @@ v86_exc_c:
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov dr6, eax
|
mov dr6, eax
|
||||||
@@:
|
@@:
|
||||||
mov eax, [esp+sizeof.v86_regs+10h+18h]
|
mov eax, [esp + sizeof.v86_regs + 10h+18h]
|
||||||
cmp word [esp+v86_regs.eip], ax
|
cmp word [esp + v86_regs.eip], ax
|
||||||
jnz @f
|
jnz @f
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
cmp word [esp+v86_regs.cs], ax
|
cmp word [esp + v86_regs.cs], ax
|
||||||
jz .done
|
jz .done
|
||||||
@@:
|
@@:
|
||||||
; Various system events, which must be handled, result in #GP
|
; Various system events, which must be handled, result in #GP
|
||||||
cmp bl, 13
|
cmp bl, 13
|
||||||
jnz .nogp
|
jnz .nogp
|
||||||
; If faulted EIP exceeds 0xFFFF, we have #GP and it is an error
|
; If faulted EIP exceeds 0xFFFF, we have #GP and it is an error
|
||||||
cmp word [esp+v86_regs.eip+2], 0
|
cmp word [esp + v86_regs.eip+2], 0
|
||||||
jnz .nogp
|
jnz .nogp
|
||||||
; Otherwise we can safely access byte at CS:IP
|
; Otherwise we can safely access byte at CS:IP
|
||||||
; (because it is #GP, not #PF handler)
|
; (because it is #GP, not #PF handler)
|
||||||
; If we could get an exception just because of reading code bytes,
|
; If we could get an exception just because of reading code bytes,
|
||||||
; we would have got it already and it wouldn't be #GP
|
; we would have got it already and it wouldn't be #GP
|
||||||
movzx esi, word [esp+v86_regs.cs]
|
movzx esi, word [esp + v86_regs.cs]
|
||||||
shl esi, 4
|
shl esi, 4
|
||||||
add esi, [esp+v86_regs.eip]
|
add esi, [esp + v86_regs.eip]
|
||||||
lodsb
|
lodsb
|
||||||
cmp al, 0xCD ; int xx command = CD xx
|
cmp al, 0xCD ; int xx command = CD xx
|
||||||
jz .handle_int
|
jz .handle_int
|
||||||
@@ -394,7 +394,7 @@ v86_exc_c:
|
|||||||
jz .handle_66
|
jz .handle_66
|
||||||
jmp .nogp
|
jmp .nogp
|
||||||
.handle_int:
|
.handle_int:
|
||||||
cmp word [esp+v86_regs.eip], 0xFFFF
|
cmp word [esp + v86_regs.eip], 0xFFFF
|
||||||
jae .nogp
|
jae .nogp
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
lodsb
|
lodsb
|
||||||
@@ -403,19 +403,19 @@ v86_exc_c:
|
|||||||
; N.B. It is possible that some checks need to be corrected,
|
; N.B. It is possible that some checks need to be corrected,
|
||||||
; but at least in case of normal execution the code works.
|
; but at least in case of normal execution the code works.
|
||||||
.simulate_int:
|
.simulate_int:
|
||||||
cmp word [esp+v86_regs.esp], 6
|
cmp word [esp + v86_regs.esp], 6
|
||||||
jae @f
|
jae @f
|
||||||
mov bl, 12 ; #SS exception
|
mov bl, 12 ; #SS exception
|
||||||
jmp .nogp
|
jmp .nogp
|
||||||
@@:
|
@@:
|
||||||
movzx edx, word [esp+v86_regs.ss]
|
movzx edx, word [esp + v86_regs.ss]
|
||||||
shl edx, 4
|
shl edx, 4
|
||||||
push eax
|
push eax
|
||||||
movzx eax, word [esp+4+v86_regs.esp]
|
movzx eax, word [esp + 4 + v86_regs.esp]
|
||||||
sub eax, 6
|
sub eax, 6
|
||||||
add edx, eax
|
add edx, eax
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
mov esi, [esp+4+sizeof.v86_regs+10h+4]
|
mov esi, [esp + 4 + sizeof.v86_regs + 10h+4]
|
||||||
call v86_get_lin_addr
|
call v86_get_lin_addr
|
||||||
cmp eax, 0x1000
|
cmp eax, 0x1000
|
||||||
jae @f
|
jae @f
|
||||||
@@ -437,33 +437,33 @@ v86_exc_c:
|
|||||||
inc eax
|
inc eax
|
||||||
@@:
|
@@:
|
||||||
mov word [edx], ax
|
mov word [edx], ax
|
||||||
mov eax, [esp+4+v86_regs.cs]
|
mov eax, [esp + 4 + v86_regs.cs]
|
||||||
mov word [edx+2], ax
|
mov word [edx+2], ax
|
||||||
mov eax, [esp+4+v86_regs.eflags]
|
mov eax, [esp + 4 + v86_regs.eflags]
|
||||||
mov word [edx+4], ax
|
mov word [edx+4], ax
|
||||||
pop eax
|
pop eax
|
||||||
mov ah, 0
|
mov ah, 0
|
||||||
mov cx, [eax*4]
|
mov cx, [eax*4]
|
||||||
mov word [esp+v86_regs.eip], cx
|
mov word [esp + v86_regs.eip], cx
|
||||||
mov cx, [eax*4+2]
|
mov cx, [eax*4+2]
|
||||||
mov word [esp+v86_regs.cs], cx
|
mov word [esp + v86_regs.cs], cx
|
||||||
; note that interrupts will be disabled globally at IRET
|
; note that interrupts will be disabled globally at IRET
|
||||||
and byte [esp+v86_regs.eflags+1], not 3 ; clear IF and TF flags
|
and byte [esp + v86_regs.eflags+1], not 3 ; clear IF and TF flags
|
||||||
; continue V86 execution
|
; continue V86 execution
|
||||||
popad
|
popad
|
||||||
iretd
|
iretd
|
||||||
.handle_iret:
|
.handle_iret:
|
||||||
cmp word [esp+v86_regs.esp], 0x10000 - 6
|
cmp word [esp + v86_regs.esp], 0x10000 - 6
|
||||||
jbe @f
|
jbe @f
|
||||||
mov bl, 12
|
mov bl, 12
|
||||||
jmp .nogp
|
jmp .nogp
|
||||||
@@:
|
@@:
|
||||||
movzx edx, word [esp+v86_regs.ss]
|
movzx edx, word [esp + v86_regs.ss]
|
||||||
shl edx, 4
|
shl edx, 4
|
||||||
movzx eax, word [esp+v86_regs.esp]
|
movzx eax, word [esp + v86_regs.esp]
|
||||||
add edx, eax
|
add edx, eax
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
mov esi, [esp+sizeof.v86_regs+10h+4]
|
mov esi, [esp + sizeof.v86_regs + 10h+4]
|
||||||
call v86_get_lin_addr
|
call v86_get_lin_addr
|
||||||
cmp eax, 0x1000
|
cmp eax, 0x1000
|
||||||
jae @f
|
jae @f
|
||||||
@@ -478,28 +478,28 @@ v86_exc_c:
|
|||||||
jmp .nogp
|
jmp .nogp
|
||||||
@@:
|
@@:
|
||||||
mov ax, [edx]
|
mov ax, [edx]
|
||||||
mov word [esp+v86_regs.eip], ax
|
mov word [esp + v86_regs.eip], ax
|
||||||
mov ax, [edx+2]
|
mov ax, [edx+2]
|
||||||
mov word [esp+v86_regs.cs], ax
|
mov word [esp + v86_regs.cs], ax
|
||||||
mov ax, [edx+4]
|
mov ax, [edx+4]
|
||||||
mov word [esp+v86_regs.eflags], ax
|
mov word [esp + v86_regs.eflags], ax
|
||||||
add word [esp+v86_regs.esp], 6
|
add word [esp + v86_regs.esp], 6
|
||||||
popad
|
popad
|
||||||
iretd
|
iretd
|
||||||
.handle_pushf:
|
.handle_pushf:
|
||||||
cmp word [esp+v86_regs.esp], 1
|
cmp word [esp + v86_regs.esp], 1
|
||||||
jnz @f
|
jnz @f
|
||||||
mov bl, 12
|
mov bl, 12
|
||||||
jmp .nogp
|
jmp .nogp
|
||||||
@@:
|
@@:
|
||||||
movzx edx, word [esp+v86_regs.ss]
|
movzx edx, word [esp + v86_regs.ss]
|
||||||
shl edx, 4
|
shl edx, 4
|
||||||
mov eax, [esp+v86_regs.esp]
|
mov eax, [esp + v86_regs.esp]
|
||||||
sub eax, 2
|
sub eax, 2
|
||||||
movzx eax, ax
|
movzx eax, ax
|
||||||
add edx, eax
|
add edx, eax
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
mov esi, [esp+sizeof.v86_regs+10h+4]
|
mov esi, [esp + sizeof.v86_regs + 10h+4]
|
||||||
call v86_get_lin_addr
|
call v86_get_lin_addr
|
||||||
cmp eax, 0x1000
|
cmp eax, 0x1000
|
||||||
jae @f
|
jae @f
|
||||||
@@ -513,25 +513,25 @@ v86_exc_c:
|
|||||||
mov bl, 14
|
mov bl, 14
|
||||||
jmp .nogp
|
jmp .nogp
|
||||||
@@:
|
@@:
|
||||||
sub word [esp+v86_regs.esp], 2
|
sub word [esp + v86_regs.esp], 2
|
||||||
mov eax, [esp+v86_regs.eflags]
|
mov eax, [esp + v86_regs.eflags]
|
||||||
mov [edx], ax
|
mov [edx], ax
|
||||||
inc word [esp+v86_regs.eip]
|
inc word [esp + v86_regs.eip]
|
||||||
popad
|
popad
|
||||||
iretd
|
iretd
|
||||||
.handle_pushfd:
|
.handle_pushfd:
|
||||||
cmp word [esp+v86_regs.esp], 4
|
cmp word [esp + v86_regs.esp], 4
|
||||||
jae @f
|
jae @f
|
||||||
mov bl, 12 ; #SS exception
|
mov bl, 12 ; #SS exception
|
||||||
jmp .nogp
|
jmp .nogp
|
||||||
@@:
|
@@:
|
||||||
movzx edx, word [esp+v86_regs.ss]
|
movzx edx, word [esp + v86_regs.ss]
|
||||||
shl edx, 4
|
shl edx, 4
|
||||||
movzx eax, word [esp+v86_regs.esp]
|
movzx eax, word [esp + v86_regs.esp]
|
||||||
sub eax, 4
|
sub eax, 4
|
||||||
add edx, eax
|
add edx, eax
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
mov esi, [esp+sizeof.v86_regs+10h+4]
|
mov esi, [esp + sizeof.v86_regs + 10h+4]
|
||||||
call v86_get_lin_addr
|
call v86_get_lin_addr
|
||||||
cmp eax, 0x1000
|
cmp eax, 0x1000
|
||||||
jae @f
|
jae @f
|
||||||
@@ -545,24 +545,24 @@ v86_exc_c:
|
|||||||
mov bl, 14 ; #PF exception
|
mov bl, 14 ; #PF exception
|
||||||
jmp .nogp
|
jmp .nogp
|
||||||
@@:
|
@@:
|
||||||
sub word [esp+v86_regs.esp], 4
|
sub word [esp + v86_regs.esp], 4
|
||||||
movzx eax, word [esp+v86_regs.eflags]
|
movzx eax, word [esp + v86_regs.eflags]
|
||||||
mov [edx], eax
|
mov [edx], eax
|
||||||
add word [esp+v86_regs.eip], 2
|
add word [esp + v86_regs.eip], 2
|
||||||
popad
|
popad
|
||||||
iretd
|
iretd
|
||||||
.handle_popf:
|
.handle_popf:
|
||||||
cmp word [esp+v86_regs.esp], 0xFFFF
|
cmp word [esp + v86_regs.esp], 0xFFFF
|
||||||
jnz @f
|
jnz @f
|
||||||
mov bl, 12
|
mov bl, 12
|
||||||
jmp .nogp
|
jmp .nogp
|
||||||
@@:
|
@@:
|
||||||
movzx edx, word [esp+v86_regs.ss]
|
movzx edx, word [esp + v86_regs.ss]
|
||||||
shl edx, 4
|
shl edx, 4
|
||||||
movzx eax, word [esp+v86_regs.esp]
|
movzx eax, word [esp + v86_regs.esp]
|
||||||
add edx, eax
|
add edx, eax
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
mov esi, [esp+sizeof.v86_regs+10h+4]
|
mov esi, [esp + sizeof.v86_regs+10h+4]
|
||||||
call v86_get_lin_addr
|
call v86_get_lin_addr
|
||||||
cmp eax, 0x1000
|
cmp eax, 0x1000
|
||||||
jae @f
|
jae @f
|
||||||
@@ -577,23 +577,23 @@ v86_exc_c:
|
|||||||
jmp .nogp
|
jmp .nogp
|
||||||
@@:
|
@@:
|
||||||
mov ax, [edx]
|
mov ax, [edx]
|
||||||
mov word [esp+v86_regs.eflags], ax
|
mov word [esp + v86_regs.eflags], ax
|
||||||
add word [esp+v86_regs.esp], 2
|
add word [esp + v86_regs.esp], 2
|
||||||
inc word [esp+v86_regs.eip]
|
inc word [esp + v86_regs.eip]
|
||||||
popad
|
popad
|
||||||
iretd
|
iretd
|
||||||
.handle_popfd:
|
.handle_popfd:
|
||||||
cmp word [esp+v86_regs.esp], 0x10000 - 4
|
cmp word [esp + v86_regs.esp], 0x10000 - 4
|
||||||
jbe @f
|
jbe @f
|
||||||
mov bl, 12
|
mov bl, 12
|
||||||
jmp .nogp
|
jmp .nogp
|
||||||
@@:
|
@@:
|
||||||
movzx edx, word [esp+v86_regs.ss]
|
movzx edx, word [esp + v86_regs.ss]
|
||||||
shl edx, 4
|
shl edx, 4
|
||||||
movzx eax, word [esp+v86_regs.esp]
|
movzx eax, word [esp + v86_regs.esp]
|
||||||
add edx, eax
|
add edx, eax
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
mov esi, [esp+sizeof.v86_regs+10h+4]
|
mov esi, [esp + sizeof.v86_regs + 10h+4]
|
||||||
call v86_get_lin_addr
|
call v86_get_lin_addr
|
||||||
cmp eax, 0x1000
|
cmp eax, 0x1000
|
||||||
jae @f
|
jae @f
|
||||||
@@ -608,23 +608,23 @@ v86_exc_c:
|
|||||||
jmp .nogp
|
jmp .nogp
|
||||||
@@:
|
@@:
|
||||||
mov eax, [edx]
|
mov eax, [edx]
|
||||||
mov word [esp+v86_regs.eflags], ax
|
mov word [esp + v86_regs.eflags], ax
|
||||||
add word [esp+v86_regs.esp], 4
|
add word [esp + v86_regs.esp], 4
|
||||||
add word [esp+v86_regs.eip], 2
|
add word [esp + v86_regs.eip], 2
|
||||||
popad
|
popad
|
||||||
iretd
|
iretd
|
||||||
.handle_cli:
|
.handle_cli:
|
||||||
and byte [esp+v86_regs.eflags+1], not 2
|
and byte [esp + v86_regs.eflags+1], not 2
|
||||||
inc word [esp+v86_regs.eip]
|
inc word [esp + v86_regs.eip]
|
||||||
popad
|
popad
|
||||||
iretd
|
iretd
|
||||||
.handle_sti:
|
.handle_sti:
|
||||||
or byte [esp+v86_regs.eflags+1], 2
|
or byte [esp + v86_regs.eflags+1], 2
|
||||||
inc word [esp+v86_regs.eip]
|
inc word [esp + v86_regs.eip]
|
||||||
popad
|
popad
|
||||||
iretd
|
iretd
|
||||||
.handle_rep:
|
.handle_rep:
|
||||||
cmp word [esp+v86_regs.eip], 0xFFFF
|
cmp word [esp + v86_regs.eip], 0xFFFF
|
||||||
jae .nogp
|
jae .nogp
|
||||||
lodsb
|
lodsb
|
||||||
cmp al, 6Eh
|
cmp al, 6Eh
|
||||||
@@ -634,19 +634,19 @@ v86_exc_c:
|
|||||||
.handle_in:
|
.handle_in:
|
||||||
.handle_out:
|
.handle_out:
|
||||||
.invalid_io_byte:
|
.invalid_io_byte:
|
||||||
movzx ebx, word [esp+v86_regs.edx]
|
movzx ebx, word [esp + v86_regs.edx]
|
||||||
mov ecx, 1
|
mov ecx, 1
|
||||||
jmp .invalid_io
|
jmp .invalid_io
|
||||||
.handle_in_imm:
|
.handle_in_imm:
|
||||||
.handle_out_imm:
|
.handle_out_imm:
|
||||||
cmp word [esp+v86_regs.eip], 0xFFFF
|
cmp word [esp + v86_regs.eip], 0xFFFF
|
||||||
jae .nogp
|
jae .nogp
|
||||||
lodsb
|
lodsb
|
||||||
movzx ebx, al
|
movzx ebx, al
|
||||||
mov ecx, 1
|
mov ecx, 1
|
||||||
jmp .invalid_io
|
jmp .invalid_io
|
||||||
.handle_66:
|
.handle_66:
|
||||||
cmp word [esp+v86_regs.eip], 0xFFFF
|
cmp word [esp + v86_regs.eip], 0xFFFF
|
||||||
jae .nogp
|
jae .nogp
|
||||||
lodsb
|
lodsb
|
||||||
cmp al, 0x9C
|
cmp al, 0x9C
|
||||||
@@ -660,13 +660,13 @@ v86_exc_c:
|
|||||||
jmp .nogp
|
jmp .nogp
|
||||||
.handle_in_word:
|
.handle_in_word:
|
||||||
.handle_out_word:
|
.handle_out_word:
|
||||||
movzx ebx, word [esp+v86_regs.edx]
|
movzx ebx, word [esp + v86_regs.edx]
|
||||||
mov ecx, 2
|
mov ecx, 2
|
||||||
jmp .invalid_io
|
jmp .invalid_io
|
||||||
.handle_in_dword:
|
.handle_in_dword:
|
||||||
.handle_out_dword:
|
.handle_out_dword:
|
||||||
.invalid_io_dword:
|
.invalid_io_dword:
|
||||||
movzx ebx, word [esp+v86_regs.edx]
|
movzx ebx, word [esp + v86_regs.edx]
|
||||||
mov ecx, 4
|
mov ecx, 4
|
||||||
.invalid_io:
|
.invalid_io:
|
||||||
mov esi, v86_io_str1
|
mov esi, v86_io_str1
|
||||||
@@ -686,8 +686,8 @@ if DEBUG_SHOW_IO
|
|||||||
mov edx, ebx
|
mov edx, ebx
|
||||||
mov ebx, 200
|
mov ebx, 200
|
||||||
call delay_hs
|
call delay_hs
|
||||||
mov esi, [esp+v86_regs.size+10h+4]
|
mov esi, [esp + v86_regs.size + 10h+4]
|
||||||
mov eax, [esi+V86_machine.iopm]
|
mov eax, [esi + V86_machine.iopm]
|
||||||
@@:
|
@@:
|
||||||
btr [eax], edx
|
btr [eax], edx
|
||||||
inc edx
|
inc edx
|
||||||
@@ -719,12 +719,12 @@ end if
|
|||||||
shl edx, 4
|
shl edx, 4
|
||||||
add edx, [esp+32]
|
add edx, [esp+32]
|
||||||
@@:
|
@@:
|
||||||
mov esi, [esp+sizeof.v86_regs+10h+4]
|
mov esi, [esp+sizeof.v86_regs + 10h+4]
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
call v86_get_lin_addr
|
call v86_get_lin_addr
|
||||||
cmp eax, 0x1000
|
cmp eax, 0x1000
|
||||||
jb .nopage
|
jb .nopage
|
||||||
mov esi, v86_exc_str3-2
|
mov esi, v86_exc_str3 - 2
|
||||||
call sys_msg_board_str
|
call sys_msg_board_str
|
||||||
mov al, [edx]
|
mov al, [edx]
|
||||||
call sys_msg_board_byte
|
call sys_msg_board_byte
|
||||||
@@ -744,19 +744,19 @@ end if
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
|
|
||||||
.exit:
|
.exit:
|
||||||
mov [esp+sizeof.v86_regs+10h+1Ch], eax
|
mov [esp + sizeof.v86_regs + 10h+1Ch], eax
|
||||||
mov [esp+sizeof.v86_regs+10h+18h], ebx
|
mov [esp + sizeof.v86_regs + 10h+18h], ebx
|
||||||
|
|
||||||
mov edx, [esp+sizeof.v86_regs+10h+14h]
|
mov edx, [esp + sizeof.v86_regs + 10h+14h]
|
||||||
cmp edx, -1
|
cmp edx, -1
|
||||||
jz @f
|
jz @f
|
||||||
dec [v86_irqhooks+edx*8+4]
|
dec [v86_irqhooks + edx*8 + 4]
|
||||||
jnz @f
|
jnz @f
|
||||||
and [v86_irqhooks+edx*8], 0
|
and [v86_irqhooks + edx*8], 0
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
mov esi, esp
|
mov esi, esp
|
||||||
mov edi, [esi+sizeof.v86_regs+10h+10h]
|
mov edi, [esi + sizeof.v86_regs + 10h+10h]
|
||||||
add edi, sizeof.v86_regs
|
add edi, sizeof.v86_regs
|
||||||
mov ecx, sizeof.v86_regs/4
|
mov ecx, sizeof.v86_regs/4
|
||||||
rep movsd
|
rep movsd
|
||||||
@@ -766,16 +766,16 @@ end if
|
|||||||
mov ecx, [current_slot]
|
mov ecx, [current_slot]
|
||||||
pop eax
|
pop eax
|
||||||
|
|
||||||
mov [ecx+APPDATA.saved_esp0], eax
|
mov [ecx + APPDATA.saved_esp0], eax
|
||||||
mov [tss._esp0], eax
|
mov [tss._esp0], eax
|
||||||
pop eax
|
pop eax
|
||||||
mov [ecx+APPDATA.process], eax
|
mov [ecx + APPDATA.process], eax
|
||||||
mov [current_process], eax
|
mov [current_process], eax
|
||||||
pop ebx
|
pop ebx
|
||||||
mov dword [ecx+APPDATA.io_map+4], ebx
|
mov dword [ecx + APPDATA.io_map+4], ebx
|
||||||
mov dword [page_tabs + (tss._io_map_1 shr 10)], ebx
|
mov dword [page_tabs + (tss._io_map_1 shr 10)], ebx
|
||||||
pop ebx
|
pop ebx
|
||||||
mov dword [ecx+APPDATA.io_map], ebx
|
mov dword [ecx + APPDATA.io_map], ebx
|
||||||
mov dword [page_tabs + (tss._io_map_0 shr 10)], ebx
|
mov dword [page_tabs + (tss._io_map_0 shr 10)], ebx
|
||||||
mov eax, [eax+PROC.pdt_0_phys]
|
mov eax, [eax+PROC.pdt_0_phys]
|
||||||
mov cr3, eax
|
mov cr3, eax
|
||||||
@@ -816,7 +816,7 @@ align 4
|
|||||||
v86_irq:
|
v86_irq:
|
||||||
; push irq/pushad/jmp v86_irq
|
; push irq/pushad/jmp v86_irq
|
||||||
; ebp = irq
|
; ebp = irq
|
||||||
lea esi, [esp+1Ch]
|
lea esi, [esp + 1Ch]
|
||||||
lea edi, [esi+4]
|
lea edi, [esi+4]
|
||||||
mov ecx, 8
|
mov ecx, 8
|
||||||
std
|
std
|
||||||
@@ -825,11 +825,11 @@ v86_irq:
|
|||||||
mov edi, ebp
|
mov edi, ebp
|
||||||
pop eax
|
pop eax
|
||||||
v86_irq2:
|
v86_irq2:
|
||||||
mov esi, [v86_irqhooks+edi*8] ; get VM handle
|
mov esi, [v86_irqhooks + edi*8] ; get VM handle
|
||||||
mov eax, [esi+V86_machine.process]
|
mov eax, [esi + V86_machine.process]
|
||||||
mov ecx, [current_slot_idx]
|
mov ecx, [current_slot_idx]
|
||||||
shl ecx, 8
|
shl ecx, BSF sizeof.APPDATA
|
||||||
cmp [SLOT_BASE+ecx+APPDATA.process], eax
|
cmp [SLOT_BASE + ecx + APPDATA.process], eax
|
||||||
jnz .notcurrent
|
jnz .notcurrent
|
||||||
lea eax, [edi+8]
|
lea eax, [edi+8]
|
||||||
cmp al, 10h
|
cmp al, 10h
|
||||||
@@ -839,19 +839,19 @@ v86_irq2:
|
|||||||
@@:
|
@@:
|
||||||
jmp v86_exc_c.simulate_int
|
jmp v86_exc_c.simulate_int
|
||||||
.notcurrent:
|
.notcurrent:
|
||||||
mov ebx, SLOT_BASE + 0x100
|
mov ebx, SLOT_BASE + sizeof.APPDATA
|
||||||
mov ecx, [thread_count]
|
mov ecx, [thread_count]
|
||||||
.scan:
|
.scan:
|
||||||
cmp [ebx+APPDATA.process], eax
|
cmp [ebx + APPDATA.process], eax
|
||||||
jnz .cont
|
jnz .cont
|
||||||
push ecx
|
push ecx
|
||||||
mov ecx, [ebx+APPDATA.saved_esp0]
|
mov ecx, [ebx + APPDATA.saved_esp0]
|
||||||
cmp word [ecx-sizeof.v86_regs+v86_regs.esp], 6
|
cmp word [ecx - sizeof.v86_regs + v86_regs.esp], 6
|
||||||
jb .cont2
|
jb .cont2
|
||||||
movzx edx, word [ecx-sizeof.v86_regs+v86_regs.ss]
|
movzx edx, word [ecx - sizeof.v86_regs + v86_regs.ss]
|
||||||
shl edx, 4
|
shl edx, 4
|
||||||
push eax
|
push eax
|
||||||
movzx eax, word [ecx-sizeof.v86_regs+v86_regs.esp]
|
movzx eax, word [ecx - sizeof.v86_regs + v86_regs.esp]
|
||||||
sub eax, 6
|
sub eax, 6
|
||||||
add edx, eax
|
add edx, eax
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
@@ -877,15 +877,15 @@ v86_irq2:
|
|||||||
popad
|
popad
|
||||||
iretd
|
iretd
|
||||||
.found:
|
.found:
|
||||||
mov eax, [eax+PROC.pdt_0_phys]
|
mov eax, [eax + PROC.pdt_0_phys]
|
||||||
mov cr3, eax
|
mov cr3, eax
|
||||||
mov esi, [ebx+APPDATA.saved_esp0]
|
mov esi, [ebx + APPDATA.saved_esp0]
|
||||||
sub word [esi-sizeof.v86_regs+v86_regs.esp], 6
|
sub word [esi - sizeof.v86_regs + v86_regs.esp], 6
|
||||||
mov ecx, [esi-sizeof.v86_regs+v86_regs.eip]
|
mov ecx, [esi - sizeof.v86_regs + v86_regs.eip]
|
||||||
mov word [edx], cx
|
mov word [edx], cx
|
||||||
mov ecx, [esi-sizeof.v86_regs+v86_regs.cs]
|
mov ecx, [esi - sizeof.v86_regs + v86_regs.cs]
|
||||||
mov word [edx+2], cx
|
mov word [edx+2], cx
|
||||||
mov ecx, [esi-sizeof.v86_regs+v86_regs.eflags]
|
mov ecx, [esi - sizeof.v86_regs + v86_regs.eflags]
|
||||||
mov word [edx+4], cx
|
mov word [edx+4], cx
|
||||||
lea eax, [edi+8]
|
lea eax, [edi+8]
|
||||||
cmp al, 10h
|
cmp al, 10h
|
||||||
@@ -893,10 +893,10 @@ v86_irq2:
|
|||||||
add al, 60h
|
add al, 60h
|
||||||
@@:
|
@@:
|
||||||
mov cx, [eax*4]
|
mov cx, [eax*4]
|
||||||
mov word [esi-sizeof.v86_regs+v86_regs.eip], cx
|
mov word [esi - sizeof.v86_regs + v86_regs.eip], cx
|
||||||
mov cx, [eax*4+2]
|
mov cx, [eax*4+2]
|
||||||
mov word [esi-sizeof.v86_regs+v86_regs.cs], cx
|
mov word [esi - sizeof.v86_regs + v86_regs.cs], cx
|
||||||
and byte [esi-sizeof.v86_regs+v86_regs.eflags+1], not 3
|
and byte [esi - sizeof.v86_regs + v86_regs.eflags + 1], not 3
|
||||||
call update_counters
|
call update_counters
|
||||||
call find_next_task.found
|
call find_next_task.found
|
||||||
call do_change_task
|
call do_change_task
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2017. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License. ;;
|
;; Distributed under terms of the GNU General Public License. ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2013-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2013-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2013-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2013-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -167,7 +167,7 @@ DestroyEvent:
|
|||||||
WaitEvent:
|
WaitEvent:
|
||||||
Бесконечно ожидает установки флага EVENT_SIGNALED в конкретном событии, принадлежащем
|
Бесконечно ожидает установки флага EVENT_SIGNALED в конкретном событии, принадлежащем
|
||||||
вызывающему WaitEvent потоку. Сигнализирующий поток устанавливат этот флаг через
|
вызывающему WaitEvent потоку. Сигнализирующий поток устанавливат этот флаг через
|
||||||
RaiseEvent. Ожидающий поток замораживается путем перевода TASKDATA.state<=TSTATE_WAITING=5.
|
RaiseEvent. Ожидающий поток замораживается путем перевода APPDATA.state<=TSTATE_WAITING=5.
|
||||||
Перед заморозкой устанавливается флаг EVENT_WATCHED в событии.
|
Перед заморозкой устанавливается флаг EVENT_WATCHED в событии.
|
||||||
Если в полученном событии НЕ установлен MANUAL_RESET, то:
|
Если в полученном событии НЕ установлен MANUAL_RESET, то:
|
||||||
{EVENT_SIGNALED и EVENT_WATCHED по получении события сбрасываются.
|
{EVENT_SIGNALED и EVENT_WATCHED по получении события сбрасываются.
|
||||||
@@ -182,7 +182,7 @@ WaitEvent:
|
|||||||
WaitEventTimeout:
|
WaitEventTimeout:
|
||||||
Ожидает с таймаутом установки флага EVENT_SIGNALED в конкретном событии, принадлежащем
|
Ожидает с таймаутом установки флага EVENT_SIGNALED в конкретном событии, принадлежащем
|
||||||
вызывающему WaitEventTimeout потоку. Сигнализирующий поток устанавливат этот флаг через
|
вызывающему WaitEventTimeout потоку. Сигнализирующий поток устанавливат этот флаг через
|
||||||
RaiseEvent. Ожидающий поток замораживается путем перевода TASKDATA.state<=TSTATE_WAITING=5.
|
RaiseEvent. Ожидающий поток замораживается путем перевода APPDATA.state<=TSTATE_WAITING=5.
|
||||||
Перед заморозкой устанавливается флаг EVENT_WATCHED в событии.
|
Перед заморозкой устанавливается флаг EVENT_WATCHED в событии.
|
||||||
Если в полученном событии НЕ установлен MANUAL_RESET, то:
|
Если в полученном событии НЕ установлен MANUAL_RESET, то:
|
||||||
{EVENT_SIGNALED и EVENT_WATCHED по получении события сбрасываются.
|
{EVENT_SIGNALED и EVENT_WATCHED по получении события сбрасываются.
|
||||||
@@ -216,7 +216,7 @@ GetEvent:
|
|||||||
--------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------
|
||||||
Ф 68.14 для приложений: ;это тот же GetEvent, но с обёрткой.
|
Ф 68.14 для приложений: ;это тот же GetEvent, но с обёрткой.
|
||||||
Бесконечно ожидает любое событие в очереди событий текущего потока. Ожидающий поток
|
Бесконечно ожидает любое событие в очереди событий текущего потока. Ожидающий поток
|
||||||
замораживается путем перевода TASKDATA.state<=TSTATE_WAITING=5. Данные события (EVENT.code+5*dword)
|
замораживается путем перевода APPDATA.state<=TSTATE_WAITING=5. Данные события (EVENT.code+5*dword)
|
||||||
копируются в указанный буфер. Сбрасывает байт приоритета (см. выше) в буфере.
|
копируются в указанный буфер. Сбрасывает байт приоритета (см. выше) в буфере.
|
||||||
Принимает:
|
Принимает:
|
||||||
eax - 68 - номер функции
|
eax - 68 - номер функции
|
||||||
|
@@ -176,7 +176,7 @@ DestroyEvent:
|
|||||||
WaitEvent:
|
WaitEvent:
|
||||||
Wait infinitely until flag EVENT_SIGNALED is set in the event owned by
|
Wait infinitely until flag EVENT_SIGNALED is set in the event owned by
|
||||||
the caller thread. This flag is set by signaling thread via RaiseEvent.
|
the caller thread. This flag is set by signaling thread via RaiseEvent.
|
||||||
Waiting thread is frozen by setting TASKDATA.state <= TSTATE_WAITING=5.
|
Waiting thread is frozen by setting APPDATA.state <= TSTATE_WAITING=5.
|
||||||
Flag EVENT_WATCHED is set in the event before freeze.
|
Flag EVENT_WATCHED is set in the event before freeze.
|
||||||
If flag MANUAL_RESET is NOT set in the event then:
|
If flag MANUAL_RESET is NOT set in the event then:
|
||||||
EVENT_SIGNALED and EVENT_WATCHED are reset when the event is
|
EVENT_SIGNALED and EVENT_WATCHED are reset when the event is
|
||||||
@@ -193,7 +193,7 @@ WaitEvent:
|
|||||||
WaitEventTimeout:
|
WaitEventTimeout:
|
||||||
Wait with a timeout until flag EVENT_SIGNALED is set in the event owned
|
Wait with a timeout until flag EVENT_SIGNALED is set in the event owned
|
||||||
by caller thread. This flag is set by signaling thread via RaiseEvent.
|
by caller thread. This flag is set by signaling thread via RaiseEvent.
|
||||||
Waiting thread is frozen by setting TASKDATA.state <= TSTATE_WAITING=5.
|
Waiting thread is frozen by setting APPDATA.state <= TSTATE_WAITING=5.
|
||||||
Flag EVENT_WATCHED is set in the event before freeze.
|
Flag EVENT_WATCHED is set in the event before freeze.
|
||||||
If flag MANUAL_RESET is NOT set in the event then:
|
If flag MANUAL_RESET is NOT set in the event then:
|
||||||
EVENT_SIGNALED and EVENT_WATCHED are reset when the event is
|
EVENT_SIGNALED and EVENT_WATCHED are reset when the event is
|
||||||
@@ -212,7 +212,7 @@ WaitEventTimeout:
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
GetEvent:
|
GetEvent:
|
||||||
Waits infinitely for any event in the queue of current thread. Thread is
|
Waits infinitely for any event in the queue of current thread. Thread is
|
||||||
frozen by setting TASKDATA.state <= TSTATE_WAITING = 5. Event data
|
frozen by setting APPDATA.state <= TSTATE_WAITING = 5. Event data
|
||||||
(EVENT.code + 5*dword) are copied to specified buffer when received.
|
(EVENT.code + 5*dword) are copied to specified buffer when received.
|
||||||
Reset priority byte (see above) in the buffer.
|
Reset priority byte (see above) in the buffer.
|
||||||
If flag MANUAL_RESET is NOT set in the event then:
|
If flag MANUAL_RESET is NOT set in the event then:
|
||||||
@@ -232,7 +232,7 @@ GetEvent:
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
SysFn 68.14 for application: ; wrapped GetEvent
|
SysFn 68.14 for application: ; wrapped GetEvent
|
||||||
Waits infinitely for any event in the queue of current thread. Thread is
|
Waits infinitely for any event in the queue of current thread. Thread is
|
||||||
frozen by setting TASKDATA.state <= TSTATE_WAITING = 5. Event data
|
frozen by setting APPDATA.state <= TSTATE_WAITING = 5. Event data
|
||||||
(EVENT.code + 5*dword) are copied to specified buffer when received.
|
(EVENT.code + 5*dword) are copied to specified buffer when received.
|
||||||
Reset priority byte (see above) in the buffer.
|
Reset priority byte (see above) in the buffer.
|
||||||
Gets:
|
Gets:
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2013-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2013-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2019. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
|
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -104,9 +104,9 @@ hotkey_do_test:
|
|||||||
align 4
|
align 4
|
||||||
set_keyboard_data:
|
set_keyboard_data:
|
||||||
movzx eax, word[thread_count]; top window process
|
movzx eax, word[thread_count]; top window process
|
||||||
movzx eax, word[WIN_POS+eax*2]
|
movzx eax, word[WIN_POS + eax*2]
|
||||||
shl eax, 8
|
shl eax, 8
|
||||||
mov al, [SLOT_BASE+eax+APPDATA.keyboard_mode]
|
mov al, [SLOT_BASE + eax + APPDATA.keyboard_mode]
|
||||||
mov [keyboard_mode], al
|
mov [keyboard_mode], al
|
||||||
|
|
||||||
mov eax, ecx
|
mov eax, ecx
|
||||||
@@ -144,25 +144,25 @@ register_keyboard:
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .nothing
|
jz .nothing
|
||||||
mov ecx, [esp+4+4]
|
mov ecx, [esp+4+4]
|
||||||
mov [eax+KEYBOARD.functions], ecx
|
mov [eax + KEYBOARD.functions], ecx
|
||||||
mov ecx, [esp+8+4]
|
mov ecx, [esp+8+4]
|
||||||
mov [eax+KEYBOARD.userdata], ecx
|
mov [eax + KEYBOARD.userdata], ecx
|
||||||
xchg eax, ebx
|
xchg eax, ebx
|
||||||
mov ecx, keyboard_list_mutex
|
mov ecx, keyboard_list_mutex
|
||||||
call mutex_lock
|
call mutex_lock
|
||||||
mov ecx, keyboards
|
mov ecx, keyboards
|
||||||
mov edx, [ecx+KEYBOARD.prev]
|
mov edx, [ecx + KEYBOARD.prev]
|
||||||
mov [ebx+KEYBOARD.next], ecx
|
mov [ebx + KEYBOARD.next], ecx
|
||||||
mov [ebx+KEYBOARD.prev], edx
|
mov [ebx + KEYBOARD.prev], edx
|
||||||
mov [edx+KEYBOARD.next], ebx
|
mov [edx + KEYBOARD.next], ebx
|
||||||
mov [ecx+KEYBOARD.prev], ebx
|
mov [ecx + KEYBOARD.prev], ebx
|
||||||
mov ecx, [ebx+KEYBOARD.functions]
|
mov ecx, [ebx + KEYBOARD.functions]
|
||||||
cmp [ecx+KBDFUNC.strucsize], KBDFUNC.setlights
|
cmp [ecx + KBDFUNC.strucsize], KBDFUNC.setlights
|
||||||
jbe .unlock
|
jbe .unlock
|
||||||
mov ecx, [ecx+KBDFUNC.setlights]
|
mov ecx, [ecx + KBDFUNC.setlights]
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz .unlock
|
jz .unlock
|
||||||
stdcall ecx, [ebx+KEYBOARD.userdata], dword [kb_lights]
|
stdcall ecx, [ebx + KEYBOARD.userdata], dword [kb_lights]
|
||||||
.unlock:
|
.unlock:
|
||||||
mov ecx, keyboard_list_mutex
|
mov ecx, keyboard_list_mutex
|
||||||
call mutex_unlock
|
call mutex_unlock
|
||||||
@@ -176,18 +176,18 @@ delete_keyboard:
|
|||||||
mov ebx, [esp+4+4]
|
mov ebx, [esp+4+4]
|
||||||
mov ecx, keyboard_list_mutex
|
mov ecx, keyboard_list_mutex
|
||||||
call mutex_lock
|
call mutex_lock
|
||||||
mov eax, [ebx+KEYBOARD.next]
|
mov eax, [ebx + KEYBOARD.next]
|
||||||
mov edx, [ebx+KEYBOARD.prev]
|
mov edx, [ebx + KEYBOARD.prev]
|
||||||
mov [eax+KEYBOARD.prev], edx
|
mov [eax + KEYBOARD.prev], edx
|
||||||
mov [edx+KEYBOARD.next], eax
|
mov [edx + KEYBOARD.next], eax
|
||||||
call mutex_unlock
|
call mutex_unlock
|
||||||
mov ecx, [ebx+KEYBOARD.functions]
|
mov ecx, [ebx + KEYBOARD.functions]
|
||||||
cmp [ecx+KBDFUNC.strucsize], KBDFUNC.close
|
cmp [ecx + KBDFUNC.strucsize], KBDFUNC.close
|
||||||
jbe .nothing
|
jbe .nothing
|
||||||
mov ecx, [ecx+KBDFUNC.close]
|
mov ecx, [ecx + KBDFUNC.close]
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz .nothing
|
jz .nothing
|
||||||
stdcall ecx, [ebx+KEYBOARD.userdata]
|
stdcall ecx, [ebx + KEYBOARD.userdata]
|
||||||
.nothing:
|
.nothing:
|
||||||
pop ebx
|
pop ebx
|
||||||
ret 4
|
ret 4
|
||||||
@@ -195,9 +195,9 @@ delete_keyboard:
|
|||||||
align 4
|
align 4
|
||||||
irq1:
|
irq1:
|
||||||
movzx eax, word[thread_count]; top window process
|
movzx eax, word[thread_count]; top window process
|
||||||
movzx eax, word[WIN_POS+eax*2]
|
movzx eax, word[WIN_POS + eax*2]
|
||||||
shl eax, BSF sizeof.APPDATA
|
shl eax, BSF sizeof.APPDATA
|
||||||
mov al, [SLOT_BASE+eax+APPDATA.keyboard_mode]
|
mov al, [SLOT_BASE + eax + APPDATA.keyboard_mode]
|
||||||
mov [keyboard_mode], al
|
mov [keyboard_mode], al
|
||||||
|
|
||||||
in al, 0x60
|
in al, 0x60
|
||||||
@@ -326,7 +326,7 @@ send_scancode:
|
|||||||
js .writekey
|
js .writekey
|
||||||
|
|
||||||
movzx eax, ch ; plain key
|
movzx eax, ch ; plain key
|
||||||
mov bl, [keymap+eax]
|
mov bl, [keymap + eax]
|
||||||
mov edx, [kb_state]
|
mov edx, [kb_state]
|
||||||
test dl, VKEY_CONTROL ; ctrl alt del
|
test dl, VKEY_CONTROL ; ctrl alt del
|
||||||
jz .noctrlaltdel
|
jz .noctrlaltdel
|
||||||
@@ -357,12 +357,12 @@ send_scancode:
|
|||||||
test dl, VKEY_SHIFT ; shift on ?
|
test dl, VKEY_SHIFT ; shift on ?
|
||||||
jz @f
|
jz @f
|
||||||
.keymap_shif:
|
.keymap_shif:
|
||||||
mov bl, [keymap_shift+eax]
|
mov bl, [keymap_shift + eax]
|
||||||
@@:
|
@@:
|
||||||
test dl, VKEY_ALT ; alt on ?
|
test dl, VKEY_ALT ; alt on ?
|
||||||
jz @f
|
jz @f
|
||||||
|
|
||||||
mov bl, [keymap_alt+eax]
|
mov bl, [keymap_alt + eax]
|
||||||
@@:
|
@@:
|
||||||
jmp .writekey
|
jmp .writekey
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
@@ -510,7 +510,7 @@ send_scancode:
|
|||||||
inc eax
|
inc eax
|
||||||
mov [KEY_COUNT], al
|
mov [KEY_COUNT], al
|
||||||
; store ascii or scancode
|
; store ascii or scancode
|
||||||
mov [KEY_BUFF+eax-1], bl
|
mov [KEY_BUFF + eax -1], bl
|
||||||
; store original scancode
|
; store original scancode
|
||||||
add eax, 120+2
|
add eax, 120+2
|
||||||
push ecx
|
push ecx
|
||||||
@@ -519,7 +519,7 @@ send_scancode:
|
|||||||
|
|
||||||
xor ch, ch
|
xor ch, ch
|
||||||
@@:
|
@@:
|
||||||
mov [KEY_BUFF+eax-1], ch
|
mov [KEY_BUFF + eax -1], ch
|
||||||
pop ecx
|
pop ecx
|
||||||
sub eax, 120+2
|
sub eax, 120+2
|
||||||
.exit.irq1:
|
.exit.irq1:
|
||||||
@@ -531,16 +531,16 @@ set_lights:
|
|||||||
call mutex_lock
|
call mutex_lock
|
||||||
mov esi, keyboards
|
mov esi, keyboards
|
||||||
.loop:
|
.loop:
|
||||||
mov esi, [esi+KEYBOARD.next]
|
mov esi, [esi + KEYBOARD.next]
|
||||||
cmp esi, keyboards
|
cmp esi, keyboards
|
||||||
jz .done
|
jz .done
|
||||||
mov eax, [esi+KEYBOARD.functions]
|
mov eax, [esi + KEYBOARD.functions]
|
||||||
cmp dword [eax], KBDFUNC.setlights
|
cmp dword [eax], KBDFUNC.setlights
|
||||||
jbe .loop
|
jbe .loop
|
||||||
mov eax, [eax+KBDFUNC.setlights]
|
mov eax, [eax + KBDFUNC.setlights]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .loop
|
jz .loop
|
||||||
stdcall eax, [esi+KEYBOARD.userdata], dword [kb_lights]
|
stdcall eax, [esi + KEYBOARD.userdata], dword [kb_lights]
|
||||||
jmp .loop
|
jmp .loop
|
||||||
.done:
|
.done:
|
||||||
mov ecx, keyboard_list_mutex
|
mov ecx, keyboard_list_mutex
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -115,15 +115,15 @@ save_draw_mouse:
|
|||||||
mov eax, [d_width_calc_area + eax*4]
|
mov eax, [d_width_calc_area + eax*4]
|
||||||
|
|
||||||
add eax, [_display.win_map]
|
add eax, [_display.win_map]
|
||||||
movzx edx, byte [ebx+eax]
|
movzx edx, byte [ebx + eax]
|
||||||
shl edx, 8
|
shl edx, BSF sizeof.APPDATA
|
||||||
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
|
mov esi, [SLOT_BASE + edx + APPDATA.cursor]
|
||||||
|
|
||||||
cmp esi, [current_cursor]
|
cmp esi, [current_cursor]
|
||||||
je .draw
|
je .draw
|
||||||
|
|
||||||
mov eax, [thread_count]
|
mov eax, [thread_count]
|
||||||
movzx eax, word [WIN_POS+eax*2]
|
movzx eax, word [WIN_POS + eax*2]
|
||||||
shl eax, 8
|
shl eax, 8
|
||||||
|
|
||||||
cmp eax, edx
|
cmp eax, edx
|
||||||
@@ -461,13 +461,13 @@ redrawmouse:
|
|||||||
mov esi, [current_cursor]
|
mov esi, [current_cursor]
|
||||||
|
|
||||||
mov ax, [Y_UNDER]
|
mov ax, [Y_UNDER]
|
||||||
sub eax, [esi+CURSOR.hot_y]
|
sub eax, [esi + CURSOR.hot_y]
|
||||||
mov [Y_UNDER_subtraction_CUR_hot_y], ax
|
mov [Y_UNDER_subtraction_CUR_hot_y], ax
|
||||||
add eax, [cur.h]
|
add eax, [cur.h]
|
||||||
mov [Y_UNDER_sub_CUR_hot_y_add_curh], ax
|
mov [Y_UNDER_sub_CUR_hot_y_add_curh], ax
|
||||||
|
|
||||||
mov ax, [X_UNDER]
|
mov ax, [X_UNDER]
|
||||||
sub eax, [esi+CURSOR.hot_x]
|
sub eax, [esi + CURSOR.hot_x]
|
||||||
mov [X_UNDER_subtraction_CUR_hot_x], ax
|
mov [X_UNDER_subtraction_CUR_hot_x], ax
|
||||||
add eax, [cur.w]
|
add eax, [cur.w]
|
||||||
mov [X_UNDER_sub_CUR_hot_x_add_curh], ax
|
mov [X_UNDER_sub_CUR_hot_x_add_curh], ax
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2020. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -14,7 +14,7 @@ proc mem_test
|
|||||||
jnz .ret
|
jnz .ret
|
||||||
|
|
||||||
mov eax, cr0
|
mov eax, cr0
|
||||||
and eax, not (CR0_CD+CR0_NW)
|
and eax, not (CR0_CD + CR0_NW)
|
||||||
or eax, CR0_CD ;disable caching
|
or eax, CR0_CD ;disable caching
|
||||||
mov cr0, eax
|
mov cr0, eax
|
||||||
wbinvd ;invalidate cache
|
wbinvd ;invalidate cache
|
||||||
@@ -28,16 +28,16 @@ proc mem_test
|
|||||||
xchg ebx, dword [edi]
|
xchg ebx, dword [edi]
|
||||||
je @b
|
je @b
|
||||||
|
|
||||||
and eax, not (CR0_CD+CR0_NW) ;enable caching
|
and eax, not (CR0_CD + CR0_NW) ;enable caching
|
||||||
mov cr0, eax
|
mov cr0, eax
|
||||||
inc dword [BOOT_LO.memmap_block_cnt]
|
inc dword [BOOT_LO.memmap_block_cnt]
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [BOOT_LO.memmap_blocks+e820entry.addr.lo], eax
|
mov [BOOT_LO.memmap_blocks + e820entry.addr.lo], eax
|
||||||
mov [BOOT_LO.memmap_blocks+e820entry.addr.hi], eax
|
mov [BOOT_LO.memmap_blocks + e820entry.addr.hi], eax
|
||||||
mov [BOOT_LO.memmap_blocks+e820entry.size.lo], edi
|
mov [BOOT_LO.memmap_blocks + e820entry.size.lo], edi
|
||||||
mov [BOOT_LO.memmap_blocks+e820entry.size.hi], eax
|
mov [BOOT_LO.memmap_blocks + e820entry.size.hi], eax
|
||||||
inc eax
|
inc eax
|
||||||
mov [BOOT_LO.memmap_blocks+e820entry.type], eax
|
mov [BOOT_LO.memmap_blocks + e820entry.type], eax
|
||||||
.ret:
|
.ret:
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@@ -51,29 +51,29 @@ proc init_mem
|
|||||||
xor edx, edx; edx will hold maximum allocatable address
|
xor edx, edx; edx will hold maximum allocatable address
|
||||||
.calcmax:
|
.calcmax:
|
||||||
; round all to pages
|
; round all to pages
|
||||||
mov eax, [edi+e820entry.addr.lo]
|
mov eax, [edi + e820entry.addr.lo]
|
||||||
cmp byte [edi+e820entry.type], 1
|
cmp byte [edi + e820entry.type], 1
|
||||||
jne .unusable
|
jne .unusable
|
||||||
|
|
||||||
test eax, 0xFFF
|
test eax, 0xFFF
|
||||||
jz @f
|
jz @f
|
||||||
neg eax
|
neg eax
|
||||||
and eax, 0xFFF
|
and eax, 0xFFF
|
||||||
add [edi+e820entry.addr.lo], eax
|
add [edi + e820entry.addr.lo], eax
|
||||||
adc [edi+e820entry.addr.hi], 0
|
adc [edi + e820entry.addr.hi], 0
|
||||||
sub [edi+e820entry.size.lo], eax
|
sub [edi + e820entry.size.lo], eax
|
||||||
sbb [edi+e820entry.size.hi], 0
|
sbb [edi + e820entry.size.hi], 0
|
||||||
jc .unusable
|
jc .unusable
|
||||||
@@:
|
@@:
|
||||||
and [edi+e820entry.size.lo], not 0xFFF
|
and [edi + e820entry.size.lo], not 0xFFF
|
||||||
jz .unusable
|
jz .unusable
|
||||||
; ignore memory after 4 GiB
|
; ignore memory after 4 GiB
|
||||||
cmp [edi+e820entry.addr.hi], 0
|
cmp [edi + e820entry.addr.hi], 0
|
||||||
jnz .unusable
|
jnz .unusable
|
||||||
mov eax, [edi+e820entry.addr.lo]
|
mov eax, [edi + e820entry.addr.lo]
|
||||||
cmp [edi+e820entry.size.hi], 0
|
cmp [edi + e820entry.size.hi], 0
|
||||||
jnz .overflow
|
jnz .overflow
|
||||||
add eax, [edi+e820entry.size.lo]
|
add eax, [edi + e820entry.size.lo]
|
||||||
jnc @f
|
jnc @f
|
||||||
.overflow:
|
.overflow:
|
||||||
mov eax, 0xFFFFF000
|
mov eax, 0xFFFFF000
|
||||||
@@ -82,8 +82,8 @@ proc init_mem
|
|||||||
jae @f
|
jae @f
|
||||||
mov edx, eax
|
mov edx, eax
|
||||||
@@:
|
@@:
|
||||||
sub eax, [edi+e820entry.addr.lo]
|
sub eax, [edi + e820entry.addr.lo]
|
||||||
mov [edi+e820entry.size.lo], eax
|
mov [edi + e820entry.size.lo], eax
|
||||||
add esi, eax
|
add esi, eax
|
||||||
jmp .usable
|
jmp .usable
|
||||||
.unusable:
|
.unusable:
|
||||||
@@ -92,18 +92,18 @@ proc init_mem
|
|||||||
add edi, sizeof.e820entry
|
add edi, sizeof.e820entry
|
||||||
loop .calcmax
|
loop .calcmax
|
||||||
.calculated:
|
.calculated:
|
||||||
mov [MEM_AMOUNT-OS_BASE], esi
|
mov [MEM_AMOUNT - OS_BASE], esi
|
||||||
mov [pg_data.mem_amount-OS_BASE], esi
|
mov [pg_data.mem_amount - OS_BASE], esi
|
||||||
shr esi, 12
|
shr esi, 12
|
||||||
mov [pg_data.pages_count-OS_BASE], esi
|
mov [pg_data.pages_count - OS_BASE], esi
|
||||||
|
|
||||||
shr edx, 12
|
shr edx, 12
|
||||||
add edx, 31
|
add edx, 31
|
||||||
and edx, not 31
|
and edx, not 31
|
||||||
shr edx, 3
|
shr edx, 3
|
||||||
mov [pg_data.pagemap_size-OS_BASE], edx
|
mov [pg_data.pagemap_size - OS_BASE], edx
|
||||||
|
|
||||||
add edx, (sys_pgmap-OS_BASE)+4095
|
add edx, (sys_pgmap - OS_BASE)+4095
|
||||||
and edx, not 4095
|
and edx, not 4095
|
||||||
mov [tmp_page_tabs], edx
|
mov [tmp_page_tabs], edx
|
||||||
|
|
||||||
@@ -114,29 +114,29 @@ proc init_mem
|
|||||||
mov edx, (OS_BASE/4096)
|
mov edx, (OS_BASE/4096)
|
||||||
jmp .set
|
jmp .set
|
||||||
@@:
|
@@:
|
||||||
cmp edx, (HEAP_BASE-OS_BASE+HEAP_MIN_SIZE)/4096
|
cmp edx, (HEAP_BASE - OS_BASE + HEAP_MIN_SIZE)/4096
|
||||||
jae .set
|
jae .set
|
||||||
mov edx, (HEAP_BASE-OS_BASE+HEAP_MIN_SIZE)/4096
|
mov edx, (HEAP_BASE - OS_BASE + HEAP_MIN_SIZE)/4096
|
||||||
.set:
|
.set:
|
||||||
mov [pg_data.kernel_pages-OS_BASE], edx
|
mov [pg_data.kernel_pages - OS_BASE], edx
|
||||||
shr edx, 10
|
shr edx, 10
|
||||||
mov [pg_data.kernel_tables-OS_BASE], edx
|
mov [pg_data.kernel_tables - OS_BASE], edx
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edi, sys_proc-OS_BASE
|
mov edi, sys_proc - OS_BASE
|
||||||
mov ecx, 8192/4
|
mov ecx, 8192/4
|
||||||
cld
|
cld
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
mov edx, (sys_proc-OS_BASE+PROC.pdt_0)+ 0x800; (OS_BASE shr 20)
|
mov edx, (sys_proc - OS_BASE + PROC.pdt_0) + 0x800; (OS_BASE shr 20)
|
||||||
bt [cpu_caps-OS_BASE], CAPS_PSE
|
bt [cpu_caps - OS_BASE], CAPS_PSE
|
||||||
jnc .no_PSE
|
jnc .no_PSE
|
||||||
|
|
||||||
mov ebx, cr4
|
mov ebx, cr4
|
||||||
or ebx, CR4_PSE
|
or ebx, CR4_PSE
|
||||||
mov eax, PDE_LARGE+PG_SWR
|
mov eax, PDE_LARGE + PG_SWR
|
||||||
mov cr4, ebx
|
mov cr4, ebx
|
||||||
dec [pg_data.kernel_tables-OS_BASE]
|
dec [pg_data.kernel_tables - OS_BASE]
|
||||||
|
|
||||||
mov [edx], eax
|
mov [edx], eax
|
||||||
add edx, 4
|
add edx, 4
|
||||||
@@ -156,12 +156,12 @@ proc init_mem
|
|||||||
jnz @B
|
jnz @B
|
||||||
|
|
||||||
.map_kernel_heap:
|
.map_kernel_heap:
|
||||||
mov ecx, [pg_data.kernel_tables-OS_BASE]
|
mov ecx, [pg_data.kernel_tables - OS_BASE]
|
||||||
shl ecx, 10
|
shl ecx, 10
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
mov ecx, [pg_data.kernel_tables-OS_BASE]
|
mov ecx, [pg_data.kernel_tables - OS_BASE]
|
||||||
mov eax, [tmp_page_tabs]
|
mov eax, [tmp_page_tabs]
|
||||||
or eax, PG_SWR
|
or eax, PG_SWR
|
||||||
mov edi, edx
|
mov edi, edx
|
||||||
@@ -174,8 +174,8 @@ proc init_mem
|
|||||||
|
|
||||||
mov dword [sys_proc-OS_BASE+PROC.pdt_0+(page_tabs shr 20)], sys_proc+PROC.pdt_0+PG_SWR-OS_BASE
|
mov dword [sys_proc-OS_BASE+PROC.pdt_0+(page_tabs shr 20)], sys_proc+PROC.pdt_0+PG_SWR-OS_BASE
|
||||||
|
|
||||||
mov edi, (sys_proc+PROC.pdt_0-OS_BASE)
|
mov edi, (sys_proc + PROC.pdt_0 - OS_BASE)
|
||||||
lea esi, [edi+(OS_BASE shr 20)]
|
lea esi, [edi + (OS_BASE shr 20)]
|
||||||
movsd
|
movsd
|
||||||
movsd
|
movsd
|
||||||
ret
|
ret
|
||||||
@@ -184,8 +184,8 @@ endp
|
|||||||
align 4
|
align 4
|
||||||
proc init_page_map
|
proc init_page_map
|
||||||
; mark all memory as unavailable
|
; mark all memory as unavailable
|
||||||
mov edi, sys_pgmap-OS_BASE
|
mov edi, sys_pgmap - OS_BASE
|
||||||
mov ecx, [pg_data.pagemap_size-OS_BASE]
|
mov ecx, [pg_data.pagemap_size - OS_BASE]
|
||||||
shr ecx, 2
|
shr ecx, 2
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
cld
|
cld
|
||||||
@@ -195,18 +195,18 @@ proc init_page_map
|
|||||||
mov ebx, BOOT_LO.memmap_blocks
|
mov ebx, BOOT_LO.memmap_blocks
|
||||||
mov edx, [ebx-4]
|
mov edx, [ebx-4]
|
||||||
.scanmap:
|
.scanmap:
|
||||||
cmp byte [ebx+e820entry.type], 1
|
cmp byte [ebx + e820entry.type], 1
|
||||||
jne .next
|
jne .next
|
||||||
|
|
||||||
mov ecx, [ebx+e820entry.size.lo]
|
mov ecx, [ebx + e820entry.size.lo]
|
||||||
shr ecx, 12; ecx = number of pages
|
shr ecx, 12; ecx = number of pages
|
||||||
jz .next
|
jz .next
|
||||||
mov edi, [ebx+e820entry.addr.lo]
|
mov edi, [ebx + e820entry.addr.lo]
|
||||||
shr edi, 12; edi = first page
|
shr edi, 12; edi = first page
|
||||||
mov eax, edi
|
mov eax, edi
|
||||||
shr edi, 5
|
shr edi, 5
|
||||||
shl edi, 2
|
shl edi, 2
|
||||||
add edi, sys_pgmap-OS_BASE
|
add edi, sys_pgmap - OS_BASE
|
||||||
and eax, 31
|
and eax, 31
|
||||||
jz .startok
|
jz .startok
|
||||||
add ecx, eax
|
add ecx, eax
|
||||||
@@ -245,13 +245,13 @@ proc init_page_map
|
|||||||
|
|
||||||
; mark kernel memory as allocated (unavailable)
|
; mark kernel memory as allocated (unavailable)
|
||||||
mov ecx, [tmp_page_tabs]
|
mov ecx, [tmp_page_tabs]
|
||||||
mov edx, [pg_data.pages_count-OS_BASE]
|
mov edx, [pg_data.pages_count - OS_BASE]
|
||||||
shr ecx, 12
|
shr ecx, 12
|
||||||
add ecx, [pg_data.kernel_tables-OS_BASE]
|
add ecx, [pg_data.kernel_tables - OS_BASE]
|
||||||
sub edx, ecx
|
sub edx, ecx
|
||||||
mov [pg_data.pages_free-OS_BASE], edx
|
mov [pg_data.pages_free - OS_BASE], edx
|
||||||
|
|
||||||
mov edi, sys_pgmap-OS_BASE
|
mov edi, sys_pgmap - OS_BASE
|
||||||
mov ebx, ecx
|
mov ebx, ecx
|
||||||
shr ecx, 5
|
shr ecx, 5
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
@@ -263,11 +263,11 @@ proc init_page_map
|
|||||||
shl eax, cl
|
shl eax, cl
|
||||||
and [edi], eax
|
and [edi], eax
|
||||||
add edi, OS_BASE
|
add edi, OS_BASE
|
||||||
mov [page_start-OS_BASE], edi;
|
mov [page_start - OS_BASE], edi;
|
||||||
|
|
||||||
mov ebx, sys_pgmap
|
mov ebx, sys_pgmap
|
||||||
add ebx, [pg_data.pagemap_size-OS_BASE]
|
add ebx, [pg_data.pagemap_size - OS_BASE]
|
||||||
mov [page_end-OS_BASE], ebx
|
mov [page_end - OS_BASE], ebx
|
||||||
|
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@@ -311,24 +311,24 @@ init_BIOS32:
|
|||||||
|
|
||||||
add ebx, OS_BASE
|
add ebx, OS_BASE
|
||||||
dec ecx
|
dec ecx
|
||||||
mov [(pci_code_32-OS_BASE)], cx ;limit 0-15
|
mov [(pci_code_32 - OS_BASE)], cx ;limit 0-15
|
||||||
mov [(pci_data_32-OS_BASE)], cx ;limit 0-15
|
mov [(pci_data_32 - OS_BASE)], cx ;limit 0-15
|
||||||
|
|
||||||
mov [(pci_code_32-OS_BASE)+2], bx ;base 0-15
|
mov [(pci_code_32 - OS_BASE)+2], bx ;base 0-15
|
||||||
mov [(pci_data_32-OS_BASE)+2], bx ;base 0-15
|
mov [(pci_data_32 - OS_BASE)+2], bx ;base 0-15
|
||||||
|
|
||||||
shr ebx, 16
|
shr ebx, 16
|
||||||
mov [(pci_code_32-OS_BASE)+4], bl ;base 16-23
|
mov [(pci_code_32 - OS_BASE)+4], bl ;base 16-23
|
||||||
mov [(pci_data_32-OS_BASE)+4], bl ;base 16-23
|
mov [(pci_data_32 - OS_BASE)+4], bl ;base 16-23
|
||||||
|
|
||||||
shr ecx, 16
|
shr ecx, 16
|
||||||
and cl, 0x0F
|
and cl, 0x0F
|
||||||
mov ch, bh
|
mov ch, bh
|
||||||
add cx, D32
|
add cx, D32
|
||||||
mov [(pci_code_32-OS_BASE)+6], cx ;lim 16-19 &
|
mov [(pci_code_32 - OS_BASE)+6], cx ;lim 16-19 &
|
||||||
mov [(pci_data_32-OS_BASE)+6], cx ;base 24-31
|
mov [(pci_data_32 - OS_BASE)+6], cx ;base 24-31
|
||||||
|
|
||||||
mov [(pci_bios_entry-OS_BASE)], edx
|
mov [(pci_bios_entry - OS_BASE)], edx
|
||||||
; jmp .end
|
; jmp .end
|
||||||
.PCI_BIOS32_not_found:
|
.PCI_BIOS32_not_found:
|
||||||
; pci_emu_dat structure should be filled here
|
; pci_emu_dat structure should be filled here
|
||||||
@@ -344,9 +344,9 @@ proc test_cpu
|
|||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [cpu_type], eax
|
mov [cpu_type], eax
|
||||||
mov [cpu_caps-OS_BASE], eax
|
mov [cpu_caps - OS_BASE], eax
|
||||||
mov [cpu_caps+4-OS_BASE], eax
|
mov [cpu_caps + 4 - OS_BASE], eax
|
||||||
mov [cpu_phys_addr_width-OS_BASE], 32
|
mov [cpu_phys_addr_width - OS_BASE], 32
|
||||||
|
|
||||||
pushfd
|
pushfd
|
||||||
pop eax
|
pop eax
|
||||||
@@ -375,22 +375,22 @@ proc test_cpu
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
cpuid
|
cpuid
|
||||||
|
|
||||||
mov [cpu_vendor-OS_BASE], ebx
|
mov [cpu_vendor - OS_BASE], ebx
|
||||||
mov [cpu_vendor+4-OS_BASE], edx
|
mov [cpu_vendor + 4 - OS_BASE], edx
|
||||||
mov [cpu_vendor+8-OS_BASE], ecx
|
mov [cpu_vendor + 8 - OS_BASE], ecx
|
||||||
|
|
||||||
cmp eax, 1
|
cmp eax, 1
|
||||||
jl .end_cpuid
|
jl .end_cpuid
|
||||||
mov eax, 1
|
mov eax, 1
|
||||||
cpuid
|
cpuid
|
||||||
mov [cpu_sign-OS_BASE], eax
|
mov [cpu_sign - OS_BASE], eax
|
||||||
mov [cpu_info-OS_BASE], ebx
|
mov [cpu_info - OS_BASE], ebx
|
||||||
mov [cpu_caps-OS_BASE], edx
|
mov [cpu_caps - OS_BASE], edx
|
||||||
mov [cpu_caps+4-OS_BASE], ecx
|
mov [cpu_caps + 4 - OS_BASE], ecx
|
||||||
|
|
||||||
bt edx, CAPS_PAE
|
bt edx, CAPS_PAE
|
||||||
jnc @f
|
jnc @f
|
||||||
mov [cpu_phys_addr_width-OS_BASE], 36
|
mov [cpu_phys_addr_width - OS_BASE], 36
|
||||||
@@:
|
@@:
|
||||||
mov eax, 0x80000000
|
mov eax, 0x80000000
|
||||||
cpuid
|
cpuid
|
||||||
@@ -398,10 +398,10 @@ proc test_cpu
|
|||||||
jb @f
|
jb @f
|
||||||
mov eax, 0x80000008
|
mov eax, 0x80000008
|
||||||
cpuid
|
cpuid
|
||||||
mov [cpu_phys_addr_width-OS_BASE], al
|
mov [cpu_phys_addr_width - OS_BASE], al
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
mov eax, [cpu_sign-OS_BASE]
|
mov eax, [cpu_sign - OS_BASE]
|
||||||
shr eax, 8
|
shr eax, 8
|
||||||
and eax, 0x0f
|
and eax, 0x0f
|
||||||
ret
|
ret
|
||||||
@@ -415,14 +415,14 @@ ACPI_HI_RSDP_WINDOW_END = 0x00100000
|
|||||||
ACPI_RSDP_CHECKSUM_LENGTH = 20
|
ACPI_RSDP_CHECKSUM_LENGTH = 20
|
||||||
|
|
||||||
proc acpi_locate_tables uses ebx esi edi
|
proc acpi_locate_tables uses ebx esi edi
|
||||||
mov ebx, [ebx+ACPI_RSDP.RsdtAddress]
|
mov ebx, [ebx + ACPI_RSDP.RsdtAddress]
|
||||||
mov [acpi_rsdt_base-OS_BASE], ebx
|
mov [acpi_rsdt_base - OS_BASE], ebx
|
||||||
mov eax, [ebx+ACPI_RSDT.Length]
|
mov eax, [ebx + ACPI_RSDT.Length]
|
||||||
mov [acpi_rsdt_size-OS_BASE], eax
|
mov [acpi_rsdt_size - OS_BASE], eax
|
||||||
|
|
||||||
mov esi, [acpi_rsdt_base-OS_BASE]
|
mov esi, [acpi_rsdt_base - OS_BASE]
|
||||||
mov ecx, [esi+ACPI_RSDT.Length]
|
mov ecx, [esi + ACPI_RSDT.Length]
|
||||||
lea edi, [esi+ecx]
|
lea edi, [esi + ecx]
|
||||||
add esi, sizeof.ACPI_TABLE
|
add esi, sizeof.ACPI_TABLE
|
||||||
movi ecx, 1
|
movi ecx, 1
|
||||||
.next_table:
|
.next_table:
|
||||||
@@ -439,35 +439,35 @@ proc acpi_locate_tables uses ebx esi edi
|
|||||||
jz .hpet
|
jz .hpet
|
||||||
jmp .next_table
|
jmp .next_table
|
||||||
.ssdt:
|
.ssdt:
|
||||||
mov [acpi_ssdt_base+ecx*4-OS_BASE], eax
|
mov [acpi_ssdt_base + ecx*4 - OS_BASE], eax
|
||||||
mov eax, [eax+ACPI_TABLE.Length]
|
mov eax, [eax+ACPI_TABLE.Length]
|
||||||
mov [acpi_ssdt_size+ecx*4-OS_BASE], eax
|
mov [acpi_ssdt_size + ecx*4 - OS_BASE], eax
|
||||||
inc ecx
|
inc ecx
|
||||||
jmp .next_table
|
jmp .next_table
|
||||||
.fadt:
|
.fadt:
|
||||||
mov [acpi_fadt_base-OS_BASE], eax
|
mov [acpi_fadt_base - OS_BASE], eax
|
||||||
cmp [eax+ACPI_FADT.DSDT], 0
|
cmp [eax + ACPI_FADT.DSDT], 0
|
||||||
jz @f
|
jz @f
|
||||||
mov edx, [eax+ACPI_FADT.DSDT]
|
mov edx, [eax + ACPI_FADT.DSDT]
|
||||||
mov [acpi_ssdt_base-OS_BASE], edx
|
mov [acpi_ssdt_base - OS_BASE], edx
|
||||||
mov edx, [edx+ACPI_TABLE.Length]
|
mov edx, [edx + ACPI_TABLE.Length]
|
||||||
mov [acpi_ssdt_size-OS_BASE], edx
|
mov [acpi_ssdt_size - OS_BASE], edx
|
||||||
@@:
|
@@:
|
||||||
mov eax, [eax+ACPI_TABLE.Length]
|
mov eax, [eax + ACPI_TABLE.Length]
|
||||||
mov [acpi_fadt_size-OS_BASE], eax
|
mov [acpi_fadt_size - OS_BASE], eax
|
||||||
jmp .next_table
|
jmp .next_table
|
||||||
.madt:
|
.madt:
|
||||||
mov [acpi_madt_base-OS_BASE], eax
|
mov [acpi_madt_base - OS_BASE], eax
|
||||||
mov eax, [eax+ACPI_TABLE.Length]
|
mov eax, [eax + ACPI_TABLE.Length]
|
||||||
mov [acpi_madt_size-OS_BASE], eax
|
mov [acpi_madt_size - OS_BASE], eax
|
||||||
jmp .next_table
|
jmp .next_table
|
||||||
.hpet:
|
.hpet:
|
||||||
mov [acpi_hpet_base-OS_BASE], eax
|
mov [acpi_hpet_base - OS_BASE], eax
|
||||||
mov eax, [eax+ACPI_TABLE.Length]
|
mov eax, [eax + ACPI_TABLE.Length]
|
||||||
mov [acpi_hpet_size-OS_BASE], eax
|
mov [acpi_hpet_size - OS_BASE], eax
|
||||||
jmp .next_table
|
jmp .next_table
|
||||||
.done:
|
.done:
|
||||||
mov [acpi_ssdt_cnt-OS_BASE], ecx
|
mov [acpi_ssdt_cnt - OS_BASE], ecx
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
@@ -497,7 +497,7 @@ else
|
|||||||
call .check
|
call .check
|
||||||
end if
|
end if
|
||||||
.done:
|
.done:
|
||||||
mov [acpi_rsdp_base-OS_BASE], ebx
|
mov [acpi_rsdp_base - OS_BASE], ebx
|
||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
jz @f
|
jz @f
|
||||||
call acpi_locate_tables
|
call acpi_locate_tables
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;
|
;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved.
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved.
|
||||||
;; PROGRAMMING:
|
;; PROGRAMMING:
|
||||||
;; Ivan Poddubny
|
;; Ivan Poddubny
|
||||||
;; Marat Zakiyanov (Mario79)
|
;; Marat Zakiyanov (Mario79)
|
||||||
@@ -195,12 +195,12 @@ B32:
|
|||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edi, CLEAN_ZONE
|
mov edi, CLEAN_ZONE
|
||||||
mov ecx, (HEAP_BASE-OS_BASE-CLEAN_ZONE) / 4
|
mov ecx, (HEAP_BASE - OS_BASE - CLEAN_ZONE) / 4
|
||||||
cld
|
cld
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
; CLEAR KERNEL UNDEFINED GLOBALS
|
; CLEAR KERNEL UNDEFINED GLOBALS
|
||||||
mov edi, endofcode-OS_BASE
|
mov edi, endofcode - OS_BASE
|
||||||
mov ecx, 0x90000
|
mov ecx, 0x90000
|
||||||
sub ecx, edi
|
sub ecx, edi
|
||||||
shr ecx, 2
|
shr ecx, 2
|
||||||
@@ -216,7 +216,7 @@ B32:
|
|||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
call test_cpu
|
call test_cpu
|
||||||
bts [cpu_caps-OS_BASE], CAPS_TSC ;force use rdtsc
|
bts [cpu_caps - OS_BASE], CAPS_TSC ;force use rdtsc
|
||||||
|
|
||||||
call acpi_locate
|
call acpi_locate
|
||||||
call init_BIOS32
|
call init_BIOS32
|
||||||
@@ -227,11 +227,11 @@ B32:
|
|||||||
|
|
||||||
; ENABLE PAGING
|
; ENABLE PAGING
|
||||||
|
|
||||||
mov eax, sys_proc-OS_BASE+PROC.pdt_0
|
mov eax, sys_proc - OS_BASE + PROC.pdt_0
|
||||||
mov cr3, eax
|
mov cr3, eax
|
||||||
|
|
||||||
mov eax, cr0
|
mov eax, cr0
|
||||||
or eax, CR0_PG+CR0_WP
|
or eax, CR0_PG + CR0_WP
|
||||||
mov cr0, eax
|
mov cr0, eax
|
||||||
|
|
||||||
lgdt [gdts]
|
lgdt [gdts]
|
||||||
@@ -243,12 +243,12 @@ tmp_page_tabs dd ?
|
|||||||
use16
|
use16
|
||||||
ap_init16:
|
ap_init16:
|
||||||
cli
|
cli
|
||||||
lgdt [cs:gdts_ap-ap_init16]
|
lgdt [cs:gdts_ap - ap_init16]
|
||||||
mov eax, [cs:cr3_ap-ap_init16]
|
mov eax, [cs:cr3_ap - ap_init16]
|
||||||
mov cr3, eax
|
mov cr3, eax
|
||||||
mov eax, [cs:cr4_ap-ap_init16]
|
mov eax, [cs:cr4_ap - ap_init16]
|
||||||
mov cr4, eax
|
mov cr4, eax
|
||||||
mov eax, CR0_PE+CR0_PG+CR0_WP
|
mov eax, CR0_PE + CR0_PG + CR0_WP
|
||||||
mov cr0, eax
|
mov cr0, eax
|
||||||
jmp pword os_code:ap_init_high
|
jmp pword os_code:ap_init_high
|
||||||
align 16
|
align 16
|
||||||
@@ -283,7 +283,7 @@ high_code:
|
|||||||
mov gs, bx
|
mov gs, bx
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov ebx, 0xFFFFF000+PG_SHARED+PG_NOCACHE+PG_UWR
|
mov ebx, 0xFFFFF000 + PG_SHARED + PG_NOCACHE + PG_UWR
|
||||||
bt [cpu_caps], CAPS_PAT
|
bt [cpu_caps], CAPS_PAT
|
||||||
setc al
|
setc al
|
||||||
shl eax, 7
|
shl eax, 7
|
||||||
@@ -293,7 +293,7 @@ high_code:
|
|||||||
bt [cpu_caps], CAPS_PGE
|
bt [cpu_caps], CAPS_PGE
|
||||||
jnc @F
|
jnc @F
|
||||||
|
|
||||||
or [sys_proc+PROC.pdt_0+(OS_BASE shr 20)], eax
|
or [sys_proc + PROC.pdt_0 + (OS_BASE shr 20)], eax
|
||||||
or ebx, eax
|
or ebx, eax
|
||||||
|
|
||||||
mov eax, cr4
|
mov eax, cr4
|
||||||
@@ -303,8 +303,8 @@ high_code:
|
|||||||
mov [pte_valid_mask], ebx
|
mov [pte_valid_mask], ebx
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov dword [sys_proc+PROC.pdt_0], eax
|
mov dword [sys_proc + PROC.pdt_0], eax
|
||||||
mov dword [sys_proc+PROC.pdt_0+4], eax
|
mov dword [sys_proc + PROC.pdt_0+4], eax
|
||||||
|
|
||||||
mov eax, cr3
|
mov eax, cr3
|
||||||
mov cr3, eax ; flush TLB
|
mov cr3, eax ; flush TLB
|
||||||
@@ -456,7 +456,7 @@ high_code:
|
|||||||
stdcall kernel_alloc, eax
|
stdcall kernel_alloc, eax
|
||||||
mov [os_stack_seg], eax
|
mov [os_stack_seg], eax
|
||||||
|
|
||||||
lea esp, [eax+RING0_STACK_SIZE]
|
lea esp, [eax + RING0_STACK_SIZE]
|
||||||
|
|
||||||
mov [tss._ss0], os_stack
|
mov [tss._ss0], os_stack
|
||||||
mov [tss._esp0], esp
|
mov [tss._esp0], esp
|
||||||
@@ -515,13 +515,13 @@ high_code:
|
|||||||
add eax, ebx
|
add eax, ebx
|
||||||
mov [ipc_ptab], eax
|
mov [ipc_ptab], eax
|
||||||
|
|
||||||
stdcall kernel_alloc, (unpack.LZMA_BASE_SIZE+(unpack.LZMA_LIT_SIZE shl \
|
stdcall kernel_alloc, (unpack.LZMA_BASE_SIZE + (unpack.LZMA_LIT_SIZE shl \
|
||||||
(unpack.lc+unpack.lp)))*4
|
(unpack.lc + unpack.lp)))*4
|
||||||
|
|
||||||
mov [unpack.p], eax
|
mov [unpack.p], eax
|
||||||
|
|
||||||
call init_events
|
call init_events
|
||||||
mov eax, srv.fd-SRV.fd
|
mov eax, srv.fd - SRV.fd
|
||||||
mov [srv.fd], eax
|
mov [srv.fd], eax
|
||||||
mov [srv.bk], eax
|
mov [srv.bk], eax
|
||||||
|
|
||||||
@@ -564,7 +564,7 @@ high_code:
|
|||||||
mov eax, [hpet_base]
|
mov eax, [hpet_base]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @F
|
jz @F
|
||||||
stdcall map_io_mem, [hpet_base], 1024, PG_GLOBAL+PAT_UC+PG_SWR
|
stdcall map_io_mem, [hpet_base], 1024, PG_GLOBAL + PAT_UC + PG_SWR
|
||||||
mov [hpet_base], eax
|
mov [hpet_base], eax
|
||||||
mov eax, [eax+HPET_ID]
|
mov eax, [eax+HPET_ID]
|
||||||
DEBUGF 1, "K : HPET caps %x\n", eax
|
DEBUGF 1, "K : HPET caps %x\n", eax
|
||||||
@@ -575,8 +575,8 @@ high_code:
|
|||||||
mov esi, boot_setostask
|
mov esi, boot_setostask
|
||||||
call boot_log
|
call boot_log
|
||||||
|
|
||||||
mov edi, sys_proc+PROC.heap_lock
|
mov edi, sys_proc + PROC.heap_lock
|
||||||
mov ecx, (PROC.ht_free-PROC.heap_lock)/4
|
mov ecx, (PROC.ht_free - PROC.heap_lock)/4
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
cld
|
cld
|
||||||
@@ -593,7 +593,7 @@ high_code:
|
|||||||
cmp eax, ecx
|
cmp eax, ecx
|
||||||
jbe @B
|
jbe @B
|
||||||
|
|
||||||
mov [sys_proc+PROC.pdt_0_phys], sys_proc-OS_BASE+PROC.pdt_0
|
mov [sys_proc + PROC.pdt_0_phys], sys_proc - OS_BASE + PROC.pdt_0
|
||||||
|
|
||||||
mov eax, -1
|
mov eax, -1
|
||||||
mov edi, thr_slot_map+4
|
mov edi, thr_slot_map+4
|
||||||
@@ -608,19 +608,19 @@ high_code:
|
|||||||
|
|
||||||
mov [current_process], sys_proc
|
mov [current_process], sys_proc
|
||||||
|
|
||||||
mov edx, SLOT_BASE+sizeof.APPDATA*1
|
mov edx, SLOT_BASE + sizeof.APPDATA*1
|
||||||
mov ebx, [os_stack_seg]
|
mov ebx, [os_stack_seg]
|
||||||
add ebx, RING0_STACK_SIZE
|
add ebx, RING0_STACK_SIZE
|
||||||
add ebx, [xsave_area_size]
|
add ebx, [xsave_area_size]
|
||||||
call setup_os_slot
|
call setup_os_slot
|
||||||
mov dword [edx], 'IDLE'
|
mov dword [edx], 'IDLE'
|
||||||
sub [edx+APPDATA.saved_esp], 4
|
sub [edx + APPDATA.saved_esp], 4
|
||||||
mov eax, [edx+APPDATA.saved_esp]
|
mov eax, [edx + APPDATA.saved_esp]
|
||||||
mov dword [eax], idle_thread
|
mov dword [eax], idle_thread
|
||||||
mov ecx, IDLE_PRIORITY
|
mov ecx, IDLE_PRIORITY
|
||||||
call scheduler_add_thread
|
call scheduler_add_thread
|
||||||
|
|
||||||
mov edx, SLOT_BASE+sizeof.APPDATA*2
|
mov edx, SLOT_BASE + sizeof.APPDATA*2
|
||||||
mov ebx, [os_stack_seg]
|
mov ebx, [os_stack_seg]
|
||||||
call setup_os_slot
|
call setup_os_slot
|
||||||
mov dword [edx], 'OS'
|
mov dword [edx], 'OS'
|
||||||
@@ -645,9 +645,9 @@ endg
|
|||||||
cmp ebx, 1
|
cmp ebx, 1
|
||||||
jbe .no_wake_cpus
|
jbe .no_wake_cpus
|
||||||
call create_trampoline_pgmap
|
call create_trampoline_pgmap
|
||||||
mov [cr3_ap+OS_BASE], eax
|
mov [cr3_ap + OS_BASE], eax
|
||||||
mov eax, cr4
|
mov eax, cr4
|
||||||
mov [cr4_ap+OS_BASE], eax
|
mov [cr4_ap + OS_BASE], eax
|
||||||
mov esi, OS_BASE + ap_init16
|
mov esi, OS_BASE + ap_init16
|
||||||
mov edi, OS_BASE + 8000h
|
mov edi, OS_BASE + 8000h
|
||||||
mov ecx, (ap_init16_size + 3) / 4
|
mov ecx, (ap_init16_size + 3) / 4
|
||||||
@@ -655,10 +655,10 @@ endg
|
|||||||
mov eax, [LAPIC_BASE]
|
mov eax, [LAPIC_BASE]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jnz @f
|
jnz @f
|
||||||
stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_GLOBAL+PG_NOCACHE+PG_SWR
|
stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_GLOBAL + PG_NOCACHE + PG_SWR
|
||||||
mov [LAPIC_BASE], eax
|
mov [LAPIC_BASE], eax
|
||||||
@@:
|
@@:
|
||||||
lea edi, [eax+APIC_ICRL]
|
lea edi, [eax + APIC_ICRL]
|
||||||
mov esi, smpt+4
|
mov esi, smpt+4
|
||||||
dec ebx
|
dec ebx
|
||||||
.wake_cpus_loop:
|
.wake_cpus_loop:
|
||||||
@@ -694,7 +694,7 @@ endg
|
|||||||
@@:
|
@@:
|
||||||
cmp [ap_initialized], eax
|
cmp [ap_initialized], eax
|
||||||
jnz @b
|
jnz @b
|
||||||
mov eax, [cr3_ap+OS_BASE]
|
mov eax, [cr3_ap + OS_BASE]
|
||||||
call free_page
|
call free_page
|
||||||
.no_wake_cpus:
|
.no_wake_cpus:
|
||||||
|
|
||||||
@@ -899,8 +899,8 @@ include "detect/vortex86.inc" ; Vortex86 SoC detection code
|
|||||||
|
|
||||||
call init_display
|
call init_display
|
||||||
mov eax, [def_cursor]
|
mov eax, [def_cursor]
|
||||||
mov [SLOT_BASE+APPDATA.cursor+sizeof.APPDATA], eax
|
mov [SLOT_BASE + APPDATA.cursor + sizeof.APPDATA], eax
|
||||||
mov [SLOT_BASE+APPDATA.cursor+sizeof.APPDATA*2], eax
|
mov [SLOT_BASE + APPDATA.cursor + sizeof.APPDATA*2], eax
|
||||||
|
|
||||||
; PRINT CPU FREQUENCY
|
; PRINT CPU FREQUENCY
|
||||||
|
|
||||||
@@ -911,12 +911,12 @@ include "detect/vortex86.inc" ; Vortex86 SoC detection code
|
|||||||
mov ebx, [hpet_base]
|
mov ebx, [hpet_base]
|
||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
jz @F
|
jz @F
|
||||||
mov ebx, [ebx+HPET_COUNTER]
|
mov ebx, [ebx + HPET_COUNTER]
|
||||||
|
|
||||||
rdtsc
|
rdtsc
|
||||||
mov ecx, 1000
|
mov ecx, 1000
|
||||||
sub eax, [hpet_tsc_start]
|
sub eax, [hpet_tsc_start]
|
||||||
sbb edx, [hpet_tsc_start+4]
|
sbb edx, [hpet_tsc_start + 4]
|
||||||
shld edx, eax, 10
|
shld edx, eax, 10
|
||||||
shl eax, 10
|
shl eax, 10
|
||||||
mov esi, eax
|
mov esi, eax
|
||||||
@@ -944,7 +944,7 @@ include "detect/vortex86.inc" ; Vortex86 SoC detection code
|
|||||||
shl eax, 2
|
shl eax, 2
|
||||||
.next:
|
.next:
|
||||||
mov dword [cpu_freq], eax
|
mov dword [cpu_freq], eax
|
||||||
mov dword [cpu_freq+4], edx
|
mov dword [cpu_freq + 4], edx
|
||||||
mov ebx, 1000000
|
mov ebx, 1000000
|
||||||
div ebx
|
div ebx
|
||||||
mov ebx, eax
|
mov ebx, eax
|
||||||
@@ -996,14 +996,14 @@ include "detect/vortex86.inc" ; Vortex86 SoC detection code
|
|||||||
; Protect I/O permission map
|
; Protect I/O permission map
|
||||||
|
|
||||||
mov esi, [default_io_map]
|
mov esi, [default_io_map]
|
||||||
stdcall map_page, esi, [SLOT_BASE+sizeof.APPDATA+APPDATA.io_map], PG_READ
|
stdcall map_page, esi, [SLOT_BASE + sizeof.APPDATA + APPDATA.io_map], PG_READ
|
||||||
add esi, 0x1000
|
add esi, 0x1000
|
||||||
stdcall map_page, esi, [SLOT_BASE+sizeof.APPDATA+APPDATA.io_map+4], PG_READ
|
stdcall map_page, esi, [SLOT_BASE + sizeof.APPDATA + APPDATA.io_map + 4], PG_READ
|
||||||
|
|
||||||
stdcall map_page, tss._io_map_0, \
|
stdcall map_page, tss._io_map_0, \
|
||||||
[SLOT_BASE+sizeof.APPDATA+APPDATA.io_map], PG_READ
|
[SLOT_BASE + sizeof.APPDATA + APPDATA.io_map], PG_READ
|
||||||
stdcall map_page, tss._io_map_1, \
|
stdcall map_page, tss._io_map_1, \
|
||||||
[SLOT_BASE+sizeof.APPDATA+APPDATA.io_map+4], PG_READ
|
[SLOT_BASE + sizeof.APPDATA + APPDATA.io_map + 4], PG_READ
|
||||||
|
|
||||||
; SET KEYBOARD PARAMETERS
|
; SET KEYBOARD PARAMETERS
|
||||||
mov al, 0xf6 ; reset keyboard, scan enabled
|
mov al, 0xf6 ; reset keyboard, scan enabled
|
||||||
@@ -1098,7 +1098,7 @@ ap_init_high:
|
|||||||
mov fs, cx
|
mov fs, cx
|
||||||
mov gs, bx
|
mov gs, bx
|
||||||
xor esp, esp
|
xor esp, esp
|
||||||
mov eax, sys_proc-OS_BASE+PROC.pdt_0
|
mov eax, sys_proc - OS_BASE + PROC.pdt_0
|
||||||
mov cr3, eax
|
mov cr3, eax
|
||||||
lock inc [ap_initialized]
|
lock inc [ap_initialized]
|
||||||
jmp idle_loop
|
jmp idle_loop
|
||||||
@@ -1145,18 +1145,18 @@ proc setup_os_slot
|
|||||||
mov eax, tss+0x80
|
mov eax, tss+0x80
|
||||||
call get_pg_addr
|
call get_pg_addr
|
||||||
inc eax
|
inc eax
|
||||||
mov [edx+APPDATA.io_map], eax
|
mov [edx + APPDATA.io_map], eax
|
||||||
mov eax, tss+0x1080
|
mov eax, tss+0x1080
|
||||||
call get_pg_addr
|
call get_pg_addr
|
||||||
inc eax
|
inc eax
|
||||||
mov [edx+APPDATA.io_map+4], eax
|
mov [edx + APPDATA.io_map + 4], eax
|
||||||
|
|
||||||
mov dword [edx+APPDATA.pl0_stack], ebx
|
mov dword [edx + APPDATA.pl0_stack], ebx
|
||||||
lea edi, [ebx+RING0_STACK_SIZE]
|
lea edi, [ebx + RING0_STACK_SIZE]
|
||||||
mov dword [edx+APPDATA.fpu_state], edi
|
mov dword [edx + APPDATA.fpu_state], edi
|
||||||
mov dword [edx+APPDATA.saved_esp0], edi
|
mov dword [edx + APPDATA.saved_esp0], edi
|
||||||
mov dword [edx+APPDATA.saved_esp], edi
|
mov dword [edx + APPDATA.saved_esp], edi
|
||||||
mov dword [edx+APPDATA.terminate_protection], 1 ; make unkillable
|
mov dword [edx + APPDATA.terminate_protection], 1 ; make unkillable
|
||||||
|
|
||||||
mov esi, fpu_data
|
mov esi, fpu_data
|
||||||
mov ecx, [xsave_area_size]
|
mov ecx, [xsave_area_size]
|
||||||
@@ -1164,24 +1164,24 @@ proc setup_os_slot
|
|||||||
shr ecx, 2
|
shr ecx, 2
|
||||||
rep movsd
|
rep movsd
|
||||||
|
|
||||||
lea eax, [edx+APP_EV_OFFSET]
|
lea eax, [edx + APP_EV_OFFSET]
|
||||||
mov dword [edx+APPDATA.fd_ev], eax
|
mov dword [edx + APPDATA.fd_ev], eax
|
||||||
mov dword [edx+APPDATA.bk_ev], eax
|
mov dword [edx + APPDATA.bk_ev], eax
|
||||||
|
|
||||||
lea eax, [edx+APP_OBJ_OFFSET]
|
lea eax, [edx + APP_OBJ_OFFSET]
|
||||||
mov dword [edx+APPDATA.fd_obj], eax
|
mov dword [edx + APPDATA.fd_obj], eax
|
||||||
mov dword [edx+APPDATA.bk_obj], eax
|
mov dword [edx + APPDATA.bk_obj], eax
|
||||||
|
|
||||||
mov dword [edx+APPDATA.cur_dir], sysdir_path-2
|
mov dword [edx + APPDATA.cur_dir], sysdir_path-2
|
||||||
|
|
||||||
mov [edx + APPDATA.process], sys_proc
|
mov [edx + APPDATA.process], sys_proc
|
||||||
|
|
||||||
lea ebx, [edx+APPDATA.list]
|
lea ebx, [edx + APPDATA.list]
|
||||||
lea ecx, [sys_proc+PROC.thr_list]
|
lea ecx, [sys_proc + PROC.thr_list]
|
||||||
list_add_tail ebx, ecx
|
list_add_tail ebx, ecx
|
||||||
|
|
||||||
mov [edx+APPDATA.wnd_number], dh
|
mov [edx + APPDATA.wnd_number], dh
|
||||||
mov byte [edx+APPDATA.tid], dh
|
mov byte [edx + APPDATA.tid], dh
|
||||||
|
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@@ -1413,8 +1413,8 @@ display_number_force:
|
|||||||
jne displnl1
|
jne displnl1
|
||||||
mov ebp, ebx
|
mov ebp, ebx
|
||||||
add ebp, 4
|
add ebp, 4
|
||||||
mov ebp, [ebp+std_application_base_address]
|
mov ebp, [ebp + std_application_base_address]
|
||||||
mov ebx, [ebx+std_application_base_address]
|
mov ebx, [ebx + std_application_base_address]
|
||||||
displnl1:
|
displnl1:
|
||||||
sub esp, 64
|
sub esp, 64
|
||||||
|
|
||||||
@@ -1546,14 +1546,14 @@ draw_num_text:
|
|||||||
|
|
||||||
mov edi, [current_slot_idx]
|
mov edi, [current_slot_idx]
|
||||||
mov ecx, edi
|
mov ecx, edi
|
||||||
shl edi, 8
|
shl edi, BSF sizeof.APPDATA
|
||||||
shl ecx, 5
|
shl ecx, BSF sizeof.WDATA
|
||||||
|
|
||||||
mov eax, [ecx+window_data+WDATA.box.left]
|
mov eax, [window_data + ecx + WDATA.box.left]
|
||||||
add eax, [edi+SLOT_BASE+APPDATA.wnd_clientbox.left]
|
add eax, [SLOT_BASE + edi + APPDATA.wnd_clientbox.left]
|
||||||
shl eax, 16
|
shl eax, 16
|
||||||
add eax, [ecx+window_data+WDATA.box.top]
|
add eax, [window_data + ecx + WDATA.box.top]
|
||||||
add eax, [edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
|
add eax, [SLOT_BASE + edi + APPDATA.wnd_clientbox.top]
|
||||||
add ebx, eax
|
add ebx, eax
|
||||||
mov ecx, [esp+64+32-12+4]
|
mov ecx, [esp+64+32-12+4]
|
||||||
mov eax, [esp+64+8] ; background color (if given)
|
mov eax, [esp+64+8] ; background color (if given)
|
||||||
@@ -1906,12 +1906,12 @@ sys_end:
|
|||||||
; kill all sockets this process owns
|
; kill all sockets this process owns
|
||||||
pusha
|
pusha
|
||||||
mov edx, [current_slot]
|
mov edx, [current_slot]
|
||||||
mov edx, [edx+APPDATA.tid]
|
mov edx, [edx + APPDATA.tid]
|
||||||
call socket_process_end
|
call socket_process_end
|
||||||
popa
|
popa
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
mov ecx, [current_slot]
|
mov ecx, [current_slot]
|
||||||
mov eax, [ecx+APPDATA.tls_base]
|
mov eax, [ecx + APPDATA.tls_base]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @F
|
jz @F
|
||||||
|
|
||||||
@@ -1919,7 +1919,7 @@ sys_end:
|
|||||||
@@:
|
@@:
|
||||||
|
|
||||||
mov eax, [current_slot]
|
mov eax, [current_slot]
|
||||||
mov [eax+APPDATA.state], TSTATE_ZOMBIE
|
mov [eax + APPDATA.state], TSTATE_ZOMBIE
|
||||||
call wakeup_osloop
|
call wakeup_osloop
|
||||||
|
|
||||||
.waitterm: ; wait here for termination
|
.waitterm: ; wait here for termination
|
||||||
@@ -1931,16 +1931,16 @@ restore_default_cursor_before_killing:
|
|||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
mov eax, [def_cursor]
|
mov eax, [def_cursor]
|
||||||
mov [ecx+APPDATA.cursor], eax
|
mov [ecx + APPDATA.cursor], eax
|
||||||
|
|
||||||
movzx eax, word [MOUSE_Y]
|
movzx eax, word [MOUSE_Y]
|
||||||
movzx ebx, word [MOUSE_X]
|
movzx ebx, word [MOUSE_X]
|
||||||
mov eax, [d_width_calc_area + eax*4]
|
mov eax, [d_width_calc_area + eax*4]
|
||||||
|
|
||||||
add eax, [_display.win_map]
|
add eax, [_display.win_map]
|
||||||
movzx edx, byte [ebx+eax]
|
movzx edx, byte [ebx + eax]
|
||||||
shl edx, BSF sizeof.APPDATA
|
shl edx, BSF sizeof.APPDATA
|
||||||
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
|
mov esi, [SLOT_BASE + edx + APPDATA.cursor]
|
||||||
|
|
||||||
cmp esi, [current_cursor]
|
cmp esi, [current_cursor]
|
||||||
je @f
|
je @f
|
||||||
@@ -2017,8 +2017,8 @@ sysfn_shutdown: ; 18.9 = system shutdown
|
|||||||
; in: eax -- APPDATA ptr
|
; in: eax -- APPDATA ptr
|
||||||
; out: Z/z -- is/not kernel thread
|
; out: Z/z -- is/not kernel thread
|
||||||
is_kernel_thread:
|
is_kernel_thread:
|
||||||
mov eax, [eax+APPDATA.process]
|
mov eax, [eax + APPDATA.process]
|
||||||
cmp eax, [SLOT_BASE+2*sizeof.APPDATA+APPDATA.process] ; OS
|
cmp eax, [SLOT_BASE + 2*sizeof.APPDATA + APPDATA.process] ; OS
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
sysfn_terminate: ; 18.2 = TERMINATE
|
sysfn_terminate: ; 18.2 = TERMINATE
|
||||||
@@ -2060,7 +2060,7 @@ sysfn_terminate: ; 18.2 = TERMINATE
|
|||||||
shl ecx, 8
|
shl ecx, 8
|
||||||
add ecx, SLOT_BASE
|
add ecx, SLOT_BASE
|
||||||
mov eax, [def_cursor]
|
mov eax, [def_cursor]
|
||||||
cmp [ecx+APPDATA.cursor], eax
|
cmp [ecx + APPDATA.cursor], eax
|
||||||
je @f
|
je @f
|
||||||
call restore_default_cursor_before_killing
|
call restore_default_cursor_before_killing
|
||||||
@@:
|
@@:
|
||||||
@@ -2146,7 +2146,7 @@ sysfn_activate: ; 18.3 = ACTIVATE WINDOW
|
|||||||
je .nowindowactivate; already active
|
je .nowindowactivate; already active
|
||||||
|
|
||||||
mov edi, ecx
|
mov edi, ecx
|
||||||
shl edi, 5
|
shl edi, BSF sizeof.WDATA
|
||||||
add edi, window_data
|
add edi, window_data
|
||||||
movzx esi, word [WIN_STACK + ecx * 2]
|
movzx esi, word [WIN_STACK + ecx * 2]
|
||||||
lea esi, [WIN_POS + esi * 2]
|
lea esi, [WIN_POS + esi * 2]
|
||||||
@@ -2174,7 +2174,7 @@ sysfn_zmodif:
|
|||||||
je .fail
|
je .fail
|
||||||
|
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
shl edx, 5
|
shl edx, BSF sizeof.WDATA
|
||||||
|
|
||||||
cmp [edx*8 + SLOT_BASE + APPDATA.state], TSTATE_FREE
|
cmp [edx*8 + SLOT_BASE + APPDATA.state], TSTATE_FREE
|
||||||
je .fail
|
je .fail
|
||||||
@@ -2182,7 +2182,7 @@ sysfn_zmodif:
|
|||||||
cmp ecx, 1
|
cmp ecx, 1
|
||||||
jnz .set_zmod
|
jnz .set_zmod
|
||||||
|
|
||||||
mov al, [edx + window_data + WDATA.z_modif]
|
mov al, [window_data + edx + WDATA.z_modif]
|
||||||
jmp .exit
|
jmp .exit
|
||||||
|
|
||||||
.set_zmod:
|
.set_zmod:
|
||||||
@@ -2195,19 +2195,19 @@ sysfn_zmodif:
|
|||||||
cmp bl, ZPOS_ALWAYS_TOP
|
cmp bl, ZPOS_ALWAYS_TOP
|
||||||
jg .fail
|
jg .fail
|
||||||
|
|
||||||
mov [edx + window_data + WDATA.z_modif], bl
|
mov [window_data + edx + WDATA.z_modif], bl
|
||||||
|
|
||||||
mov eax, [edx + window_data + WDATA.box.left]
|
mov eax, [window_data + edx + WDATA.box.left]
|
||||||
mov ebx, [edx + window_data + WDATA.box.top]
|
mov ebx, [window_data + edx + WDATA.box.top]
|
||||||
mov ecx, [edx + window_data + WDATA.box.width]
|
mov ecx, [window_data + edx + WDATA.box.width]
|
||||||
mov edx, [edx + window_data + WDATA.box.height]
|
mov edx, [window_data + edx + WDATA.box.height]
|
||||||
add ecx, eax
|
add ecx, eax
|
||||||
add edx, ebx
|
add edx, ebx
|
||||||
call window._.set_screen
|
call window._.set_screen
|
||||||
call window._.set_top_wnd
|
call window._.set_top_wnd
|
||||||
call window._.redraw_top_wnd
|
call window._.redraw_top_wnd
|
||||||
|
|
||||||
shl esi, 5
|
shl esi, BSF sizeof.WDATA
|
||||||
mov [esi + window_data + WDATA.fl_redraw], 1
|
mov [esi + window_data + WDATA.fl_redraw], 1
|
||||||
|
|
||||||
|
|
||||||
@@ -2222,7 +2222,7 @@ sysfn_zmodif:
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
sysfn_getidletime: ; 18.4 = GET IDLETIME
|
sysfn_getidletime: ; 18.4 = GET IDLETIME
|
||||||
;mov eax, [TASK_TABLE+32+TASKDATA.cpu_usage]
|
;mov eax, [TASK_TABLE+32+TASKDATA.cpu_usage]
|
||||||
mov eax, [SLOT_BASE+APPDATA.cpu_usage]
|
mov eax, [SLOT_BASE + APPDATA.cpu_usage]
|
||||||
mov [esp+32], eax
|
mov [esp+32], eax
|
||||||
ret
|
ret
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
@@ -2323,7 +2323,7 @@ sysfn_centermouse: ; 18.15 = mouse centered
|
|||||||
sysfn_mouse_acceleration: ; 18.19 = set/get mouse features
|
sysfn_mouse_acceleration: ; 18.19 = set/get mouse features
|
||||||
cmp ecx, 8
|
cmp ecx, 8
|
||||||
jnc @f
|
jnc @f
|
||||||
jmp dword [.table+ecx*4]
|
jmp dword [.table + ecx*4]
|
||||||
.get_mouse_acceleration:
|
.get_mouse_acceleration:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov ax, [mouse_speed_factor]
|
mov ax, [mouse_speed_factor]
|
||||||
@@ -2603,15 +2603,15 @@ sys_cpuusage:
|
|||||||
mov ax, [WIN_POS + ecx * 2]
|
mov ax, [WIN_POS + ecx * 2]
|
||||||
mov [ebx+6], ax
|
mov [ebx+6], ax
|
||||||
|
|
||||||
shl ecx, 8 ;5=32 8=256
|
shl ecx, BSF sizeof.APPDATA
|
||||||
|
|
||||||
; +0: dword: memory usage
|
; +0: dword: memory usage
|
||||||
;mov eax, [ecx+TASK_TABLE+TASKDATA.cpu_usage]
|
;mov eax, [ecx+TASK_TABLE+TASKDATA.cpu_usage]
|
||||||
mov eax, [ecx-sizeof.APPDATA+SLOT_BASE+APPDATA.cpu_usage]
|
mov eax, [SLOT_BASE + ecx - sizeof.APPDATA + APPDATA.cpu_usage]
|
||||||
mov [ebx], eax
|
mov [ebx], eax
|
||||||
; +10: 11 bytes: name of the process
|
; +10: 11 bytes: name of the process
|
||||||
push ecx
|
push ecx
|
||||||
lea eax, [ecx+SLOT_BASE+APPDATA.app_name]
|
lea eax, [SLOT_BASE + ecx + APPDATA.app_name]
|
||||||
add ebx, 10
|
add ebx, 10
|
||||||
mov ecx, 11
|
mov ecx, 11
|
||||||
call memmove
|
call memmove
|
||||||
@@ -2626,8 +2626,8 @@ sys_cpuusage:
|
|||||||
mov edx, 0x100000*16
|
mov edx, 0x100000*16
|
||||||
cmp ecx, 1 shl 5
|
cmp ecx, 1 shl 5
|
||||||
je .os_mem
|
je .os_mem
|
||||||
mov edx, [SLOT_BASE+ecx*8+APPDATA.process]
|
mov edx, [SLOT_BASE + ecx*8 + APPDATA.process]
|
||||||
mov edx, [edx+PROC.mem_used]
|
mov edx, [edx + PROC.mem_used]
|
||||||
mov eax, std_application_base_address
|
mov eax, std_application_base_address
|
||||||
.os_mem:
|
.os_mem:
|
||||||
stosd
|
stosd
|
||||||
@@ -2635,38 +2635,38 @@ sys_cpuusage:
|
|||||||
stosd
|
stosd
|
||||||
|
|
||||||
; +30: PID/TID
|
; +30: PID/TID
|
||||||
mov eax, [ecx*8 + SLOT_BASE + APPDATA.tid]
|
mov eax, [SLOT_BASE + ecx*8 + APPDATA.tid]
|
||||||
stosd
|
stosd
|
||||||
|
|
||||||
; window position and size
|
; window position and size
|
||||||
push esi
|
push esi
|
||||||
lea esi, [ecx + window_data + WDATA.box]
|
lea esi, [window_data + ecx + WDATA.box]
|
||||||
movsd
|
movsd
|
||||||
movsd
|
movsd
|
||||||
movsd
|
movsd
|
||||||
movsd
|
movsd
|
||||||
|
|
||||||
; Process state (+50)
|
; Process state (+50)
|
||||||
movzx eax, byte [ecx*8 + SLOT_BASE + APPDATA.state]
|
movzx eax, byte [SLOT_BASE + ecx*8 + APPDATA.state]
|
||||||
stosd
|
stosd
|
||||||
|
|
||||||
; Window client area box
|
; Window client area box
|
||||||
lea esi, [ecx*8 + SLOT_BASE + APPDATA.wnd_clientbox]
|
lea esi, [SLOT_BASE + ecx*8 + APPDATA.wnd_clientbox]
|
||||||
movsd
|
movsd
|
||||||
movsd
|
movsd
|
||||||
movsd
|
movsd
|
||||||
movsd
|
movsd
|
||||||
|
|
||||||
; Window state
|
; Window state
|
||||||
mov al, [ecx+window_data+WDATA.fl_wstate]
|
mov al, [window_data + ecx + WDATA.fl_wstate]
|
||||||
stosb
|
stosb
|
||||||
|
|
||||||
; Event mask (+71)
|
; Event mask (+71)
|
||||||
mov EAX, dword [ecx*8 + SLOT_BASE + APPDATA.event_mask]
|
mov EAX, dword [SLOT_BASE + ecx*8 + APPDATA.event_mask]
|
||||||
stosd
|
stosd
|
||||||
|
|
||||||
; Keyboard mode (+75)
|
; Keyboard mode (+75)
|
||||||
mov al, byte [ecx*8 + SLOT_BASE + APPDATA.keyboard_mode]
|
mov al, byte [SLOT_BASE + ecx*8 + APPDATA.keyboard_mode]
|
||||||
stosb
|
stosb
|
||||||
|
|
||||||
pop esi
|
pop esi
|
||||||
@@ -2728,7 +2728,7 @@ sys_redrawstat:
|
|||||||
jnz srl1
|
jnz srl1
|
||||||
|
|
||||||
mov edx, [current_slot_idx] ; return whole screen draw area for this app
|
mov edx, [current_slot_idx] ; return whole screen draw area for this app
|
||||||
shl edx, 5
|
shl edx, 5 ;?
|
||||||
add edx, draw_data
|
add edx, draw_data
|
||||||
mov [edx + RECT.left], 0
|
mov [edx + RECT.left], 0
|
||||||
mov [edx + RECT.top], 0
|
mov [edx + RECT.top], 0
|
||||||
@@ -2770,7 +2770,7 @@ sheduler:
|
|||||||
endg
|
endg
|
||||||
sys_sheduler:
|
sys_sheduler:
|
||||||
;rewritten by <Lrz> 29.12.2009
|
;rewritten by <Lrz> 29.12.2009
|
||||||
jmp dword [sheduler+ebx*4]
|
jmp dword [sheduler + ebx*4]
|
||||||
;.shed_counter:
|
;.shed_counter:
|
||||||
.00:
|
.00:
|
||||||
mov eax, [context_counter]
|
mov eax, [context_counter]
|
||||||
@@ -2906,7 +2906,7 @@ align 4
|
|||||||
.set_mouse_event:
|
.set_mouse_event:
|
||||||
add edi, sizeof.APPDATA
|
add edi, sizeof.APPDATA
|
||||||
add ebx, sizeof.WDATA
|
add ebx, sizeof.WDATA
|
||||||
test [edi + SLOT_BASE + APPDATA.event_mask], 0x80000000
|
test [SLOT_BASE + edi + APPDATA.event_mask], 0x80000000
|
||||||
jz .pos_filter
|
jz .pos_filter
|
||||||
|
|
||||||
cmp edi, [esp] ; skip if filtration active
|
cmp edi, [esp] ; skip if filtration active
|
||||||
@@ -2914,7 +2914,7 @@ align 4
|
|||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.pos_filter:
|
.pos_filter:
|
||||||
test [edi + SLOT_BASE + APPDATA.event_mask], 0x40000000
|
test [SLOT_BASE + edi + APPDATA.event_mask], 0x40000000
|
||||||
jz .set
|
jz .set
|
||||||
|
|
||||||
mov esi, [ebx + WDATA.box.left]
|
mov esi, [ebx + WDATA.box.left]
|
||||||
@@ -2933,7 +2933,7 @@ align 4
|
|||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.set:
|
.set:
|
||||||
or [edi+SLOT_BASE+APPDATA.occurred_events], EVENT_MOUSE
|
or [SLOT_BASE + edi + APPDATA.occurred_events], EVENT_MOUSE
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.skip:
|
.skip:
|
||||||
@@ -2951,14 +2951,14 @@ mouse_not_active:
|
|||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
backgr:
|
backgr:
|
||||||
mov eax, [draw_data+32 + RECT.left]
|
mov eax, [draw_data + 32 + RECT.left]
|
||||||
shl eax, 16
|
shl eax, 16
|
||||||
add eax, [draw_data+32 + RECT.right]
|
add eax, [draw_data + 32 + RECT.right]
|
||||||
mov [BG_Rect_X_left_right], eax ; [left]*65536 + [right]
|
mov [BG_Rect_X_left_right], eax ; [left]*65536 + [right]
|
||||||
|
|
||||||
mov eax, [draw_data+32 + RECT.top]
|
mov eax, [draw_data + 32 + RECT.top]
|
||||||
shl eax, 16
|
shl eax, 16
|
||||||
add eax, [draw_data+32 + RECT.bottom]
|
add eax, [draw_data + 32 + RECT.bottom]
|
||||||
mov [BG_Rect_Y_top_bottom], eax ; [top]*65536 + [bottom]
|
mov [BG_Rect_Y_top_bottom], eax ; [top]*65536 + [bottom]
|
||||||
|
|
||||||
call drawbackground
|
call drawbackground
|
||||||
@@ -2975,33 +2975,33 @@ set_bgr_event:
|
|||||||
add edi, sizeof.APPDATA
|
add edi, sizeof.APPDATA
|
||||||
mov eax, [BG_Rect_X_left_right]
|
mov eax, [BG_Rect_X_left_right]
|
||||||
mov edx, [BG_Rect_Y_top_bottom]
|
mov edx, [BG_Rect_Y_top_bottom]
|
||||||
cmp [edi+SLOT_BASE+APPDATA.draw_bgr_x], 0
|
cmp [SLOT_BASE + edi + APPDATA.draw_bgr_x], 0
|
||||||
jz .set
|
jz .set
|
||||||
.join:
|
.join:
|
||||||
cmp word [edi+SLOT_BASE+APPDATA.draw_bgr_x], ax
|
cmp word [SLOT_BASE + edi + APPDATA.draw_bgr_x], ax
|
||||||
jae @f
|
jae @f
|
||||||
mov word [edi+SLOT_BASE+APPDATA.draw_bgr_x], ax
|
mov word [SLOT_BASE + edi + APPDATA.draw_bgr_x], ax
|
||||||
@@:
|
@@:
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
cmp word [edi+SLOT_BASE+APPDATA.draw_bgr_x+2], ax
|
cmp word [SLOT_BASE + edi + APPDATA.draw_bgr_x + 2], ax
|
||||||
jbe @f
|
jbe @f
|
||||||
mov word [edi+SLOT_BASE+APPDATA.draw_bgr_x+2], ax
|
mov word [SLOT_BASE + edi + APPDATA.draw_bgr_x + 2], ax
|
||||||
@@:
|
@@:
|
||||||
cmp word [edi+SLOT_BASE+APPDATA.draw_bgr_y], dx
|
cmp word [SLOT_BASE + edi + APPDATA.draw_bgr_y], dx
|
||||||
jae @f
|
jae @f
|
||||||
mov word [edi+SLOT_BASE+APPDATA.draw_bgr_y], dx
|
mov word [SLOT_BASE + edi + APPDATA.draw_bgr_y], dx
|
||||||
@@:
|
@@:
|
||||||
shr edx, 16
|
shr edx, 16
|
||||||
cmp word [edi+SLOT_BASE+APPDATA.draw_bgr_y+2], dx
|
cmp word [SLOT_BASE + edi + APPDATA.draw_bgr_y+2], dx
|
||||||
jbe @f
|
jbe @f
|
||||||
mov word [edi+SLOT_BASE+APPDATA.draw_bgr_y+2], dx
|
mov word [SLOT_BASE + edi + APPDATA.draw_bgr_y+2], dx
|
||||||
@@:
|
@@:
|
||||||
jmp .common
|
jmp .common
|
||||||
.set:
|
.set:
|
||||||
mov [edi+SLOT_BASE+APPDATA.draw_bgr_x], eax
|
mov [SLOT_BASE + edi + APPDATA.draw_bgr_x], eax
|
||||||
mov [edi+SLOT_BASE+APPDATA.draw_bgr_y], edx
|
mov [SLOT_BASE + edi + APPDATA.draw_bgr_y], edx
|
||||||
.common:
|
.common:
|
||||||
or [edi+SLOT_BASE+APPDATA.occurred_events], EVENT_BACKGROUND
|
or [SLOT_BASE + edi + APPDATA.occurred_events], EVENT_BACKGROUND
|
||||||
loop set_bgr_event
|
loop set_bgr_event
|
||||||
pop edi ecx
|
pop edi ecx
|
||||||
;--------- set event 5 stop -----------
|
;--------- set event 5 stop -----------
|
||||||
@@ -3009,10 +3009,10 @@ set_bgr_event:
|
|||||||
jnz backgr
|
jnz backgr
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [draw_data+32 + RECT.left], eax
|
mov [draw_data + 32 + RECT.left], eax
|
||||||
mov [draw_data+32 + RECT.top], eax
|
mov [draw_data + 32 + RECT.top], eax
|
||||||
mov [draw_data+32 + RECT.right], eax
|
mov [draw_data + 32 + RECT.right], eax
|
||||||
mov [draw_data+32 + RECT.bottom], eax
|
mov [draw_data + 32 + RECT.bottom], eax
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
nobackgr:
|
nobackgr:
|
||||||
@@ -3034,7 +3034,7 @@ markz:
|
|||||||
push ecx edx
|
push ecx edx
|
||||||
cmp [edx + APPDATA.state], TSTATE_FREE
|
cmp [edx + APPDATA.state], TSTATE_FREE
|
||||||
jz .nokill
|
jz .nokill
|
||||||
cmp [edx+APPDATA.process], sys_proc
|
cmp [edx + APPDATA.process], sys_proc
|
||||||
jz .nokill
|
jz .nokill
|
||||||
call request_terminate
|
call request_terminate
|
||||||
jmp .common
|
jmp .common
|
||||||
@@ -3066,15 +3066,15 @@ noshutdown:
|
|||||||
align 4
|
align 4
|
||||||
newct:
|
newct:
|
||||||
mov cl, [ebx]
|
mov cl, [ebx]
|
||||||
cmp cl, byte 3
|
cmp cl, TSTATE_ZOMBIE
|
||||||
jz .terminate
|
jz .terminate
|
||||||
|
|
||||||
cmp cl, byte 4
|
cmp cl, TSTATE_TERMINATING
|
||||||
jnz .noterminate
|
jnz .noterminate
|
||||||
.terminate:
|
.terminate:
|
||||||
pushad
|
pushad
|
||||||
mov ecx, eax
|
mov ecx, eax
|
||||||
shl ecx, 8
|
shl ecx, BSF sizeof.APPDATA
|
||||||
add ecx, SLOT_BASE
|
add ecx, SLOT_BASE
|
||||||
call restore_default_cursor_before_killing
|
call restore_default_cursor_before_killing
|
||||||
popad
|
popad
|
||||||
@@ -3113,7 +3113,7 @@ newdw2:
|
|||||||
push ecx
|
push ecx
|
||||||
|
|
||||||
mov eax, ecx
|
mov eax, ecx
|
||||||
shl eax, 5
|
shl eax, BSF sizeof.WDATA
|
||||||
add eax, window_data
|
add eax, window_data
|
||||||
|
|
||||||
cmp eax, [esp+4]
|
cmp eax, [esp+4]
|
||||||
@@ -3167,9 +3167,9 @@ bgli:
|
|||||||
jz .az
|
jz .az
|
||||||
|
|
||||||
mov dl, 0
|
mov dl, 0
|
||||||
lea eax, [edi+draw_data-window_data]
|
lea eax, [edi + draw_data - window_data]
|
||||||
mov ebx, [draw_limits.left]
|
mov ebx, [draw_limits.left]
|
||||||
cmp ebx, [eax+RECT.left]
|
cmp ebx, [eax + RECT.left]
|
||||||
jae @f
|
jae @f
|
||||||
|
|
||||||
mov [eax+RECT.left], ebx
|
mov [eax+RECT.left], ebx
|
||||||
@@ -3178,16 +3178,16 @@ bgli:
|
|||||||
align 4
|
align 4
|
||||||
@@:
|
@@:
|
||||||
mov ebx, [draw_limits.top]
|
mov ebx, [draw_limits.top]
|
||||||
cmp ebx, [eax+RECT.top]
|
cmp ebx, [eax + RECT.top]
|
||||||
jae @f
|
jae @f
|
||||||
|
|
||||||
mov [eax+RECT.top], ebx
|
mov [eax + RECT.top], ebx
|
||||||
mov dl, 1
|
mov dl, 1
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
@@:
|
@@:
|
||||||
mov ebx, [draw_limits.right]
|
mov ebx, [draw_limits.right]
|
||||||
cmp ebx, [eax+RECT.right]
|
cmp ebx, [eax + RECT.right]
|
||||||
jbe @f
|
jbe @f
|
||||||
|
|
||||||
mov [eax+RECT.right], ebx
|
mov [eax+RECT.right], ebx
|
||||||
@@ -3196,10 +3196,10 @@ align 4
|
|||||||
align 4
|
align 4
|
||||||
@@:
|
@@:
|
||||||
mov ebx, [draw_limits.bottom]
|
mov ebx, [draw_limits.bottom]
|
||||||
cmp ebx, [eax+RECT.bottom]
|
cmp ebx, [eax + RECT.bottom]
|
||||||
jbe @f
|
jbe @f
|
||||||
|
|
||||||
mov [eax+RECT.bottom], ebx
|
mov [eax + RECT.bottom], ebx
|
||||||
mov dl, 1
|
mov dl, 1
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
@@ -3312,7 +3312,7 @@ calculatebackground: ; background
|
|||||||
mov ecx, [_display.win_map_size]
|
mov ecx, [_display.win_map_size]
|
||||||
shr ecx, 2
|
shr ecx, 2
|
||||||
rep stosd
|
rep stosd
|
||||||
mov byte[window_data+32+WDATA.z_modif], ZPOS_DESKTOP
|
mov byte[window_data + 32 + WDATA.z_modif], ZPOS_DESKTOP
|
||||||
mov [REDRAW_BACKGROUND], 0
|
mov [REDRAW_BACKGROUND], 0
|
||||||
ret
|
ret
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
@@ -3591,7 +3591,7 @@ no_unmask_io:
|
|||||||
shl eax, 4
|
shl eax, 4
|
||||||
add eax, RESERVED_PORTS
|
add eax, RESERVED_PORTS
|
||||||
mov ebx, [current_slot]
|
mov ebx, [current_slot]
|
||||||
mov ebx, [ebx+APPDATA.tid]
|
mov ebx, [ebx + APPDATA.tid]
|
||||||
mov [eax], ebx
|
mov [eax], ebx
|
||||||
mov [eax+4], ecx
|
mov [eax+4], ecx
|
||||||
mov [eax+8], edx
|
mov [eax+8], edx
|
||||||
@@ -3606,7 +3606,7 @@ free_port_area:
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz frpal2
|
jz frpal2
|
||||||
mov ebx, [current_slot]
|
mov ebx, [current_slot]
|
||||||
mov ebx, [ebx+APPDATA.tid]
|
mov ebx, [ebx + APPDATA.tid]
|
||||||
frpal3:
|
frpal3:
|
||||||
mov edi, eax
|
mov edi, eax
|
||||||
shl edi, 4
|
shl edi, 4
|
||||||
@@ -3704,9 +3704,9 @@ align 4
|
|||||||
align 4
|
align 4
|
||||||
@@:
|
@@:
|
||||||
mov edi, [current_slot]
|
mov edi, [current_slot]
|
||||||
add dx, word[edi+APPDATA.wnd_clientbox.top]
|
add dx, word[edi + APPDATA.wnd_clientbox.top]
|
||||||
rol edx, 16
|
rol edx, 16
|
||||||
add dx, word[edi+APPDATA.wnd_clientbox.left]
|
add dx, word[edi + APPDATA.wnd_clientbox.left]
|
||||||
rol edx, 16
|
rol edx, 16
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
@@ -3741,9 +3741,9 @@ sys_putimage_palette:
|
|||||||
|
|
||||||
mov eax, [current_slot_idx]
|
mov eax, [current_slot_idx]
|
||||||
shl eax, 8
|
shl eax, 8
|
||||||
add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.top]
|
add dx, word [SLOT_BASE + eax + APPDATA.wnd_clientbox.top]
|
||||||
rol edx, 16
|
rol edx, 16
|
||||||
add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.left]
|
add dx, word [SLOT_BASE + eax + APPDATA.wnd_clientbox.left]
|
||||||
rol edx, 16
|
rol edx, 16
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
@@ -3881,7 +3881,7 @@ putimage_get8bpp:
|
|||||||
movzx eax, byte [esi]
|
movzx eax, byte [esi]
|
||||||
push edx
|
push edx
|
||||||
mov edx, [esp+8]
|
mov edx, [esp+8]
|
||||||
mov eax, [edx+eax*4]
|
mov eax, [edx + eax*4]
|
||||||
pop edx
|
pop edx
|
||||||
inc esi
|
inc esi
|
||||||
ret 4
|
ret 4
|
||||||
@@ -3953,7 +3953,7 @@ putimage_get2bpp:
|
|||||||
mov [edx], ah
|
mov [edx], ah
|
||||||
mov edx, [edx+4]
|
mov edx, [edx+4]
|
||||||
movzx eax, al
|
movzx eax, al
|
||||||
mov eax, [edx+eax*4]
|
mov eax, [edx + eax*4]
|
||||||
pop edx
|
pop edx
|
||||||
ret 4
|
ret 4
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
@@ -3978,7 +3978,7 @@ putimage_get4bpp:
|
|||||||
movzx eax, byte [edx+1]
|
movzx eax, byte [edx+1]
|
||||||
mov edx, [edx+4]
|
mov edx, [edx+4]
|
||||||
and eax, 0x0F
|
and eax, 0x0F
|
||||||
mov eax, [edx+eax*4]
|
mov eax, [edx + eax*4]
|
||||||
pop edx
|
pop edx
|
||||||
ret 4
|
ret 4
|
||||||
@@:
|
@@:
|
||||||
@@ -3987,7 +3987,7 @@ putimage_get4bpp:
|
|||||||
mov [edx+1], al
|
mov [edx+1], al
|
||||||
shr eax, 4
|
shr eax, 4
|
||||||
mov edx, [edx+4]
|
mov edx, [edx+4]
|
||||||
mov eax, [edx+eax*4]
|
mov eax, [edx + eax*4]
|
||||||
pop edx
|
pop edx
|
||||||
ret 4
|
ret 4
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
@@ -4293,7 +4293,7 @@ sys_process_def:
|
|||||||
jae .not_support ;if >=8 then or eax,-1
|
jae .not_support ;if >=8 then or eax,-1
|
||||||
|
|
||||||
mov edi, [current_slot_idx]
|
mov edi, [current_slot_idx]
|
||||||
jmp dword [f66call+ebx*4]
|
jmp dword [f66call + ebx*4]
|
||||||
|
|
||||||
.not_support:
|
.not_support:
|
||||||
or eax, -1
|
or eax, -1
|
||||||
@@ -4301,15 +4301,15 @@ sys_process_def:
|
|||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.1:
|
.1:
|
||||||
shl edi, 8
|
shl edi, BSF sizeof.APPDATA
|
||||||
mov [edi+SLOT_BASE + APPDATA.keyboard_mode], cl
|
mov [SLOT_BASE + edi + APPDATA.keyboard_mode], cl
|
||||||
|
|
||||||
ret
|
ret
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.2: ; 2 = get keyboard mode
|
.2: ; 2 = get keyboard mode
|
||||||
shl edi, 8
|
shl edi, BSF sizeof.APPDATA
|
||||||
movzx eax, byte [SLOT_BASE+edi + APPDATA.keyboard_mode]
|
movzx eax, byte [SLOT_BASE + edi + APPDATA.keyboard_mode]
|
||||||
mov [esp+32], eax
|
mov [esp+32], eax
|
||||||
ret
|
ret
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
@@ -4391,7 +4391,7 @@ align 4
|
|||||||
; get current PID
|
; get current PID
|
||||||
mov eax, [current_slot_idx]
|
mov eax, [current_slot_idx]
|
||||||
shl eax, BSF sizeof.APPDATA
|
shl eax, BSF sizeof.APPDATA
|
||||||
mov eax, [eax+SLOT_BASE+APPDATA.tid]
|
mov eax, [eax + SLOT_BASE+APPDATA.tid]
|
||||||
; set current PID for lock input
|
; set current PID for lock input
|
||||||
mov [PID_lock_input], eax
|
mov [PID_lock_input], eax
|
||||||
@@:
|
@@:
|
||||||
@@ -4406,7 +4406,7 @@ align 4
|
|||||||
; get current PID
|
; get current PID
|
||||||
mov ebx, [current_slot_idx]
|
mov ebx, [current_slot_idx]
|
||||||
shl ebx, BSF sizeof.APPDATA
|
shl ebx, BSF sizeof.APPDATA
|
||||||
mov ebx, [ebx+SLOT_BASE+APPDATA.tid]
|
mov ebx, [ebx + SLOT_BASE+APPDATA.tid]
|
||||||
; compare current lock input with current PID
|
; compare current lock input with current PID
|
||||||
cmp ebx, eax
|
cmp ebx, eax
|
||||||
jne @f
|
jne @f
|
||||||
@@ -4439,7 +4439,7 @@ sys_gs: ; direct screen access
|
|||||||
dec ebx
|
dec ebx
|
||||||
cmp ebx, 2
|
cmp ebx, 2
|
||||||
ja .not_support
|
ja .not_support
|
||||||
jmp dword [f61call+ebx*4]
|
jmp dword [f61call + ebx*4]
|
||||||
.not_support:
|
.not_support:
|
||||||
or [esp+32], dword -1
|
or [esp+32], dword -1
|
||||||
ret
|
ret
|
||||||
@@ -4482,7 +4482,7 @@ syscall_cdaudio:
|
|||||||
mov eax, ecx
|
mov eax, ecx
|
||||||
shr eax, 2
|
shr eax, 2
|
||||||
lea eax, [eax*5]
|
lea eax, [eax*5]
|
||||||
mov al, [eax+DRIVE_DATA+1]
|
mov al, [eax + DRIVE_DATA + 1]
|
||||||
|
|
||||||
push ecx ebx
|
push ecx ebx
|
||||||
mov ebx, ecx
|
mov ebx, ecx
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License. ;;
|
;; Distributed under terms of the GNU General Public License. ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2013-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2013-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2020. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -52,23 +52,7 @@
|
|||||||
; 0018 dword color of frames
|
; 0018 dword color of frames
|
||||||
; 001C dword window flags, +30 = window drawn, +31 redraw flag
|
; 001C dword window flags, +30 = window drawn, +31 redraw flag
|
||||||
;
|
;
|
||||||
; 3000 -> 4FFF task list - 256 entries
|
; 3000 -> 4FFF free
|
||||||
;
|
|
||||||
; 00 dword process count
|
|
||||||
; 04 dword no of processes
|
|
||||||
; 10 dword base of running process at 0x3000+
|
|
||||||
;
|
|
||||||
; 20 dword application event mask
|
|
||||||
; 24 dword PID - process identification number
|
|
||||||
; 2a byte slot state: 0=running, 1,2=suspended
|
|
||||||
; 3=zombie, 4=terminate,
|
|
||||||
; 5=waiting for event, 9 = not used
|
|
||||||
; 2e byte window number on screen
|
|
||||||
; 30 dword exact position in memory
|
|
||||||
; 34 dword counter sum
|
|
||||||
; 38 dword time stamp counter add
|
|
||||||
; 3c dword cpu usage in cpu timer tics
|
|
||||||
;
|
|
||||||
;
|
;
|
||||||
; 5000 -> 68FF free (6k6)
|
; 5000 -> 68FF free (6k6)
|
||||||
; 6900 -> 6EFF saved picture under mouse pointer (1k5)
|
; 6900 -> 6EFF saved picture under mouse pointer (1k5)
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2017. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License. ;;
|
;; Distributed under terms of the GNU General Public License. ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -17,12 +17,12 @@ create_futex:
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
mov [eax+FUTEX.magic], 'FUTX'
|
mov [eax + FUTEX.magic], 'FUTX'
|
||||||
mov [eax+FUTEX.destroy], 0
|
mov [eax + FUTEX.destroy], 0
|
||||||
mov [eax+FUTEX.pointer], ecx
|
mov [eax + FUTEX.pointer], ecx
|
||||||
lea ecx, [eax+FUTEX.wait_list]
|
lea ecx, [eax + FUTEX.wait_list]
|
||||||
list_init ecx
|
list_init ecx
|
||||||
mov [eax+FUTEX.flags], 0
|
mov [eax + FUTEX.flags], 0
|
||||||
.fail:
|
.fail:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -31,19 +31,19 @@ align 4
|
|||||||
destroy_futex:
|
destroy_futex:
|
||||||
push esi
|
push esi
|
||||||
mov esi, [current_process]
|
mov esi, [current_process]
|
||||||
mov edx, [ecx+FUTEX.handle]
|
mov edx, [ecx + FUTEX.handle]
|
||||||
|
|
||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
|
|
||||||
lea eax, [ecx+FUTEX.wait_list]
|
lea eax, [ecx + FUTEX.wait_list]
|
||||||
cmp eax, [eax+LHEAD.next]
|
cmp eax, [eax + LHEAD.next]
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
mov eax, [esi+PROC.ht_next]
|
mov eax, [esi + PROC.ht_next]
|
||||||
mov [esi+PROC.htab+edx*4], eax
|
mov [esi + PROC.htab + edx*4], eax
|
||||||
mov [esi+PROC.ht_next], edx
|
mov [esi + PROC.ht_next], edx
|
||||||
inc [esi+PROC.ht_free]
|
inc [esi + PROC.ht_free]
|
||||||
|
|
||||||
popfd
|
popfd
|
||||||
pop esi
|
pop esi
|
||||||
@@ -67,21 +67,21 @@ sys_futex:
|
|||||||
jae .fail
|
jae .fail
|
||||||
|
|
||||||
mov edi, [current_process]
|
mov edi, [current_process]
|
||||||
mov ebp, [edi+PROC.htab+ecx*4]
|
mov ebp, [edi + PROC.htab + ecx*4]
|
||||||
|
|
||||||
cmp [ebp+FUTEX.magic], 'FUTX'
|
cmp [ebp + FUTEX.magic], 'FUTX'
|
||||||
jne .fail
|
jne .fail
|
||||||
cmp [ebp+FUTEX.handle], ecx
|
cmp [ebp + FUTEX.handle], ecx
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
jmp dword [sys_futex_call+ebx*4-4]
|
jmp dword [sys_futex_call + ebx*4-4]
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
.requeue:
|
.requeue:
|
||||||
.cmp_requeue:
|
.cmp_requeue:
|
||||||
.wait_bitset:
|
.wait_bitset:
|
||||||
.wake_bitset:
|
.wake_bitset:
|
||||||
mov [esp+SYSCALL_STACK._eax], -1
|
mov [esp + SYSCALL_STACK._eax], -1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@@ -89,9 +89,9 @@ align 4
|
|||||||
call create_futex
|
call create_futex
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz @F
|
jz @F
|
||||||
mov eax, [eax+FUTEX.handle]
|
mov eax, [eax + FUTEX.handle]
|
||||||
@@:
|
@@:
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@@ -101,7 +101,7 @@ align 4
|
|||||||
.destroy:
|
.destroy:
|
||||||
mov ecx, ebp
|
mov ecx, ebp
|
||||||
call destroy_futex
|
call destroy_futex
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@@ -113,12 +113,12 @@ align 4
|
|||||||
.wait:
|
.wait:
|
||||||
test esi, esi
|
test esi, esi
|
||||||
jnz .wait_timeout
|
jnz .wait_timeout
|
||||||
mov ecx, [ebp+FUTEX.pointer]
|
mov ecx, [ebp + FUTEX.pointer]
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
lock cmpxchg [ecx], edx
|
lock cmpxchg [ecx], edx
|
||||||
je .wait_slow
|
je .wait_slow
|
||||||
|
|
||||||
mov [esp+SYSCALL_STACK._eax], -2
|
mov [esp + SYSCALL_STACK._eax], -2
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.wait_slow:
|
.wait_slow:
|
||||||
@@ -127,8 +127,8 @@ align 4
|
|||||||
|
|
||||||
sub esp, sizeof.MUTEX_WAITER
|
sub esp, sizeof.MUTEX_WAITER
|
||||||
mov ebx, [current_slot]
|
mov ebx, [current_slot]
|
||||||
mov [esp+MUTEX_WAITER.task], ebx
|
mov [esp + MUTEX_WAITER.task], ebx
|
||||||
lea esi, [ebp+FUTEX.wait_list]
|
lea esi, [ebp + FUTEX.wait_list]
|
||||||
|
|
||||||
list_add_tail esp, esi ;esp= new waiter, esi= list head
|
list_add_tail esp, esi ;esp= new waiter, esi= list head
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
@@ -143,7 +143,7 @@ align 4
|
|||||||
add esp, sizeof.MUTEX_WAITER
|
add esp, sizeof.MUTEX_WAITER
|
||||||
|
|
||||||
popfd
|
popfd
|
||||||
mov [esp+SYSCALL_STACK._eax], 0
|
mov [esp + SYSCALL_STACK._eax], 0
|
||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@@ -154,12 +154,12 @@ align 4
|
|||||||
;ebp futex object
|
;ebp futex object
|
||||||
|
|
||||||
.wait_timeout:
|
.wait_timeout:
|
||||||
mov ecx, [ebp+FUTEX.pointer]
|
mov ecx, [ebp + FUTEX.pointer]
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
lock cmpxchg [ecx], edx ;wait until old_value == new_value
|
lock cmpxchg [ecx], edx ;wait until old_value == new_value
|
||||||
je .wait_slow_timeout
|
je .wait_slow_timeout
|
||||||
|
|
||||||
mov [esp+SYSCALL_STACK._eax], -2
|
mov [esp + SYSCALL_STACK._eax], -2
|
||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@@ -174,21 +174,21 @@ align 4
|
|||||||
sub esp, sizeof.MUTEX_WAITER
|
sub esp, sizeof.MUTEX_WAITER
|
||||||
|
|
||||||
mov ebx, [current_slot]
|
mov ebx, [current_slot]
|
||||||
mov [ebx+APPDATA.wait_test], sys_futex.wait_test
|
mov [ebx + APPDATA.wait_test], sys_futex.wait_test
|
||||||
mov [ebx+APPDATA.wait_timeout], esi
|
mov [ebx + APPDATA.wait_timeout], esi
|
||||||
mov [ebx+APPDATA.wait_param], ebp
|
mov [ebx + APPDATA.wait_param], ebp
|
||||||
mov eax, [timer_ticks]
|
mov eax, [timer_ticks]
|
||||||
mov [ebx+APPDATA.wait_begin], eax
|
mov [ebx + APPDATA.wait_begin], eax
|
||||||
mov [ebx + APPDATA.state], TSTATE_WAITING
|
mov [ebx + APPDATA.state], TSTATE_WAITING
|
||||||
|
|
||||||
mov [esp+MUTEX_WAITER.task], ebx
|
mov [esp + MUTEX_WAITER.task], ebx
|
||||||
lea esi, [ebp+FUTEX.wait_list]
|
lea esi, [ebp + FUTEX.wait_list]
|
||||||
|
|
||||||
list_add_tail esp, esi ;esp= new waiter, esi= list head
|
list_add_tail esp, esi ;esp= new waiter, esi= list head
|
||||||
|
|
||||||
.again_timeout:
|
.again_timeout:
|
||||||
call change_task
|
call change_task
|
||||||
mov eax, [ebx+APPDATA.wait_param]
|
mov eax, [ebx + APPDATA.wait_param]
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .timeout
|
jz .timeout
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ align 4
|
|||||||
add esp, sizeof.MUTEX_WAITER
|
add esp, sizeof.MUTEX_WAITER
|
||||||
|
|
||||||
popfd
|
popfd
|
||||||
mov [esp+SYSCALL_STACK._eax], 0
|
mov [esp + SYSCALL_STACK._eax], 0
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.timeout:
|
.timeout:
|
||||||
@@ -208,7 +208,7 @@ align 4
|
|||||||
add esp, sizeof.MUTEX_WAITER
|
add esp, sizeof.MUTEX_WAITER
|
||||||
|
|
||||||
popfd
|
popfd
|
||||||
mov [esp+SYSCALL_STACK._eax], -1
|
mov [esp + SYSCALL_STACK._eax], -1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
@@ -224,21 +224,21 @@ align 4
|
|||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
|
|
||||||
lea ebx, [ebp+FUTEX.wait_list]
|
lea ebx, [ebp + FUTEX.wait_list]
|
||||||
mov esi, [ebx+LHEAD.next]
|
mov esi, [ebx + LHEAD.next]
|
||||||
.again_wake:
|
.again_wake:
|
||||||
cmp esi, ebx
|
cmp esi, ebx
|
||||||
je .done
|
je .done
|
||||||
|
|
||||||
mov eax, [esi+MUTEX_WAITER.task]
|
mov eax, [esi + MUTEX_WAITER.task]
|
||||||
mov [eax + APPDATA.state], TSTATE_RUNNING
|
mov [eax + APPDATA.state], TSTATE_RUNNING
|
||||||
|
|
||||||
mov esi, [esi+MUTEX_WAITER.list.next]
|
mov esi, [esi + MUTEX_WAITER.list.next]
|
||||||
inc ecx
|
inc ecx
|
||||||
cmp ecx, edx
|
cmp ecx, edx
|
||||||
jb .again_wake
|
jb .again_wake
|
||||||
.done:
|
.done:
|
||||||
popfd
|
popfd
|
||||||
mov [esp+SYSCALL_STACK._eax], ecx
|
mov [esp + SYSCALL_STACK._eax], ecx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2017. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License. ;;
|
;; Distributed under terms of the GNU General Public License. ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -72,50 +72,50 @@ sys_pipe2:
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .err_3
|
jz .err_3
|
||||||
|
|
||||||
mov [ebp+PIPE.pipe_ops], pipe_file_ops
|
mov [ebp + PIPE.pipe_ops], pipe_file_ops
|
||||||
mov [ebp+PIPE.buffer], eax
|
mov [ebp + PIPE.buffer], eax
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [ebp+PIPE.count], eax
|
mov [ebp + PIPE.count], eax
|
||||||
mov [ebp+PIPE.read_end], eax
|
mov [ebp + PIPE.read_end], eax
|
||||||
mov [ebp+PIPE.write_end], eax
|
mov [ebp + PIPE.write_end], eax
|
||||||
|
|
||||||
inc eax
|
inc eax
|
||||||
mov [ebp+PIPE.readers], eax
|
mov [ebp + PIPE.readers], eax
|
||||||
mov [ebp+PIPE.writers], eax
|
mov [ebp + PIPE.writers], eax
|
||||||
|
|
||||||
lea ecx, [ebp+PIPE.pipe_lock]
|
lea ecx, [ebp + PIPE.pipe_lock]
|
||||||
call mutex_init
|
call mutex_init
|
||||||
|
|
||||||
lea ecx, [ebp+PIPE.rlist]
|
lea ecx, [ebp + PIPE.rlist]
|
||||||
list_init ecx
|
list_init ecx
|
||||||
|
|
||||||
lea ecx, [ebp+PIPE.wlist]
|
lea ecx, [ebp + PIPE.wlist]
|
||||||
list_init ecx
|
list_init ecx
|
||||||
|
|
||||||
mov eax, [.fdread]
|
mov eax, [.fdread]
|
||||||
mov edx, [.fdwrite]
|
mov edx, [.fdwrite]
|
||||||
mov ecx, [.pipefd]
|
mov ecx, [.pipefd]
|
||||||
|
|
||||||
mov [eax+FILED.magic], 'PIPE'
|
mov [eax + FILED.magic], 'PIPE'
|
||||||
mov [eax+FILED.destroy], 0
|
mov [eax + FILED.destroy], 0
|
||||||
mov [eax+FILED.mode], F_READ
|
mov [eax + FILED.mode], F_READ
|
||||||
mov [eax+FILED.file], ebp
|
mov [eax + FILED.file], ebp
|
||||||
|
|
||||||
mov [edx+FILED.magic], 'PIPE'
|
mov [edx + FILED.magic], 'PIPE'
|
||||||
mov [edx+FILED.destroy], 0
|
mov [edx + FILED.destroy], 0
|
||||||
mov [edx+FILED.mode], F_WRITE
|
mov [edx + FILED.mode], F_WRITE
|
||||||
mov [edx+FILED.file], ebp
|
mov [edx + FILED.file], ebp
|
||||||
|
|
||||||
mov eax, [eax+FILED.handle]
|
mov eax, [eax + FILED.handle]
|
||||||
mov edx, [edx+FILED.handle]
|
mov edx, [edx + FILED.handle]
|
||||||
|
|
||||||
mov [ecx], eax
|
mov [ecx], eax
|
||||||
mov [ecx+4], edx
|
mov [ecx+4], edx
|
||||||
add esp, 5*4
|
add esp, 5*4
|
||||||
pop ebp
|
pop ebp
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
.err_3:
|
.err_3:
|
||||||
mov eax, ebp
|
mov eax, ebp
|
||||||
@@ -132,7 +132,7 @@ sys_pipe2:
|
|||||||
.fail:
|
.fail:
|
||||||
mov eax, ebp
|
mov eax, ebp
|
||||||
pop ebp
|
pop ebp
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
purge .pipeflags
|
purge .pipeflags
|
||||||
@@ -151,14 +151,14 @@ pipe_read:
|
|||||||
|
|
||||||
mov edi, edx
|
mov edi, edx
|
||||||
|
|
||||||
lea ecx, [ebp+PIPE.pipe_lock]
|
lea ecx, [ebp + PIPE.pipe_lock]
|
||||||
call mutex_lock
|
call mutex_lock
|
||||||
.again:
|
.again:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
cmp eax, [ebp+PIPE.writers]
|
cmp eax, [ebp + PIPE.writers]
|
||||||
je .eof
|
je .eof
|
||||||
|
|
||||||
mov ecx, [ebp+PIPE.count]
|
mov ecx, [ebp + PIPE.count]
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz .wait
|
jz .wait
|
||||||
|
|
||||||
@@ -167,33 +167,33 @@ pipe_read:
|
|||||||
jb .read
|
jb .read
|
||||||
mov ecx, esi
|
mov ecx, esi
|
||||||
.read:
|
.read:
|
||||||
mov esi, [ebp+PIPE.buffer]
|
mov esi, [ebp + PIPE.buffer]
|
||||||
add esi, [ebp+PIPE.read_end]
|
add esi, [ebp + PIPE.read_end]
|
||||||
mov [esp+SYSCALL_STACK._eax], ecx
|
mov [esp + SYSCALL_STACK._eax], ecx
|
||||||
sub [ebp+PIPE.count], ecx
|
sub [ebp + PIPE.count], ecx
|
||||||
cld
|
cld
|
||||||
rep movsb
|
rep movsb
|
||||||
and esi, 0xFFF
|
and esi, 0xFFF
|
||||||
mov [ebp+PIPE.read_end], esi
|
mov [ebp + PIPE.read_end], esi
|
||||||
|
|
||||||
lea ecx, [ebp+PIPE.wlist]
|
lea ecx, [ebp + PIPE.wlist]
|
||||||
cmp ecx, [ebp+PIPE.wlist.next]
|
cmp ecx, [ebp + PIPE.wlist.next]
|
||||||
je @F
|
je @F
|
||||||
|
|
||||||
mov ecx, [ecx+MUTEX_WAITER.task]
|
mov ecx, [ecx + MUTEX_WAITER.task]
|
||||||
mov [ecx + APPDATA.state], TSTATE_RUNNING ;activate writer task
|
mov [ecx + APPDATA.state], TSTATE_RUNNING ;activate writer task
|
||||||
@@:
|
@@:
|
||||||
cmp [ebp+PIPE.count], 0
|
cmp [ebp + PIPE.count], 0
|
||||||
je @F
|
je @F
|
||||||
|
|
||||||
lea eax, [ebp+PIPE.rlist]
|
lea eax, [ebp + PIPE.rlist]
|
||||||
cmp eax, [ebp+PIPE.rlist.next]
|
cmp eax, [ebp + PIPE.rlist.next]
|
||||||
je @F
|
je @F
|
||||||
|
|
||||||
mov eax, [eax+MUTEX_WAITER.task]
|
mov eax, [eax + MUTEX_WAITER.task]
|
||||||
mov [eax + APPDATA.state], TSTATE_RUNNING ;activate reader task
|
mov [eax + APPDATA.state], TSTATE_RUNNING ;activate reader task
|
||||||
@@:
|
@@:
|
||||||
lea ecx, [ebp+PIPE.pipe_lock]
|
lea ecx, [ebp + PIPE.pipe_lock]
|
||||||
call mutex_unlock
|
call mutex_unlock
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -203,18 +203,18 @@ pipe_read:
|
|||||||
|
|
||||||
sub esp, sizeof.MUTEX_WAITER
|
sub esp, sizeof.MUTEX_WAITER
|
||||||
mov ebx, [current_slot]
|
mov ebx, [current_slot]
|
||||||
mov [esp+MUTEX_WAITER.task], ebx
|
mov [esp + MUTEX_WAITER.task], ebx
|
||||||
lea edx, [ebp+PIPE.rlist]
|
lea edx, [ebp + PIPE.rlist]
|
||||||
|
|
||||||
list_add_tail esp, edx ;esp= new waiter, edx= list head
|
list_add_tail esp, edx ;esp= new waiter, edx= list head
|
||||||
|
|
||||||
lea ecx, [ebp+PIPE.pipe_lock]
|
lea ecx, [ebp + PIPE.pipe_lock]
|
||||||
call mutex_unlock
|
call mutex_unlock
|
||||||
|
|
||||||
mov [ebx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
mov [ebx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||||
call change_task
|
call change_task
|
||||||
|
|
||||||
lea ecx, [ebp+PIPE.pipe_lock]
|
lea ecx, [ebp + PIPE.pipe_lock]
|
||||||
call mutex_lock
|
call mutex_lock
|
||||||
|
|
||||||
list_del esp
|
list_del esp
|
||||||
@@ -223,8 +223,8 @@ pipe_read:
|
|||||||
jmp .again
|
jmp .again
|
||||||
|
|
||||||
.eof:
|
.eof:
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
lea ecx, [ebp+PIPE.pipe_lock]
|
lea ecx, [ebp + PIPE.pipe_lock]
|
||||||
call mutex_unlock
|
call mutex_unlock
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -241,15 +241,15 @@ pipe_write:
|
|||||||
mov ebx, esi ;ebx = write count
|
mov ebx, esi ;ebx = write count
|
||||||
mov esi, edx ;esi = src
|
mov esi, edx ;esi = src
|
||||||
|
|
||||||
lea ecx, [ebp+PIPE.pipe_lock]
|
lea ecx, [ebp + PIPE.pipe_lock]
|
||||||
call mutex_lock
|
call mutex_lock
|
||||||
.again:
|
.again:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
cmp eax, [ebp+PIPE.readers]
|
cmp eax, [ebp + PIPE.readers]
|
||||||
je .epipe
|
je .epipe
|
||||||
|
|
||||||
mov ecx, 4096
|
mov ecx, 4096
|
||||||
sub ecx, [ebp+PIPE.count]
|
sub ecx, [ebp + PIPE.count]
|
||||||
jz .wait ;wait if buffer full
|
jz .wait ;wait if buffer full
|
||||||
|
|
||||||
.check_count:
|
.check_count:
|
||||||
@@ -257,47 +257,47 @@ pipe_write:
|
|||||||
jb .write
|
jb .write
|
||||||
mov ecx, ebx
|
mov ecx, ebx
|
||||||
.write:
|
.write:
|
||||||
mov edi, [ebp+PIPE.buffer]
|
mov edi, [ebp + PIPE.buffer]
|
||||||
add edi, [ebp+PIPE.write_end]
|
add edi, [ebp + PIPE.write_end]
|
||||||
add [.written], ecx
|
add [.written], ecx
|
||||||
sub ebx, ecx
|
sub ebx, ecx
|
||||||
add [ebp+PIPE.count], ecx
|
add [ebp + PIPE.count], ecx
|
||||||
|
|
||||||
cld
|
cld
|
||||||
rep movsb
|
rep movsb
|
||||||
and edi, 0xFFF
|
and edi, 0xFFF
|
||||||
mov [ebp+PIPE.write_end], edi
|
mov [ebp + PIPE.write_end], edi
|
||||||
|
|
||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
|
|
||||||
lea eax, [ebp+PIPE.rlist]
|
lea eax, [ebp + PIPE.rlist]
|
||||||
cmp eax, [ebp+PIPE.rlist.next]
|
cmp eax, [ebp + PIPE.rlist.next]
|
||||||
je @F
|
je @F
|
||||||
|
|
||||||
mov eax, [eax+MUTEX_WAITER.task]
|
mov eax, [eax + MUTEX_WAITER.task]
|
||||||
mov [eax + APPDATA.state], TSTATE_RUNNING ;activate reader task
|
mov [eax + APPDATA.state], TSTATE_RUNNING ;activate reader task
|
||||||
@@:
|
@@:
|
||||||
cmp [ebp+PIPE.count], 4096
|
cmp [ebp + PIPE.count], 4096
|
||||||
je @F
|
je @F
|
||||||
|
|
||||||
lea ecx, [ebp+PIPE.wlist]
|
lea ecx, [ebp + PIPE.wlist]
|
||||||
cmp ecx, [ebp+PIPE.wlist.next]
|
cmp ecx, [ebp + PIPE.wlist.next]
|
||||||
je @F
|
je @F
|
||||||
|
|
||||||
mov ecx, [eax+MUTEX_WAITER.task]
|
mov ecx, [eax + MUTEX_WAITER.task]
|
||||||
mov [ecx + APPDATA.state], TSTATE_RUNNING ;activate writer task
|
mov [ecx + APPDATA.state], TSTATE_RUNNING ;activate writer task
|
||||||
@@:
|
@@:
|
||||||
popfd
|
popfd
|
||||||
|
|
||||||
lea ecx, [ebp+PIPE.pipe_lock]
|
lea ecx, [ebp + PIPE.pipe_lock]
|
||||||
call mutex_unlock
|
call mutex_unlock
|
||||||
|
|
||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
jnz .again
|
jnz .again
|
||||||
|
|
||||||
pop eax ; written
|
pop eax ; written
|
||||||
mov [esp+SYSCALL_STACK._eax], eax
|
mov [esp + SYSCALL_STACK._eax], eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.wait:
|
.wait:
|
||||||
@@ -306,18 +306,18 @@ pipe_write:
|
|||||||
|
|
||||||
sub esp, sizeof.MUTEX_WAITER
|
sub esp, sizeof.MUTEX_WAITER
|
||||||
mov ecx, [current_slot]
|
mov ecx, [current_slot]
|
||||||
mov [esp+MUTEX_WAITER.task], ecx
|
mov [esp + MUTEX_WAITER.task], ecx
|
||||||
lea edx, [ebp+PIPE.wlist]
|
lea edx, [ebp+PIPE.wlist]
|
||||||
|
|
||||||
list_add_tail esp, edx ;esp= new waiter, edx= list head
|
list_add_tail esp, edx ;esp= new waiter, edx= list head
|
||||||
|
|
||||||
lea ecx, [ebp+PIPE.pipe_lock]
|
lea ecx, [ebp + PIPE.pipe_lock]
|
||||||
call mutex_unlock
|
call mutex_unlock
|
||||||
|
|
||||||
mov [ecx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
mov [ecx + APPDATA.state], TSTATE_RUN_SUSPENDED
|
||||||
call change_task
|
call change_task
|
||||||
|
|
||||||
lea ecx, [ebp+PIPE.pipe_lock]
|
lea ecx, [ebp + PIPE.pipe_lock]
|
||||||
call mutex_lock
|
call mutex_lock
|
||||||
|
|
||||||
list_del esp
|
list_del esp
|
||||||
@@ -326,14 +326,14 @@ pipe_write:
|
|||||||
jmp .again
|
jmp .again
|
||||||
|
|
||||||
.epipe:
|
.epipe:
|
||||||
lea ecx, [ebp+PIPE.pipe_lock]
|
lea ecx, [ebp + PIPE.pipe_lock]
|
||||||
call mutex_unlock
|
call mutex_unlock
|
||||||
|
|
||||||
add esp, 4
|
add esp, 4
|
||||||
mov [esp+SYSCALL_STACK._eax], -EPIPE
|
mov [esp + SYSCALL_STACK._eax], -EPIPE
|
||||||
ret
|
ret
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
pipe_close:
|
pipe_close:
|
||||||
mov [esp+SYSCALL_STACK._eax], -EBADF
|
mov [esp + SYSCALL_STACK._eax], -EBADF
|
||||||
ret
|
ret
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2017. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License. ;;
|
;; Distributed under terms of the GNU General Public License. ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -58,13 +58,13 @@ endg
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
sys_posix:
|
sys_posix:
|
||||||
cmp ebx, (sys_posix_call.end-sys_posix_call)/4
|
cmp ebx, (sys_posix_call.end - sys_posix_call)/4
|
||||||
jae .fail
|
jae .fail
|
||||||
|
|
||||||
jmp dword [sys_posix_call+ebx*4]
|
jmp dword [sys_posix_call + ebx*4]
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
mov [esp+SYSCALL_STACK._eax], -EBADF
|
mov [esp + SYSCALL_STACK._eax], -EBADF
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
@@ -81,21 +81,21 @@ sys_read:
|
|||||||
jae .fail
|
jae .fail
|
||||||
|
|
||||||
mov edi, [current_process]
|
mov edi, [current_process]
|
||||||
mov ebp, [edi+PROC.htab+ecx*4]
|
mov ebp, [edi + PROC.htab + ecx*4]
|
||||||
|
|
||||||
cmp [ebp+FILED.magic], 'PIPE'
|
cmp [ebp + FILED.magic], 'PIPE'
|
||||||
jne .fail
|
jne .fail
|
||||||
cmp [ebp+FILED.handle], ecx
|
cmp [ebp + FILED.handle], ecx
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
test [ebp+FILED.mode], F_READ
|
test [ebp + FILED.mode], F_READ
|
||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
mov ebp, [ebp+FILED.file]
|
mov ebp, [ebp + FILED.file]
|
||||||
mov eax, [ebp]
|
mov eax, [ebp]
|
||||||
jmp dword [eax+FILEOP_READ*4]
|
jmp dword [eax + FILEOP_READ*4]
|
||||||
.fail:
|
.fail:
|
||||||
mov [esp+SYSCALL_STACK._eax], -EBADF
|
mov [esp + SYSCALL_STACK._eax], -EBADF
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;ssize_t write(int fd, const void *buf, size_t count);
|
;ssize_t write(int fd, const void *buf, size_t count);
|
||||||
@@ -111,19 +111,19 @@ sys_write:
|
|||||||
jae .fail
|
jae .fail
|
||||||
|
|
||||||
mov edi, [current_process]
|
mov edi, [current_process]
|
||||||
mov ebp, [edi+PROC.htab+ecx*4]
|
mov ebp, [edi + PROC.htab+ecx*4]
|
||||||
|
|
||||||
cmp [ebp+FILED.magic], 'PIPE'
|
cmp [ebp + FILED.magic], 'PIPE'
|
||||||
jne .fail
|
jne .fail
|
||||||
cmp [ebp+FILED.handle], ecx
|
cmp [ebp + FILED.handle], ecx
|
||||||
jne .fail
|
jne .fail
|
||||||
test [ebp+FILED.mode], F_WRITE
|
test [ebp + FILED.mode], F_WRITE
|
||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
mov ebp, [ebp+FILED.file]
|
mov ebp, [ebp + FILED.file]
|
||||||
mov eax, [ebp]
|
mov eax, [ebp]
|
||||||
jmp dword [eax+FILEOP_WRITE*4]
|
jmp dword [eax + FILEOP_WRITE*4]
|
||||||
.fail:
|
.fail:
|
||||||
mov [esp+SYSCALL_STACK._eax], -EBADF
|
mov [esp + SYSCALL_STACK._eax], -EBADF
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; PLAYNOTE.INC version 1.1 22 November 2003 ;;
|
;; PLAYNOTE.INC version 1.1 22 November 2003 ;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2020-2020. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2020-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License. ;;
|
;; Distributed under terms of the GNU General Public License. ;;
|
||||||
;; Version 2, or (at your option) any later version. ;;
|
;; Version 2, or (at your option) any later version. ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2011-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2011-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -41,10 +41,10 @@ block_clip:
|
|||||||
|
|
||||||
push ebx
|
push ebx
|
||||||
|
|
||||||
mov eax, [edi+RECT.left]
|
mov eax, [edi + RECT.left]
|
||||||
mov ebx, [edi+RECT.right]
|
mov ebx, [edi + RECT.right]
|
||||||
mov ecx, [esi+RECT.left] ;clip.left
|
mov ecx, [esi + RECT.left] ;clip.left
|
||||||
mov edx, [esi+RECT.right] ;clip.right
|
mov edx, [esi + RECT.right] ;clip.right
|
||||||
|
|
||||||
cmp eax, edx ;left >= clip.right
|
cmp eax, edx ;left >= clip.right
|
||||||
jge .fail
|
jge .fail
|
||||||
@@ -55,17 +55,17 @@ block_clip:
|
|||||||
cmp eax, ecx ;left >= clip.left
|
cmp eax, ecx ;left >= clip.left
|
||||||
jge @F
|
jge @F
|
||||||
|
|
||||||
mov [edi+RECT.left], ecx
|
mov [edi + RECT.left], ecx
|
||||||
@@:
|
@@:
|
||||||
cmp ebx, edx ;right <= clip.right
|
cmp ebx, edx ;right <= clip.right
|
||||||
jle @f
|
jle @f
|
||||||
|
|
||||||
mov [edi+RECT.right], edx
|
mov [edi + RECT.right], edx
|
||||||
@@:
|
@@:
|
||||||
mov eax, [edi+RECT.top]
|
mov eax, [edi + RECT.top]
|
||||||
mov ebx, [edi+RECT.bottom]
|
mov ebx, [edi + RECT.bottom]
|
||||||
mov ecx, [esi+RECT.top] ;clip.top
|
mov ecx, [esi + RECT.top] ;clip.top
|
||||||
mov edx, [esi+RECT.bottom] ;clip.bottom
|
mov edx, [esi + RECT.bottom] ;clip.bottom
|
||||||
|
|
||||||
cmp eax, edx ;top >= clip.bottom
|
cmp eax, edx ;top >= clip.bottom
|
||||||
jge .fail
|
jge .fail
|
||||||
@@ -76,12 +76,12 @@ block_clip:
|
|||||||
cmp eax, ecx ;top >= clip.top
|
cmp eax, ecx ;top >= clip.top
|
||||||
jge @F
|
jge @F
|
||||||
|
|
||||||
mov [edi+RECT.top], ecx
|
mov [edi + RECT.top], ecx
|
||||||
@@:
|
@@:
|
||||||
cmp ebx, edx ;bottom <= clip.bottom
|
cmp ebx, edx ;bottom <= clip.bottom
|
||||||
jle @f
|
jle @f
|
||||||
|
|
||||||
mov [edi+RECT.bottom], edx
|
mov [edi + RECT.bottom], edx
|
||||||
@@:
|
@@:
|
||||||
pop ebx
|
pop ebx
|
||||||
clc
|
clc
|
||||||
@@ -115,67 +115,67 @@ blit_clip:
|
|||||||
sub esp, 40
|
sub esp, 40
|
||||||
|
|
||||||
mov ebx, ecx
|
mov ebx, ecx
|
||||||
mov edx, [ecx+BLITTER.src_x]
|
mov edx, [ecx + BLITTER.src_x]
|
||||||
mov [esp+.sx0], edx
|
mov [esp+.sx0], edx
|
||||||
mov eax, [ecx+BLITTER.src_y]
|
mov eax, [ecx + BLITTER.src_y]
|
||||||
mov [esp+.sy0], eax
|
mov [esp+.sy0], eax
|
||||||
add edx, [ecx+BLITTER.w]
|
add edx, [ecx + BLITTER.w]
|
||||||
add eax, [ecx+BLITTER.h]
|
add eax, [ecx + BLITTER.h]
|
||||||
mov [esp+.sx1], edx
|
mov [esp + .sx1], edx
|
||||||
mov [esp+.sy1], eax
|
mov [esp + .sy1], eax
|
||||||
|
|
||||||
lea edi, [esp+.sx0]
|
lea edi, [esp + .sx0]
|
||||||
lea esi, [ebx+BLITTER.sc]
|
lea esi, [ebx + BLITTER.sc]
|
||||||
|
|
||||||
call block_clip
|
call block_clip
|
||||||
jc .done
|
jc .done
|
||||||
|
|
||||||
mov edi, [esp+.sx0]
|
mov edi, [esp + .sx0]
|
||||||
mov edx, [ebx+BLITTER.dst_x]
|
mov edx, [ebx + BLITTER.dst_x]
|
||||||
add edx, edi
|
add edx, edi
|
||||||
sub edx, [ebx+BLITTER.src_x]
|
sub edx, [ebx + BLITTER.src_x]
|
||||||
mov [esp+.dx0], edx
|
mov [esp + .dx0], edx
|
||||||
|
|
||||||
mov ecx, [esp+.sy0]
|
mov ecx, [esp+.sy0]
|
||||||
mov eax, [ebx+BLITTER.dst_y]
|
mov eax, [ebx + BLITTER.dst_y]
|
||||||
add eax, ecx
|
add eax, ecx
|
||||||
sub eax, [ebx+BLITTER.src_y]
|
sub eax, [ebx + BLITTER.src_y]
|
||||||
mov [esp+.dy0], eax
|
mov [esp + .dy0], eax
|
||||||
|
|
||||||
sub edx, edi
|
sub edx, edi
|
||||||
add edx, [esp+.sx1]
|
add edx, [esp + .sx1]
|
||||||
mov [esp+.dx1], edx
|
mov [esp + .dx1], edx
|
||||||
|
|
||||||
sub eax, ecx
|
sub eax, ecx
|
||||||
add eax, [esp+.sy1]
|
add eax, [esp + .sy1]
|
||||||
mov [esp+.dy1], eax
|
mov [esp + .dy1], eax
|
||||||
|
|
||||||
lea edi, [esp+.dx0]
|
lea edi, [esp + .dx0]
|
||||||
lea esi, [ebx+BLITTER.dc]
|
lea esi, [ebx + BLITTER.dc]
|
||||||
call block_clip
|
call block_clip
|
||||||
jc .done
|
jc .done
|
||||||
|
|
||||||
mov edx, [esp+.dx0]
|
mov edx, [esp + .dx0]
|
||||||
mov eax, [esp+.dx1]
|
mov eax, [esp + .dx1]
|
||||||
sub eax, edx
|
sub eax, edx
|
||||||
mov [ebx+BLITTER.w], eax
|
mov [ebx + BLITTER.w], eax
|
||||||
|
|
||||||
mov eax, [esp+.dy0]
|
mov eax, [esp + .dy0]
|
||||||
mov ecx, [esp+.dy1]
|
mov ecx, [esp + .dy1]
|
||||||
sub ecx, eax
|
sub ecx, eax
|
||||||
mov [ebx+BLITTER.h], ecx
|
mov [ebx + BLITTER.h], ecx
|
||||||
|
|
||||||
mov ecx, [ebx+BLITTER.src_x]
|
mov ecx, [ebx + BLITTER.src_x]
|
||||||
add ecx, edx
|
add ecx, edx
|
||||||
sub ecx, [ebx+BLITTER.dst_x]
|
sub ecx, [ebx + BLITTER.dst_x]
|
||||||
mov [ebx+BLITTER.src_x], ecx
|
mov [ebx + BLITTER.src_x], ecx
|
||||||
|
|
||||||
mov ecx, [ebx+BLITTER.src_y]
|
mov ecx, [ebx + BLITTER.src_y]
|
||||||
add ecx, eax
|
add ecx, eax
|
||||||
sub ecx, [ebx+BLITTER.dst_y]
|
sub ecx, [ebx + BLITTER.dst_y]
|
||||||
mov [ebx+BLITTER.src_y], ecx
|
mov [ebx + BLITTER.src_y], ecx
|
||||||
mov [ebx+BLITTER.dst_x], edx
|
mov [ebx + BLITTER.dst_x], edx
|
||||||
mov [ebx+BLITTER.dst_y], eax
|
mov [ebx + BLITTER.dst_y], eax
|
||||||
clc
|
clc
|
||||||
.done:
|
.done:
|
||||||
add esp, 40
|
add esp, 40
|
||||||
@@ -211,64 +211,64 @@ virtual at sizeof.BLITTER
|
|||||||
end virtual
|
end virtual
|
||||||
sub esp, .local_vars_size
|
sub esp, .local_vars_size
|
||||||
|
|
||||||
mov [esp+.flags], ebx
|
mov [esp + .flags], ebx
|
||||||
|
|
||||||
mov eax, [current_slot_idx]
|
mov eax, [current_slot_idx]
|
||||||
shl eax, 5 ; sizeof.WDATA
|
shl eax, BSF sizeof.WDATA
|
||||||
mov ebx, [eax + window_data + WDATA.box.width]
|
mov ebx, [window_data + eax + WDATA.box.width]
|
||||||
mov edx, [eax + window_data + WDATA.box.height]
|
mov edx, [window_data + eax + WDATA.box.height]
|
||||||
inc ebx
|
inc ebx
|
||||||
inc edx
|
inc edx
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
|
|
||||||
mov [esp+BLITTER.dc.left], eax
|
mov [esp + BLITTER.dc.left], eax
|
||||||
mov [esp+BLITTER.dc.top], eax
|
mov [esp + BLITTER.dc.top], eax
|
||||||
mov [esp+BLITTER.dc.right], ebx
|
mov [esp + BLITTER.dc.right], ebx
|
||||||
mov [esp+BLITTER.dc.bottom], edx
|
mov [esp + BLITTER.dc.bottom], edx
|
||||||
|
|
||||||
mov [esp+BLITTER.sc.left], eax
|
mov [esp + BLITTER.sc.left], eax
|
||||||
mov [esp+BLITTER.sc.top], eax
|
mov [esp + BLITTER.sc.top], eax
|
||||||
mov eax, [ecx+24]
|
mov eax, [ecx+24]
|
||||||
|
|
||||||
mov [esp+BLITTER.sc.right], eax
|
mov [esp + BLITTER.sc.right], eax
|
||||||
mov eax, [ecx+28]
|
mov eax, [ecx+28]
|
||||||
|
|
||||||
mov [esp+BLITTER.sc.bottom], eax
|
mov [esp + BLITTER.sc.bottom], eax
|
||||||
|
|
||||||
mov eax, [ecx]
|
mov eax, [ecx]
|
||||||
mov [esp+BLITTER.dst_x], eax
|
mov [esp + BLITTER.dst_x], eax
|
||||||
mov eax, [ecx+4]
|
mov eax, [ecx+4]
|
||||||
mov [esp+BLITTER.dst_y], eax
|
mov [esp + BLITTER.dst_y], eax
|
||||||
|
|
||||||
mov eax, [ecx+16]
|
mov eax, [ecx+16]
|
||||||
mov [esp+BLITTER.src_x], eax
|
mov [esp + BLITTER.src_x], eax
|
||||||
mov eax, [ecx+20]
|
mov eax, [ecx+20]
|
||||||
mov [esp+BLITTER.src_y], eax
|
mov [esp + BLITTER.src_y], eax
|
||||||
mov eax, [ecx+8]
|
mov eax, [ecx+8]
|
||||||
mov [esp+BLITTER.w], eax
|
mov [esp + BLITTER.w], eax
|
||||||
mov eax, [ecx+12]
|
mov eax, [ecx+12]
|
||||||
mov [esp+BLITTER.h], eax
|
mov [esp + BLITTER.h], eax
|
||||||
|
|
||||||
|
|
||||||
mov eax, [ecx+32]
|
mov eax, [ecx+32]
|
||||||
mov [esp+BLITTER.bitmap], eax
|
mov [esp + BLITTER.bitmap], eax
|
||||||
mov eax, [ecx+36]
|
mov eax, [ecx+36]
|
||||||
mov [esp+BLITTER.stride], eax
|
mov [esp + BLITTER.stride], eax
|
||||||
|
|
||||||
mov ecx, esp
|
mov ecx, esp
|
||||||
call blit_clip
|
call blit_clip
|
||||||
jc .L57
|
jc .L57
|
||||||
|
|
||||||
mov eax, [current_slot_idx]
|
mov eax, [current_slot_idx]
|
||||||
shl eax, 5 ; sizeof.WDATA
|
shl eax, BSF sizeof.WDATA
|
||||||
|
|
||||||
mov ebx, [esp+BLITTER.dst_x]
|
mov ebx, [esp + BLITTER.dst_x]
|
||||||
mov ebp, [esp+BLITTER.dst_y]
|
mov ebp, [esp + BLITTER.dst_y]
|
||||||
add ebx, [eax + window_data + WDATA.box.left]
|
add ebx, [window_data + eax + WDATA.box.left]
|
||||||
add ebp, [eax + window_data + WDATA.box.top]
|
add ebp, [window_data + eax + WDATA.box.top]
|
||||||
|
|
||||||
test [esp+.flags], BLIT_CLIENT_RELATIVE
|
test [esp + .flags], BLIT_CLIENT_RELATIVE
|
||||||
jz .no_client_relative
|
jz .no_client_relative
|
||||||
|
|
||||||
mov eax, [current_slot]
|
mov eax, [current_slot]
|
||||||
@@ -277,15 +277,15 @@ end virtual
|
|||||||
.no_client_relative:
|
.no_client_relative:
|
||||||
|
|
||||||
mov ecx, ebx
|
mov ecx, ebx
|
||||||
add ecx, [esp+BLITTER.w]
|
add ecx, [esp + BLITTER.w]
|
||||||
shl ecx, 16
|
shl ecx, 16
|
||||||
mov cx, bp
|
mov cx, bp
|
||||||
add ecx, [esp+BLITTER.h]
|
add ecx, [esp + BLITTER.h]
|
||||||
|
|
||||||
mov eax, ebx
|
mov eax, ebx
|
||||||
shl eax, 16
|
shl eax, 16
|
||||||
mov ax, bp
|
mov ax, bp
|
||||||
mov [esp+.position], eax
|
mov [esp + .position], eax
|
||||||
|
|
||||||
mov edi, ebp
|
mov edi, ebp
|
||||||
|
|
||||||
@@ -297,15 +297,15 @@ end virtual
|
|||||||
add ebp, ebx
|
add ebp, ebx
|
||||||
add ebp, [_display.win_map]
|
add ebp, [_display.win_map]
|
||||||
|
|
||||||
mov eax, [esp+BLITTER.src_y]
|
mov eax, [esp + BLITTER.src_y]
|
||||||
imul eax, [esp+BLITTER.stride]
|
imul eax, [esp + BLITTER.stride]
|
||||||
mov esi, [esp+BLITTER.src_x]
|
mov esi, [esp + BLITTER.src_x]
|
||||||
lea esi, [eax+esi*4]
|
lea esi, [eax + esi*4]
|
||||||
add esi, [esp+BLITTER.bitmap]
|
add esi, [esp + BLITTER.bitmap]
|
||||||
|
|
||||||
mov eax, ecx
|
mov eax, ecx
|
||||||
mov ecx, [esp+BLITTER.h]
|
mov ecx, [esp + BLITTER.h]
|
||||||
mov edx, [esp+BLITTER.w]
|
mov edx, [esp + BLITTER.w]
|
||||||
|
|
||||||
test ecx, ecx ;FIXME check clipping
|
test ecx, ecx ;FIXME check clipping
|
||||||
jz .L57
|
jz .L57
|
||||||
@@ -316,7 +316,7 @@ end virtual
|
|||||||
cmp [_display.bits_per_pixel], 32
|
cmp [_display.bits_per_pixel], 32
|
||||||
jne .core_24
|
jne .core_24
|
||||||
|
|
||||||
lea edi, [edi+ebx*4]
|
lea edi, [edi + ebx*4]
|
||||||
|
|
||||||
mov ebx, [current_slot_idx]
|
mov ebx, [current_slot_idx]
|
||||||
; check for hardware cursor
|
; check for hardware cursor
|
||||||
@@ -336,28 +336,28 @@ align 4
|
|||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
mov eax, [esi]
|
mov eax, [esi]
|
||||||
|
|
||||||
mov ecx, [esp+.position]
|
mov ecx, [esp + .position]
|
||||||
|
|
||||||
; check mouse area for putpixel
|
; check mouse area for putpixel
|
||||||
call [_display.check_mouse]
|
call [_display.check_mouse]
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
; store to real LFB
|
; store to real LFB
|
||||||
mov [LFB_BASE+edi], eax
|
mov [LFB_BASE + edi], eax
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.skip:
|
.skip:
|
||||||
add esi, 4
|
add esi, 4
|
||||||
add edi, 4
|
add edi, 4
|
||||||
inc ebp
|
inc ebp
|
||||||
add [esp+.position], 1 shl 16
|
add [esp + .position], 1 shl 16
|
||||||
dec edx
|
dec edx
|
||||||
jnz .inner32
|
jnz .inner32
|
||||||
|
|
||||||
add esi, [esp+BLITTER.stride]
|
add esi, [esp + BLITTER.stride]
|
||||||
add edi, [_display.lfb_pitch]
|
add edi, [_display.lfb_pitch]
|
||||||
add ebp, [_display.width]
|
add ebp, [_display.width]
|
||||||
|
|
||||||
mov edx, [esp+BLITTER.w]
|
mov edx, [esp + BLITTER.w]
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
inc [esp+.position]
|
inc [esp+.position]
|
||||||
sub ebp, edx
|
sub ebp, edx
|
||||||
@@ -365,8 +365,8 @@ align 4
|
|||||||
sub esi, eax
|
sub esi, eax
|
||||||
sub edi, eax
|
sub edi, eax
|
||||||
shl eax, 16-2
|
shl eax, 16-2
|
||||||
sub [esp+.position], eax
|
sub [esp + .position], eax
|
||||||
dec [esp+BLITTER.h]
|
dec [esp + BLITTER.h]
|
||||||
jnz .outer32
|
jnz .outer32
|
||||||
jmp .done
|
jmp .done
|
||||||
.core_32.hardware_cursor:
|
.core_32.hardware_cursor:
|
||||||
@@ -376,10 +376,10 @@ align 4
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
.hw.inner32:
|
.hw.inner32:
|
||||||
cmp [ebp+ecx], bl
|
cmp [ebp + ecx], bl
|
||||||
jne .hw.skip
|
jne .hw.skip
|
||||||
mov eax, [esi+ecx*4]
|
mov eax, [esi + ecx*4]
|
||||||
mov [LFB_BASE+edi+ecx*4], eax
|
mov [LFB_BASE + edi + ecx*4], eax
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
.hw.skip:
|
.hw.skip:
|
||||||
@@ -387,12 +387,12 @@ align 4
|
|||||||
dec edx
|
dec edx
|
||||||
jnz .hw.inner32
|
jnz .hw.inner32
|
||||||
|
|
||||||
add esi, [esp+BLITTER.stride]
|
add esi, [esp + BLITTER.stride]
|
||||||
add edi, [_display.lfb_pitch]
|
add edi, [_display.lfb_pitch]
|
||||||
add ebp, [_display.width]
|
add ebp, [_display.width]
|
||||||
|
|
||||||
mov edx, [esp+BLITTER.w]
|
mov edx, [esp + BLITTER.w]
|
||||||
dec [esp+BLITTER.h]
|
dec [esp + BLITTER.h]
|
||||||
jnz .hw.outer32
|
jnz .hw.outer32
|
||||||
|
|
||||||
.done:
|
.done:
|
||||||
@@ -410,24 +410,24 @@ align 4
|
|||||||
cmp [_display.bits_per_pixel], 24
|
cmp [_display.bits_per_pixel], 24
|
||||||
jne .core_16
|
jne .core_16
|
||||||
|
|
||||||
lea ebx, [ebx+ebx*2]
|
lea ebx, [ebx + ebx*2]
|
||||||
lea edi, [LFB_BASE+edi+ebx]
|
lea edi, [LFB_BASE + edi + ebx]
|
||||||
mov ebx, [current_slot_idx]
|
mov ebx, [current_slot_idx]
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
.outer24:
|
.outer24:
|
||||||
mov [esp+.extra_var1], edi
|
mov [esp + .extra_var1], edi
|
||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
.inner24:
|
.inner24:
|
||||||
cmp [ebp+ecx], bl ; Does the process own this pixel?
|
cmp [ebp + ecx], bl ; Does the process own this pixel?
|
||||||
jne .skip_1
|
jne .skip_1
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
push eax
|
push eax
|
||||||
mov eax, [esi+ecx*4]
|
mov eax, [esi + ecx*4]
|
||||||
|
|
||||||
lea edi, [edi+ecx*2]
|
lea edi, [edi + ecx*2]
|
||||||
|
|
||||||
; check for hardware cursor
|
; check for hardware cursor
|
||||||
cmp [_display.select_cursor], select_cursor
|
cmp [_display.select_cursor], select_cursor
|
||||||
@@ -443,7 +443,7 @@ align 4
|
|||||||
ror ecx, 16
|
ror ecx, 16
|
||||||
sub ecx, edx
|
sub ecx, edx
|
||||||
rol ecx, 16
|
rol ecx, 16
|
||||||
sub ecx, [esp+BLITTER.h + 8]
|
sub ecx, [esp + BLITTER.h + 8]
|
||||||
|
|
||||||
; check mouse area for putpixel
|
; check mouse area for putpixel
|
||||||
call [_display.check_mouse]
|
call [_display.check_mouse]
|
||||||
@@ -451,44 +451,44 @@ align 4
|
|||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.no_mouseunder_1:
|
.no_mouseunder_1:
|
||||||
mov [edi+ecx], ax
|
mov [edi + ecx], ax
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
mov [edi+ecx+2], al
|
mov [edi + ecx+2], al
|
||||||
|
|
||||||
pop eax
|
pop eax
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.skip_1:
|
.skip_1:
|
||||||
mov edi, [esp+.extra_var1]
|
mov edi, [esp + .extra_var1]
|
||||||
inc ecx
|
inc ecx
|
||||||
dec edx
|
dec edx
|
||||||
jnz .inner24
|
jnz .inner24
|
||||||
|
|
||||||
add esi, [esp+BLITTER.stride]
|
add esi, [esp + BLITTER.stride]
|
||||||
add edi, [_display.lfb_pitch]
|
add edi, [_display.lfb_pitch]
|
||||||
add ebp, [_display.width]
|
add ebp, [_display.width]
|
||||||
|
|
||||||
mov edx, [esp+BLITTER.w]
|
mov edx, [esp + BLITTER.w]
|
||||||
dec [esp+BLITTER.h]
|
dec [esp + BLITTER.h]
|
||||||
jnz .outer24
|
jnz .outer24
|
||||||
|
|
||||||
jmp .done
|
jmp .done
|
||||||
|
|
||||||
|
|
||||||
.core_16:
|
.core_16:
|
||||||
lea edi, [LFB_BASE+edi+ebx*2]
|
lea edi, [LFB_BASE + edi + ebx*2]
|
||||||
mov ebx, [current_slot_idx]
|
mov ebx, [current_slot_idx]
|
||||||
|
|
||||||
.outer16:
|
.outer16:
|
||||||
mov [esp+.extra_var1], edi
|
mov [esp + .extra_var1], edi
|
||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
|
|
||||||
.inner16:
|
.inner16:
|
||||||
cmp [ebp+ecx], bl ; Does the process own this pixel?
|
cmp [ebp + ecx], bl ; Does the process own this pixel?
|
||||||
jne .skip_2
|
jne .skip_2
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
push eax
|
push eax
|
||||||
mov eax, [esi+ecx*4]
|
mov eax, [esi + ecx*4]
|
||||||
|
|
||||||
; check for hardware cursor
|
; check for hardware cursor
|
||||||
cmp [_display.select_cursor], select_cursor
|
cmp [_display.select_cursor], select_cursor
|
||||||
@@ -503,7 +503,7 @@ align 4
|
|||||||
ror ecx, 16
|
ror ecx, 16
|
||||||
sub ecx, edx
|
sub ecx, edx
|
||||||
rol ecx, 16
|
rol ecx, 16
|
||||||
sub ecx, [esp+BLITTER.h + 8]
|
sub ecx, [esp + BLITTER.h + 8]
|
||||||
|
|
||||||
; check mouse area for putpixel
|
; check mouse area for putpixel
|
||||||
call [_display.check_mouse]
|
call [_display.check_mouse]
|
||||||
@@ -517,21 +517,21 @@ align 4
|
|||||||
ror eax, 8
|
ror eax, 8
|
||||||
add al, ah
|
add al, ah
|
||||||
rol eax, 8
|
rol eax, 8
|
||||||
mov [edi+ecx*2], ax
|
mov [edi + ecx*2], ax
|
||||||
pop eax
|
pop eax
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
.skip_2:
|
.skip_2:
|
||||||
mov edi, [esp+.extra_var1]
|
mov edi, [esp + .extra_var1]
|
||||||
inc ecx
|
inc ecx
|
||||||
dec edx
|
dec edx
|
||||||
jnz .inner16
|
jnz .inner16
|
||||||
|
|
||||||
add esi, [esp+BLITTER.stride]
|
add esi, [esp + BLITTER.stride]
|
||||||
add edi, [_display.lfb_pitch]
|
add edi, [_display.lfb_pitch]
|
||||||
add ebp, [_display.width]
|
add ebp, [_display.width]
|
||||||
|
|
||||||
mov edx, [esp+BLITTER.w]
|
mov edx, [esp + BLITTER.w]
|
||||||
dec [esp+BLITTER.h]
|
dec [esp + BLITTER.h]
|
||||||
jnz .outer16
|
jnz .outer16
|
||||||
|
|
||||||
jmp .done
|
jmp .done
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2018. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -43,11 +43,11 @@ proc init_cursor stdcall, dst:dword, src:dword
|
|||||||
add esi, [esi+18]
|
add esi, [esi+18]
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
|
|
||||||
cmp [esi+BITMAPINFOHEADER.BitCount], 24
|
cmp [esi + BITMAPINFOHEADER.BitCount], 24
|
||||||
je .img_24
|
je .img_24
|
||||||
cmp [esi+BITMAPINFOHEADER.BitCount], 8
|
cmp [esi + BITMAPINFOHEADER.BitCount], 8
|
||||||
je .img_8
|
je .img_8
|
||||||
cmp [esi+BITMAPINFOHEADER.BitCount], 4
|
cmp [esi + BITMAPINFOHEADER.BitCount], 4
|
||||||
je .img_4
|
je .img_4
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
@@ -90,7 +90,7 @@ align 4
|
|||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
shl ebx, 1
|
shl ebx, 1
|
||||||
setc cl
|
setc cl
|
||||||
mov ecx, [esi+ecx*4]
|
mov ecx, [esi + ecx*4]
|
||||||
and ecx, edx
|
and ecx, edx
|
||||||
and edx, 0xFF000000
|
and edx, 0xFF000000
|
||||||
or edx, ecx
|
or edx, ecx
|
||||||
@@ -147,7 +147,7 @@ align 4
|
|||||||
movzx ecx, byte [ebx]
|
movzx ecx, byte [ebx]
|
||||||
and cl, 0xF0
|
and cl, 0xF0
|
||||||
shr ecx, 2
|
shr ecx, 2
|
||||||
mov ecx, [esi+ecx]
|
mov ecx, [esi + ecx]
|
||||||
and ecx, edx
|
and ecx, edx
|
||||||
and edx, 0xFF000000
|
and edx, 0xFF000000
|
||||||
or edx, ecx
|
or edx, ecx
|
||||||
@@ -160,7 +160,7 @@ align 4
|
|||||||
|
|
||||||
movzx ecx, byte [ebx]
|
movzx ecx, byte [ebx]
|
||||||
and cl, 0x0F
|
and cl, 0x0F
|
||||||
mov ecx, [esi+ecx*4]
|
mov ecx, [esi + ecx*4]
|
||||||
and ecx, edx
|
and ecx, edx
|
||||||
and edx, 0xFF000000
|
and edx, 0xFF000000
|
||||||
or edx, ecx
|
or edx, ecx
|
||||||
@@ -215,7 +215,7 @@ align 4
|
|||||||
dec edx
|
dec edx
|
||||||
|
|
||||||
movzx ecx, byte [ebx]
|
movzx ecx, byte [ebx]
|
||||||
mov ecx, [esi+ecx*4]
|
mov ecx, [esi + ecx*4]
|
||||||
and ecx, edx
|
and ecx, edx
|
||||||
and edx, 0xFF000000
|
and edx, 0xFF000000
|
||||||
or edx, ecx
|
or edx, ecx
|
||||||
@@ -240,9 +240,9 @@ align 4
|
|||||||
mov [pQuad], eax
|
mov [pQuad], eax
|
||||||
add eax, 0xC00
|
add eax, 0xC00
|
||||||
mov [pAnd], eax
|
mov [pAnd], eax
|
||||||
mov eax, [esi+BITMAPINFOHEADER.Width]
|
mov eax, [esi + BITMAPINFOHEADER.Width]
|
||||||
mov [width], eax
|
mov [width], eax
|
||||||
mov ebx, [esi+BITMAPINFOHEADER.Height]
|
mov ebx, [esi + BITMAPINFOHEADER.Height]
|
||||||
shr ebx, 1
|
shr ebx, 1
|
||||||
mov [height], ebx
|
mov [height], ebx
|
||||||
|
|
||||||
@@ -289,19 +289,19 @@ endp
|
|||||||
align 4
|
align 4
|
||||||
proc set_cursor stdcall, hcursor:dword
|
proc set_cursor stdcall, hcursor:dword
|
||||||
mov eax, [hcursor]
|
mov eax, [hcursor]
|
||||||
cmp [eax+CURSOR.magic], 'CURS'
|
cmp [eax + CURSOR.magic], 'CURS'
|
||||||
jne .fail
|
jne .fail
|
||||||
; cmp [eax+CURSOR.size], CURSOR_SIZE
|
; cmp [eax+CURSOR.size], CURSOR_SIZE
|
||||||
; jne .fail
|
; jne .fail
|
||||||
mov ebx, [current_slot]
|
mov ebx, [current_slot]
|
||||||
xchg eax, [ebx+APPDATA.cursor]
|
xchg eax, [ebx + APPDATA.cursor]
|
||||||
jmp .end
|
jmp .end
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.fail:
|
.fail:
|
||||||
mov eax, [def_cursor]
|
mov eax, [def_cursor]
|
||||||
mov ebx, [current_slot]
|
mov ebx, [current_slot]
|
||||||
xchg eax, [ebx+APPDATA.cursor]
|
xchg eax, [ebx + APPDATA.cursor]
|
||||||
align 4
|
align 4
|
||||||
.end:
|
.end:
|
||||||
mov [redrawmouse_unconditional], 1
|
mov [redrawmouse_unconditional], 1
|
||||||
@@ -333,17 +333,17 @@ create_cursor:
|
|||||||
mov [.hcursor], eax
|
mov [.hcursor], eax
|
||||||
|
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
mov [eax+CURSOR.magic], 'CURS'
|
mov [eax + CURSOR.magic], 'CURS'
|
||||||
mov [eax+CURSOR.destroy], destroy_cursor
|
mov [eax + CURSOR.destroy], destroy_cursor
|
||||||
mov [eax+CURSOR.hot_x], ebx
|
mov [eax + CURSOR.hot_x], ebx
|
||||||
mov [eax+CURSOR.hot_y], ebx
|
mov [eax + CURSOR.hot_y], ebx
|
||||||
|
|
||||||
stdcall kernel_alloc, 0x1000
|
stdcall kernel_alloc, 0x1000
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
mov edi, [.hcursor]
|
mov edi, [.hcursor]
|
||||||
mov [edi+CURSOR.base], eax
|
mov [edi + CURSOR.base], eax
|
||||||
|
|
||||||
mov esi, [.src]
|
mov esi, [.src]
|
||||||
mov ebx, [.flags]
|
mov ebx, [.flags]
|
||||||
@@ -352,15 +352,15 @@ create_cursor:
|
|||||||
|
|
||||||
movzx ecx, word [esi+10]
|
movzx ecx, word [esi+10]
|
||||||
movzx edx, word [esi+12]
|
movzx edx, word [esi+12]
|
||||||
mov [edi+CURSOR.hot_x], ecx
|
mov [edi + CURSOR.hot_x], ecx
|
||||||
mov [edi+CURSOR.hot_y], edx
|
mov [edi + CURSOR.hot_y], edx
|
||||||
|
|
||||||
stdcall init_cursor, eax, esi
|
stdcall init_cursor, eax, esi
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
.add_cursor:
|
.add_cursor:
|
||||||
mov ecx, [.hcursor]
|
mov ecx, [.hcursor]
|
||||||
lea ecx, [ecx+CURSOR.list_next]
|
lea ecx, [ecx + CURSOR.list_next]
|
||||||
lea edx, [_display.cr_list.next]
|
lea edx, [_display.cr_list.next]
|
||||||
|
|
||||||
pushfd
|
pushfd
|
||||||
@@ -388,8 +388,8 @@ align 4
|
|||||||
shr ebx, 16
|
shr ebx, 16
|
||||||
movzx ecx, bh
|
movzx ecx, bh
|
||||||
movzx edx, bl
|
movzx edx, bl
|
||||||
mov [edi+CURSOR.hot_x], ecx
|
mov [edi + CURSOR.hot_x], ecx
|
||||||
mov [edi+CURSOR.hot_y], edx
|
mov [edi + CURSOR.hot_y], edx
|
||||||
|
|
||||||
xchg edi, eax
|
xchg edi, eax
|
||||||
mov ecx, 1024
|
mov ecx, 1024
|
||||||
@@ -423,8 +423,8 @@ align 4
|
|||||||
push edi
|
push edi
|
||||||
|
|
||||||
mov eax, [current_slot_idx]
|
mov eax, [current_slot_idx]
|
||||||
shl eax, 8
|
shl eax, BSF sizeof.APPDATA
|
||||||
mov eax, [eax + SLOT_BASE + APPDATA.tid]
|
mov eax, [SLOT_BASE + eax + APPDATA.tid]
|
||||||
mov ebx, [src]
|
mov ebx, [src]
|
||||||
mov ecx, [flags]
|
mov ecx, [flags]
|
||||||
call create_cursor ;eax, ebx, ecx
|
call create_cursor ;eax, ebx, ecx
|
||||||
@@ -456,27 +456,25 @@ proc delete_cursor stdcall, hcursor:dword
|
|||||||
|
|
||||||
mov esi, [hcursor]
|
mov esi, [hcursor]
|
||||||
|
|
||||||
cmp [esi+CURSOR.magic], 'CURS'
|
cmp [esi + CURSOR.magic], 'CURS'
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
mov ebx, [current_slot_idx]
|
mov ebx, [current_slot_idx]
|
||||||
;shl ebx, 5
|
shl ebx, BSF sizeof.APPDATA
|
||||||
;mov ebx, [TASK_TABLE+ebx+4]
|
|
||||||
shl ebx, 8
|
|
||||||
mov ebx, [ebx + SLOT_BASE + APPDATA.tid]
|
mov ebx, [ebx + SLOT_BASE + APPDATA.tid]
|
||||||
cmp ebx, [esi+CURSOR.pid]
|
cmp ebx, [esi+CURSOR.pid]
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
mov ebx, [current_slot]
|
mov ebx, [current_slot]
|
||||||
cmp esi, [ebx+APPDATA.cursor]
|
cmp esi, [ebx + APPDATA.cursor]
|
||||||
jne @F
|
jne @F
|
||||||
mov eax, [def_cursor]
|
mov eax, [def_cursor]
|
||||||
mov [ebx+APPDATA.cursor], eax
|
mov [ebx + APPDATA.cursor], eax
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
@@:
|
@@:
|
||||||
mov eax, [hcursor]
|
mov eax, [hcursor]
|
||||||
call [eax+APPOBJ.destroy]
|
call [eax + APPOBJ.destroy]
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.fail:
|
.fail:
|
||||||
@@ -489,10 +487,10 @@ align 4
|
|||||||
destroy_cursor:
|
destroy_cursor:
|
||||||
|
|
||||||
push eax
|
push eax
|
||||||
stdcall kernel_free, [eax+CURSOR.base]
|
stdcall kernel_free, [eax + CURSOR.base]
|
||||||
|
|
||||||
mov eax, [esp]
|
mov eax, [esp]
|
||||||
lea eax, [eax+CURSOR.list_next]
|
lea eax, [eax + CURSOR.list_next]
|
||||||
|
|
||||||
pushfd
|
pushfd
|
||||||
cli
|
cli
|
||||||
@@ -631,8 +629,8 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
|
|||||||
; mov ebx, [BytesPerScanLine]
|
; mov ebx, [BytesPerScanLine]
|
||||||
|
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
sub ecx, [esi+CURSOR.hot_x]
|
sub ecx, [esi + CURSOR.hot_x]
|
||||||
lea ebx, [ecx+32-1]
|
lea ebx, [ecx + 32-1]
|
||||||
mov [x], ecx
|
mov [x], ecx
|
||||||
sets dl
|
sets dl
|
||||||
dec edx
|
dec edx
|
||||||
@@ -643,7 +641,7 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
|
|||||||
mov [_dx], edi
|
mov [_dx], edi
|
||||||
|
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
sub eax, [esi+CURSOR.hot_y]
|
sub eax, [esi + CURSOR.hot_y]
|
||||||
lea edi, [eax+32-1]
|
lea edi, [eax+32-1]
|
||||||
mov [y], eax
|
mov [y], eax
|
||||||
sets dl
|
sets dl
|
||||||
@@ -655,8 +653,8 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
|
|||||||
mov [_dy], edx
|
mov [_dy], edx
|
||||||
|
|
||||||
; mul dword [BytesPerScanLine]
|
; mul dword [BytesPerScanLine]
|
||||||
mov eax, [BPSLine_calc_area+eax*4]
|
mov eax, [BPSLine_calc_area + eax*4]
|
||||||
lea edx, [LFB_BASE+ecx*3]
|
lea edx, [LFB_BASE + ecx*3]
|
||||||
add edx, eax
|
add edx, eax
|
||||||
mov [cur_saved_base], edx
|
mov [cur_saved_base], edx
|
||||||
|
|
||||||
@@ -690,7 +688,7 @@ align 4
|
|||||||
mov esi, edx
|
mov esi, edx
|
||||||
add edx, [_display.lfb_pitch]
|
add edx, [_display.lfb_pitch]
|
||||||
mov ecx, [cur.w]
|
mov ecx, [cur.w]
|
||||||
lea ecx, [ecx+ecx*2]
|
lea ecx, [ecx + ecx*2]
|
||||||
rep movsb
|
rep movsb
|
||||||
dec eax
|
dec eax
|
||||||
jnz @B
|
jnz @B
|
||||||
@@ -702,8 +700,8 @@ align 4
|
|||||||
add eax, [_dx]
|
add eax, [_dx]
|
||||||
|
|
||||||
mov esi, [hcursor]
|
mov esi, [hcursor]
|
||||||
mov esi, [esi+CURSOR.base]
|
mov esi, [esi + CURSOR.base]
|
||||||
lea edx, [esi+eax*4]
|
lea edx, [esi + eax*4]
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.row:
|
.row:
|
||||||
@@ -746,7 +744,7 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
|
|||||||
mov eax, [y]
|
mov eax, [y]
|
||||||
|
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
sub ecx, [esi+CURSOR.hot_x]
|
sub ecx, [esi + CURSOR.hot_x]
|
||||||
lea ebx, [ecx+32-1]
|
lea ebx, [ecx+32-1]
|
||||||
mov [x], ecx
|
mov [x], ecx
|
||||||
sets dl
|
sets dl
|
||||||
@@ -758,7 +756,7 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
|
|||||||
mov [_dx], edi
|
mov [_dx], edi
|
||||||
|
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
sub eax, [esi+CURSOR.hot_y]
|
sub eax, [esi + CURSOR.hot_y]
|
||||||
lea edi, [eax+32-1]
|
lea edi, [eax+32-1]
|
||||||
mov [y], eax
|
mov [y], eax
|
||||||
sets dl
|
sets dl
|
||||||
@@ -771,7 +769,7 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
|
|||||||
|
|
||||||
; mul dword [BytesPerScanLine]
|
; mul dword [BytesPerScanLine]
|
||||||
mov eax, [BPSLine_calc_area+eax*4]
|
mov eax, [BPSLine_calc_area+eax*4]
|
||||||
lea edx, [LFB_BASE+eax+ecx*4]
|
lea edx, [LFB_BASE + eax + ecx*4]
|
||||||
mov [cur_saved_base], edx
|
mov [cur_saved_base], edx
|
||||||
|
|
||||||
cmp ebx, [_display.width]
|
cmp ebx, [_display.width]
|
||||||
@@ -814,7 +812,7 @@ align 4
|
|||||||
add eax, [_dx]
|
add eax, [_dx]
|
||||||
|
|
||||||
mov esi, [hcursor]
|
mov esi, [hcursor]
|
||||||
mov esi, [esi+CURSOR.base]
|
mov esi, [esi + CURSOR.base]
|
||||||
lea edx, [esi+eax*4]
|
lea edx, [esi+eax*4]
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
@@ -856,8 +854,8 @@ proc move_cursor_16 stdcall, hcursor:dword, x:dword, y:dword
|
|||||||
mov eax, [y]
|
mov eax, [y]
|
||||||
|
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
sub ecx, [esi+CURSOR.hot_x]
|
sub ecx, [esi + CURSOR.hot_x]
|
||||||
lea ebx, [ecx+32-1]
|
lea ebx, [ecx + 32-1]
|
||||||
mov [x], ecx
|
mov [x], ecx
|
||||||
sets dl
|
sets dl
|
||||||
dec edx
|
dec edx
|
||||||
@@ -868,8 +866,8 @@ proc move_cursor_16 stdcall, hcursor:dword, x:dword, y:dword
|
|||||||
mov [_dx], edi
|
mov [_dx], edi
|
||||||
|
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
sub eax, [esi+CURSOR.hot_y]
|
sub eax, [esi + CURSOR.hot_y]
|
||||||
lea edi, [eax+32-1]
|
lea edi, [eax + 32-1]
|
||||||
mov [y], eax
|
mov [y], eax
|
||||||
sets dl
|
sets dl
|
||||||
dec edx
|
dec edx
|
||||||
@@ -880,8 +878,8 @@ proc move_cursor_16 stdcall, hcursor:dword, x:dword, y:dword
|
|||||||
mov [_dy], edx
|
mov [_dy], edx
|
||||||
|
|
||||||
; mul dword [BytesPerScanLine]
|
; mul dword [BytesPerScanLine]
|
||||||
mov eax, [BPSLine_calc_area+eax*4]
|
mov eax, [BPSLine_calc_area + eax*4]
|
||||||
lea edx, [LFB_BASE+eax+ecx*2]
|
lea edx, [LFB_BASE + eax + ecx*2]
|
||||||
mov [cur_saved_base], edx
|
mov [cur_saved_base], edx
|
||||||
|
|
||||||
cmp ebx, [_display.width]
|
cmp ebx, [_display.width]
|
||||||
@@ -925,8 +923,8 @@ align 4
|
|||||||
add eax, [_dx]
|
add eax, [_dx]
|
||||||
|
|
||||||
mov esi, [hcursor]
|
mov esi, [hcursor]
|
||||||
mov esi, [esi+CURSOR.base]
|
mov esi, [esi + CURSOR.base]
|
||||||
lea edx, [esi+eax*4]
|
lea edx, [esi + eax*4]
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.row:
|
.row:
|
||||||
@@ -1123,8 +1121,8 @@ align 4
|
|||||||
add ecx, ebx
|
add ecx, ebx
|
||||||
|
|
||||||
mov eax, [current_cursor]
|
mov eax, [current_cursor]
|
||||||
mov eax, [eax+CURSOR.base]
|
mov eax, [eax + CURSOR.base]
|
||||||
lea eax, [eax+ecx*4]
|
lea eax, [eax + ecx*4]
|
||||||
mov eax, [eax]
|
mov eax, [eax]
|
||||||
|
|
||||||
pop ebx
|
pop ebx
|
||||||
@@ -1157,15 +1155,15 @@ init_display:
|
|||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov edi, _display
|
mov edi, _display
|
||||||
|
|
||||||
mov [edi+display_t.init_cursor], eax
|
mov [edi + display_t.init_cursor], eax
|
||||||
mov [edi+display_t.select_cursor], eax
|
mov [edi + display_t.select_cursor], eax
|
||||||
mov [edi+display_t.show_cursor], eax
|
mov [edi + display_t.show_cursor], eax
|
||||||
mov [edi+display_t.move_cursor], eax
|
mov [edi + display_t.move_cursor], eax
|
||||||
mov [edi+display_t.restore_cursor], eax
|
mov [edi + display_t.restore_cursor], eax
|
||||||
|
|
||||||
lea ecx, [edi+display_t.cr_list.next]
|
lea ecx, [edi + display_t.cr_list.next]
|
||||||
mov [edi+display_t.cr_list.next], ecx
|
mov [edi + display_t.cr_list.next], ecx
|
||||||
mov [edi+display_t.cr_list.prev], ecx
|
mov [edi + display_t.cr_list.prev], ecx
|
||||||
|
|
||||||
if ~defined UEFI
|
if ~defined UEFI
|
||||||
cmp [SCR_MODE], word 0x13
|
cmp [SCR_MODE], word 0x13
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Synhronization for MenuetOS. ;;
|
;; Synhronization for MenuetOS. ;;
|
||||||
@@ -30,8 +30,8 @@ create_framebuffer:
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jz .fail
|
jz .fail
|
||||||
|
|
||||||
mov [eax+FRB.magic], 'FRMB'
|
mov [eax + FRB.magic], 'FRMB'
|
||||||
mov [eax+FRB.destroy], 0
|
mov [eax + FRB.destroy], 0
|
||||||
.fail:
|
.fail:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ init_video:
|
|||||||
cmp eax, MAX_SCREEN_WIDTH
|
cmp eax, MAX_SCREEN_WIDTH
|
||||||
ja $
|
ja $
|
||||||
mov [_display.width], eax
|
mov [_display.width], eax
|
||||||
mov [ebp+FRB.width], eax
|
mov [ebp + FRB.width], eax
|
||||||
mov [display_width_standard], eax
|
mov [display_width_standard], eax
|
||||||
dec eax
|
dec eax
|
||||||
mov [screen_workarea.right], eax
|
mov [screen_workarea.right], eax
|
||||||
@@ -57,7 +57,7 @@ init_video:
|
|||||||
cmp eax, MAX_SCREEN_HEIGHT
|
cmp eax, MAX_SCREEN_HEIGHT
|
||||||
ja $
|
ja $
|
||||||
mov [_display.height], eax
|
mov [_display.height], eax
|
||||||
mov [ebp+FRB.height], eax
|
mov [ebp + FRB.height], eax
|
||||||
mov [display_height_standard], eax
|
mov [display_height_standard], eax
|
||||||
dec eax
|
dec eax
|
||||||
mov [screen_workarea.bottom], eax
|
mov [screen_workarea.bottom], eax
|
||||||
@@ -72,7 +72,7 @@ init_video:
|
|||||||
movzx eax, word[BOOT.pitch] ; for other modes
|
movzx eax, word[BOOT.pitch] ; for other modes
|
||||||
@@:
|
@@:
|
||||||
mov [_display.lfb_pitch], eax
|
mov [_display.lfb_pitch], eax
|
||||||
mov [ebp+FRB.pitch], eax
|
mov [ebp + FRB.pitch], eax
|
||||||
|
|
||||||
mov eax, [BOOT.lfb]
|
mov eax, [BOOT.lfb]
|
||||||
mov [LFBAddress], eax
|
mov [LFBAddress], eax
|
||||||
@@ -131,16 +131,16 @@ init_video:
|
|||||||
jnc .create_page_tables
|
jnc .create_page_tables
|
||||||
|
|
||||||
mov edx, 0x00400000
|
mov edx, 0x00400000
|
||||||
or esi, PG_GLOBAL+PAT_WC+PG_UWR
|
or esi, PG_GLOBAL + PAT_WC + PG_UWR
|
||||||
and esi, [pte_valid_mask]
|
and esi, [pte_valid_mask]
|
||||||
or esi, PDE_LARGE
|
or esi, PDE_LARGE
|
||||||
mov [ebp+FRB.pde], esi
|
mov [ebp + FRB.pde], esi
|
||||||
add esi, edx
|
add esi, edx
|
||||||
mov [ebp+FRB.pde+4], esi
|
mov [ebp + FRB.pde + 4], esi
|
||||||
add esi, edx
|
add esi, edx
|
||||||
mov [ebp+FRB.pde+8], esi
|
mov [ebp + FRB.pde + 8], esi
|
||||||
add esi, edx
|
add esi, edx
|
||||||
mov [ebp+FRB.pde+12], esi
|
mov [ebp + FRB.pde + 12], esi
|
||||||
add esi, edx
|
add esi, edx
|
||||||
.ok:
|
.ok:
|
||||||
call calculate_fast_getting_offset_for_WinMapAddress
|
call calculate_fast_getting_offset_for_WinMapAddress
|
||||||
@@ -153,7 +153,7 @@ init_video:
|
|||||||
.create_page_tables:
|
.create_page_tables:
|
||||||
|
|
||||||
add ebp, FRB.pde
|
add ebp, FRB.pde
|
||||||
or esi, PG_GLOBAL+PAT_WC+PG_UWR
|
or esi, PG_GLOBAL + PAT_WC + PG_UWR
|
||||||
and esi, [pte_valid_mask]
|
and esi, [pte_valid_mask]
|
||||||
|
|
||||||
stdcall alloc_kernel_space, 0x1000
|
stdcall alloc_kernel_space, 0x1000
|
||||||
@@ -162,7 +162,7 @@ init_video:
|
|||||||
|
|
||||||
.new_pd:
|
.new_pd:
|
||||||
call alloc_page
|
call alloc_page
|
||||||
lea edx, [eax+PG_UWR]
|
lea edx, [eax + PG_UWR]
|
||||||
mov [ebp], edx
|
mov [ebp], edx
|
||||||
|
|
||||||
stdcall map_page, edi, eax, PG_SWR
|
stdcall map_page, edi, eax, PG_SWR
|
||||||
@@ -190,8 +190,8 @@ init_video:
|
|||||||
mov edi, eax ;free_kernel_space call
|
mov edi, eax ;free_kernel_space call
|
||||||
|
|
||||||
call alloc_page
|
call alloc_page
|
||||||
lea edx, [eax+PG_UWR]
|
lea edx, [eax + PG_UWR]
|
||||||
mov [ebp+FRB.pde], edx
|
mov [ebp + FRB.pde], edx
|
||||||
|
|
||||||
stdcall map_page, edi, eax, PG_SWR
|
stdcall map_page, edi, eax, PG_SWR
|
||||||
|
|
||||||
@@ -213,7 +213,7 @@ align 4
|
|||||||
set_framebuffer:
|
set_framebuffer:
|
||||||
push esi
|
push esi
|
||||||
push edi
|
push edi
|
||||||
lea esi, [ecx+FRB.pde]
|
lea esi, [ecx + FRB.pde]
|
||||||
mov eax, sys_proc
|
mov eax, sys_proc
|
||||||
|
|
||||||
cld
|
cld
|
||||||
@@ -221,11 +221,11 @@ set_framebuffer:
|
|||||||
cli
|
cli
|
||||||
mov [_display.current_lfb], ecx
|
mov [_display.current_lfb], ecx
|
||||||
.patch_pde:
|
.patch_pde:
|
||||||
lea edi, [eax+PROC.pdt_0+4096-32] ;last 8 pd entries up to 32Mb framebuffer
|
lea edi, [eax + PROC.pdt_0+4096-32] ;last 8 pd entries up to 32Mb framebuffer
|
||||||
mov ecx, 4
|
mov ecx, 4
|
||||||
rep movsd ;patch pde
|
rep movsd ;patch pde
|
||||||
sub esi, 16
|
sub esi, 16
|
||||||
mov eax, [eax+PROC.list.next] ;next process/address space
|
mov eax, [eax + PROC.list.next] ;next process/address space
|
||||||
cmp eax, sys_proc
|
cmp eax, sys_proc
|
||||||
jne .patch_pde
|
jne .patch_pde
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; VESA12.INC ;;
|
;; VESA12.INC ;;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
;; Distributed under terms of the GNU General Public License ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;; VESA20.INC ;;
|
;; VESA20.INC ;;
|
||||||
@@ -54,11 +54,11 @@ Vesa20_getpixel16:
|
|||||||
|
|
||||||
.no_mouseunder:
|
.no_mouseunder:
|
||||||
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
||||||
mov ebx, [BPSLine_calc_area+ebx*4]
|
mov ebx, [BPSLine_calc_area + ebx*4]
|
||||||
lea edi, [eax*2] ; edi = x*2
|
lea edi, [eax*2] ; edi = x*2
|
||||||
add edi, ebx ; edi = x*2+(y*y multiplier)
|
add edi, ebx ; edi = x*2+(y*y multiplier)
|
||||||
|
|
||||||
movzx ecx, word[LFB_BASE+edi]
|
movzx ecx, word[LFB_BASE + edi]
|
||||||
shl ecx, 3
|
shl ecx, 3
|
||||||
ror ecx, 8
|
ror ecx, 8
|
||||||
shl cx, 2
|
shl cx, 2
|
||||||
@@ -92,11 +92,11 @@ Vesa20_getpixel24:
|
|||||||
|
|
||||||
.no_mouseunder:
|
.no_mouseunder:
|
||||||
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
||||||
mov ebx, [BPSLine_calc_area+ebx*4]
|
mov ebx, [BPSLine_calc_area + ebx*4]
|
||||||
lea edi, [eax+eax*2] ; edi = x*3
|
lea edi, [eax + eax*2] ; edi = x*3
|
||||||
add edi, ebx ; edi = x*3+(y*y multiplier)
|
add edi, ebx ; edi = x*3+(y*y multiplier)
|
||||||
|
|
||||||
mov ecx, [LFB_BASE+edi]
|
mov ecx, [LFB_BASE + edi]
|
||||||
@@:
|
@@:
|
||||||
and ecx, 0x00ffffff
|
and ecx, 0x00ffffff
|
||||||
ret
|
ret
|
||||||
@@ -124,10 +124,10 @@ Vesa20_getpixel32:
|
|||||||
|
|
||||||
.no_mouseunder:
|
.no_mouseunder:
|
||||||
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
||||||
mov ebx, [BPSLine_calc_area+ebx*4]
|
mov ebx, [BPSLine_calc_area + ebx*4]
|
||||||
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
|
lea edi, [ebx + eax*4] ; edi = x*4+(y*y multiplier)
|
||||||
|
|
||||||
mov ecx, [LFB_BASE+edi]
|
mov ecx, [LFB_BASE + edi]
|
||||||
@@:
|
@@:
|
||||||
and ecx, 0x00ffffff
|
and ecx, 0x00ffffff
|
||||||
ret
|
ret
|
||||||
@@ -189,9 +189,8 @@ end virtual
|
|||||||
mov [putimg.image_cx], eax
|
mov [putimg.image_cx], eax
|
||||||
mov [putimg.image_cy], edx
|
mov [putimg.image_cy], edx
|
||||||
; calculate absolute (i.e. screen) coordinates
|
; calculate absolute (i.e. screen) coordinates
|
||||||
;mov eax, [TASK_BASE]
|
|
||||||
mov eax, [current_slot_idx]
|
mov eax, [current_slot_idx]
|
||||||
shl eax, 5 ; sizeof.WDATA
|
shl eax, BSF sizeof.WDATA
|
||||||
mov ebx, [eax + window_data + WDATA.box.left]
|
mov ebx, [eax + window_data + WDATA.box.left]
|
||||||
add ebx, [putimg.image_cx]
|
add ebx, [putimg.image_cx]
|
||||||
mov [putimg.abs_cx], ebx
|
mov [putimg.abs_cx], ebx
|
||||||
@@ -252,7 +251,7 @@ end virtual
|
|||||||
; pointer to screen
|
; pointer to screen
|
||||||
mov edx, [putimg.abs_cy]
|
mov edx, [putimg.abs_cy]
|
||||||
; imul edx, [BytesPerScanLine]
|
; imul edx, [BytesPerScanLine]
|
||||||
mov edx, [BPSLine_calc_area+edx*4]
|
mov edx, [BPSLine_calc_area + edx*4]
|
||||||
mov eax, [putimg.abs_cx]
|
mov eax, [putimg.abs_cx]
|
||||||
imul eax, ebx
|
imul eax, ebx
|
||||||
add edx, eax
|
add edx, eax
|
||||||
@@ -299,7 +298,7 @@ put_image_end_16:
|
|||||||
mov ecx, [putimg.real_sx]
|
mov ecx, [putimg.real_sx]
|
||||||
.new_x:
|
.new_x:
|
||||||
push [putimg.edi]
|
push [putimg.edi]
|
||||||
mov eax, [putimg.ebp+4]
|
mov eax, [putimg.ebp + 4]
|
||||||
call eax
|
call eax
|
||||||
cmp [ebp], bl
|
cmp [ebp], bl
|
||||||
jne .skip
|
jne .skip
|
||||||
@@ -310,7 +309,7 @@ put_image_end_16:
|
|||||||
ror eax, 8
|
ror eax, 8
|
||||||
add al, ah
|
add al, ah
|
||||||
rol eax, 8
|
rol eax, 8
|
||||||
mov [LFB_BASE+edx], ax
|
mov [LFB_BASE + edx], ax
|
||||||
.skip:
|
.skip:
|
||||||
add edx, 2
|
add edx, 2
|
||||||
inc ebp
|
inc ebp
|
||||||
@@ -347,7 +346,7 @@ put_image_end_16_old:
|
|||||||
mov ecx, [putimg.real_sx]
|
mov ecx, [putimg.real_sx]
|
||||||
.new_x:
|
.new_x:
|
||||||
push [putimg.edi]
|
push [putimg.edi]
|
||||||
mov eax, [putimg.ebp+4]
|
mov eax, [putimg.ebp + 4]
|
||||||
call eax
|
call eax
|
||||||
cmp [ebp], bl
|
cmp [ebp], bl
|
||||||
jne .skip
|
jne .skip
|
||||||
@@ -370,7 +369,7 @@ put_image_end_16_old:
|
|||||||
;; ror eax, 8
|
;; ror eax, 8
|
||||||
;; add al, ah
|
;; add al, ah
|
||||||
;; rol eax, 8
|
;; rol eax, 8
|
||||||
mov [LFB_BASE+edx], ax
|
mov [LFB_BASE + edx], ax
|
||||||
.skip:
|
.skip:
|
||||||
inc edx
|
inc edx
|
||||||
inc edx
|
inc edx
|
||||||
@@ -406,7 +405,7 @@ put_image_end_16_new:
|
|||||||
|
|
||||||
.new_x:
|
.new_x:
|
||||||
push [putimg.edi]
|
push [putimg.edi]
|
||||||
mov eax, [putimg.ebp+4]
|
mov eax, [putimg.ebp + 4]
|
||||||
call eax
|
call eax
|
||||||
|
|
||||||
cmp [ebp], bl
|
cmp [ebp], bl
|
||||||
@@ -497,15 +496,15 @@ put_image_end_24:
|
|||||||
mov ecx, [putimg.real_sx]
|
mov ecx, [putimg.real_sx]
|
||||||
.new_x:
|
.new_x:
|
||||||
push [putimg.edi]
|
push [putimg.edi]
|
||||||
mov eax, [putimg.ebp+4]
|
mov eax, [putimg.ebp + 4]
|
||||||
call eax
|
call eax
|
||||||
cmp [ebp], bl
|
cmp [ebp], bl
|
||||||
jne .skip
|
jne .skip
|
||||||
|
|
||||||
; store to LFB
|
; store to LFB
|
||||||
mov [LFB_BASE+edx], ax
|
mov [LFB_BASE + edx], ax
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
mov [LFB_BASE+edx+2], al
|
mov [LFB_BASE + edx + 2], al
|
||||||
|
|
||||||
.skip:
|
.skip:
|
||||||
add edx, 3
|
add edx, 3
|
||||||
@@ -545,7 +544,7 @@ put_image_end_24_old:
|
|||||||
align 4
|
align 4
|
||||||
.new_x:
|
.new_x:
|
||||||
push [putimg.edi]
|
push [putimg.edi]
|
||||||
mov eax, [putimg.ebp+4]
|
mov eax, [putimg.ebp + 4]
|
||||||
call eax
|
call eax
|
||||||
cmp [ebp], bl
|
cmp [ebp], bl
|
||||||
jne .skip
|
jne .skip
|
||||||
@@ -561,9 +560,9 @@ align 4
|
|||||||
call check_mouse_area_for_putpixel
|
call check_mouse_area_for_putpixel
|
||||||
pop ecx
|
pop ecx
|
||||||
; store to LFB
|
; store to LFB
|
||||||
mov [LFB_BASE+edx], ax
|
mov [LFB_BASE + edx], ax
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
mov [LFB_BASE+edx+2], al
|
mov [LFB_BASE + edx + 2], al
|
||||||
|
|
||||||
.skip:
|
.skip:
|
||||||
add edx, 3
|
add edx, 3
|
||||||
@@ -601,7 +600,7 @@ put_image_end_24_new:
|
|||||||
|
|
||||||
.new_x:
|
.new_x:
|
||||||
push [putimg.edi]
|
push [putimg.edi]
|
||||||
mov eax, [putimg.ebp+4]
|
mov eax, [putimg.ebp + 4]
|
||||||
call eax
|
call eax
|
||||||
cmp [ebp], bl
|
cmp [ebp], bl
|
||||||
jne .skip
|
jne .skip
|
||||||
@@ -642,9 +641,9 @@ put_image_end_24_new:
|
|||||||
pop ecx
|
pop ecx
|
||||||
|
|
||||||
; store to LFB
|
; store to LFB
|
||||||
mov [LFB_BASE+edx], ax
|
mov [LFB_BASE + edx], ax
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
mov [LFB_BASE+edx+2], al
|
mov [LFB_BASE + edx + 2], al
|
||||||
|
|
||||||
.skip:
|
.skip:
|
||||||
add edx, 3
|
add edx, 3
|
||||||
@@ -691,13 +690,13 @@ put_image_end_32:
|
|||||||
|
|
||||||
.new_x:
|
.new_x:
|
||||||
push [putimg.edi]
|
push [putimg.edi]
|
||||||
mov eax, [putimg.ebp+4]
|
mov eax, [putimg.ebp + 4]
|
||||||
call eax
|
call eax
|
||||||
cmp [ebp], bl
|
cmp [ebp], bl
|
||||||
jne .skip
|
jne .skip
|
||||||
|
|
||||||
; store to LFB
|
; store to LFB
|
||||||
mov [LFB_BASE+edx], eax
|
mov [LFB_BASE + edx], eax
|
||||||
|
|
||||||
.skip:
|
.skip:
|
||||||
add edx, 4
|
add edx, 4
|
||||||
@@ -743,7 +742,7 @@ put_image_end_32_old:
|
|||||||
mov ecx, [putimg.real_sx]
|
mov ecx, [putimg.real_sx]
|
||||||
.new_x:
|
.new_x:
|
||||||
push [putimg.edi]
|
push [putimg.edi]
|
||||||
mov eax, [putimg.ebp+4]
|
mov eax, [putimg.ebp + 4]
|
||||||
call eax
|
call eax
|
||||||
cmp [ebp], bl
|
cmp [ebp], bl
|
||||||
jne .skip
|
jne .skip
|
||||||
@@ -797,7 +796,7 @@ put_image_end_32_new:
|
|||||||
|
|
||||||
.new_x:
|
.new_x:
|
||||||
push [putimg.edi]
|
push [putimg.edi]
|
||||||
mov eax, [putimg.ebp+4]
|
mov eax, [putimg.ebp + 4]
|
||||||
call eax
|
call eax
|
||||||
cmp [ebp], bl
|
cmp [ebp], bl
|
||||||
jne .skip
|
jne .skip
|
||||||
@@ -902,9 +901,9 @@ __sys_putpixel:
|
|||||||
|
|
||||||
not ecx
|
not ecx
|
||||||
rol ecx, 8
|
rol ecx, 8
|
||||||
mov cl, [esp+32-8+3]
|
mov cl, [esp + 32-8+3]
|
||||||
ror ecx, 8
|
ror ecx, 8
|
||||||
mov [esp+32-8], ecx
|
mov [esp + 32-8], ecx
|
||||||
.no_inv:
|
.no_inv:
|
||||||
call [PUTPIXEL] ; call the real put_pixel function
|
call [PUTPIXEL] ; call the real put_pixel function
|
||||||
.exit:
|
.exit:
|
||||||
@@ -923,9 +922,9 @@ Vesa20_putpixel16:
|
|||||||
mov cx, bx
|
mov cx, bx
|
||||||
|
|
||||||
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
||||||
mov ebx, [BPSLine_calc_area+ebx*4]
|
mov ebx, [BPSLine_calc_area + ebx*4]
|
||||||
lea edi, [eax*2]; edi = x*2
|
lea edi, [eax*2]; edi = x*2
|
||||||
mov eax, [esp+32-8+4]
|
mov eax, [esp + 32-8+4]
|
||||||
|
|
||||||
; check for hardware cursor
|
; check for hardware cursor
|
||||||
cmp [_display.select_cursor], 0
|
cmp [_display.select_cursor], 0
|
||||||
@@ -943,7 +942,7 @@ Vesa20_putpixel16:
|
|||||||
add al, ah
|
add al, ah
|
||||||
rol eax, 8
|
rol eax, 8
|
||||||
|
|
||||||
mov [LFB_BASE+ebx+edi], ax
|
mov [LFB_BASE + ebx + edi], ax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
@@ -958,9 +957,9 @@ Vesa20_putpixel16_new:
|
|||||||
mov cx, bx
|
mov cx, bx
|
||||||
|
|
||||||
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
||||||
mov ebx, [BPSLine_calc_area+ebx*4]
|
mov ebx, [BPSLine_calc_area + ebx*4]
|
||||||
lea edi, [eax*2]; edi = x*2
|
lea edi, [eax*2]; edi = x*2
|
||||||
mov eax, [esp+32-8+4]
|
mov eax, [esp + 32-8+4]
|
||||||
|
|
||||||
; check for hardware cursor
|
; check for hardware cursor
|
||||||
cmp [_display.select_cursor], select_cursor
|
cmp [_display.select_cursor], select_cursor
|
||||||
@@ -993,7 +992,7 @@ Vesa20_putpixel16_new:
|
|||||||
add al, ah
|
add al, ah
|
||||||
rol eax, 8
|
rol eax, 8
|
||||||
|
|
||||||
mov [LFB_BASE+ebx+edi], ax
|
mov [LFB_BASE + ebx + edi], ax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
@@ -1008,9 +1007,9 @@ Vesa20_putpixel24:
|
|||||||
mov cx, bx
|
mov cx, bx
|
||||||
|
|
||||||
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
||||||
mov ebx, [BPSLine_calc_area+ebx*4]
|
mov ebx, [BPSLine_calc_area + ebx*4]
|
||||||
lea edi, [eax+eax*2]; edi = x*3
|
lea edi, [eax + eax*2]; edi = x*3
|
||||||
mov eax, [esp+32-8+4]
|
mov eax, [esp + 32-8+4]
|
||||||
|
|
||||||
; check for hardware cursor
|
; check for hardware cursor
|
||||||
cmp [_display.select_cursor], 0
|
cmp [_display.select_cursor], 0
|
||||||
@@ -1022,9 +1021,9 @@ Vesa20_putpixel24:
|
|||||||
@@:
|
@@:
|
||||||
|
|
||||||
; store to LFB
|
; store to LFB
|
||||||
mov [LFB_BASE+ebx+edi], ax
|
mov [LFB_BASE + ebx + edi], ax
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
mov [LFB_BASE+ebx+edi+2], al
|
mov [LFB_BASE + ebx + edi + 2], al
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
@@ -1040,8 +1039,8 @@ Vesa20_putpixel24_new:
|
|||||||
|
|
||||||
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
||||||
mov ebx, [BPSLine_calc_area+ebx*4]
|
mov ebx, [BPSLine_calc_area+ebx*4]
|
||||||
lea edi, [eax+eax*2]; edi = x*3
|
lea edi, [eax + eax*2]; edi = x*3
|
||||||
mov eax, [esp+32-8+4]
|
mov eax, [esp + 32-8+4]
|
||||||
|
|
||||||
; check for hardware cursor
|
; check for hardware cursor
|
||||||
cmp [_display.select_cursor], select_cursor
|
cmp [_display.select_cursor], select_cursor
|
||||||
@@ -1067,9 +1066,9 @@ Vesa20_putpixel24_new:
|
|||||||
call check_mouse_area_for_putpixel_new.1
|
call check_mouse_area_for_putpixel_new.1
|
||||||
@@:
|
@@:
|
||||||
; store to LFB
|
; store to LFB
|
||||||
mov [LFB_BASE+ebx+edi], ax
|
mov [LFB_BASE + ebx + edi], ax
|
||||||
shr eax, 16
|
shr eax, 16
|
||||||
mov [LFB_BASE+ebx+edi+2], al
|
mov [LFB_BASE + ebx + edi + 2], al
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
@@ -1085,8 +1084,8 @@ Vesa20_putpixel32:
|
|||||||
|
|
||||||
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
||||||
mov ebx, [BPSLine_calc_area+ebx*4]
|
mov ebx, [BPSLine_calc_area+ebx*4]
|
||||||
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
|
lea edi, [ebx + eax*4] ; edi = x*4+(y*y multiplier)
|
||||||
mov eax, [esp+32-8+4] ; eax = color
|
mov eax, [esp + 32-8+4] ; eax = color
|
||||||
|
|
||||||
; check for hardware cursor
|
; check for hardware cursor
|
||||||
cmp [_display.select_cursor], 0
|
cmp [_display.select_cursor], 0
|
||||||
@@ -1098,7 +1097,7 @@ Vesa20_putpixel32:
|
|||||||
@@:
|
@@:
|
||||||
and eax, 0xffffff
|
and eax, 0xffffff
|
||||||
; store to LFB
|
; store to LFB
|
||||||
mov [LFB_BASE+edi], eax
|
mov [LFB_BASE + edi], eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
@@ -1114,8 +1113,8 @@ Vesa20_putpixel32_new:
|
|||||||
|
|
||||||
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
|
||||||
mov ebx, [BPSLine_calc_area+ebx*4]
|
mov ebx, [BPSLine_calc_area+ebx*4]
|
||||||
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
|
lea edi, [ebx + eax*4] ; edi = x*4+(y*y multiplier)
|
||||||
mov eax, [esp+32-8+4] ; eax = color
|
mov eax, [esp + 32-8+4] ; eax = color
|
||||||
|
|
||||||
; check for hardware cursor
|
; check for hardware cursor
|
||||||
cmp [_display.select_cursor], select_cursor
|
cmp [_display.select_cursor], select_cursor
|
||||||
@@ -1142,7 +1141,7 @@ Vesa20_putpixel32_new:
|
|||||||
@@:
|
@@:
|
||||||
and eax, 0x00ffffff
|
and eax, 0x00ffffff
|
||||||
; store to LFB
|
; store to LFB
|
||||||
mov [LFB_BASE+edi], eax
|
mov [LFB_BASE + edi], eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
@@ -1403,9 +1402,8 @@ end virtual
|
|||||||
mov [drbar.bar_sx], ecx
|
mov [drbar.bar_sx], ecx
|
||||||
mov [drbar.bar_cx], eax
|
mov [drbar.bar_cx], eax
|
||||||
mov [drbar.bar_cy], ebx
|
mov [drbar.bar_cy], ebx
|
||||||
;mov edi, [TASK_BASE]
|
|
||||||
mov edi, [current_slot_idx]
|
mov edi, [current_slot_idx]
|
||||||
shl edi, 5 ; sizeof.WDATA
|
shl edi, BSF sizeof.WDATA
|
||||||
add eax, [edi + window_data + WDATA.box.left] ; win_cx
|
add eax, [edi + window_data + WDATA.box.left] ; win_cx
|
||||||
add ebx, [edi + window_data + WDATA.box.top] ; win_cy
|
add ebx, [edi + window_data + WDATA.box.top] ; win_cy
|
||||||
mov [drbar.abs_cx], eax
|
mov [drbar.abs_cx], eax
|
||||||
@@ -2015,9 +2013,9 @@ vesa20_drawbackground_tiled:
|
|||||||
|
|
||||||
pushad
|
pushad
|
||||||
; External loop for all y from start to end
|
; External loop for all y from start to end
|
||||||
mov ebx, [draw_data+32+RECT.top] ; y start
|
mov ebx, [draw_data + 32 + RECT.top] ; y start
|
||||||
dp2:
|
dp2:
|
||||||
mov ebp, [draw_data+32+RECT.left] ; x start
|
mov ebp, [draw_data + 32 + RECT.left] ; x start
|
||||||
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
|
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
|
||||||
; and LFB data (output for our function) [edi]
|
; and LFB data (output for our function) [edi]
|
||||||
; mov eax, [BytesPerScanLine]
|
; mov eax, [BytesPerScanLine]
|
||||||
@@ -2115,7 +2113,7 @@ vesa20_drawbackground_tiled:
|
|||||||
|
|
||||||
add ebp, edx
|
add ebp, edx
|
||||||
add eax, edx
|
add eax, edx
|
||||||
cmp eax, [draw_data+32+RECT.right]
|
cmp eax, [draw_data + 32 + RECT.right]
|
||||||
ja dp4
|
ja dp4
|
||||||
sub ecx, edx
|
sub ecx, edx
|
||||||
jnz dp3
|
jnz dp3
|
||||||
@@ -2130,7 +2128,7 @@ vesa20_drawbackground_tiled:
|
|||||||
dp4:
|
dp4:
|
||||||
; next scan line
|
; next scan line
|
||||||
inc ebx
|
inc ebx
|
||||||
cmp ebx, [draw_data+32+RECT.bottom]
|
cmp ebx, [draw_data + 32 + RECT.bottom]
|
||||||
jbe dp2
|
jbe dp2
|
||||||
popad
|
popad
|
||||||
mov [EGA_counter], 1
|
mov [EGA_counter], 1
|
||||||
@@ -2168,8 +2166,8 @@ vesa20_drawbackground_stretch:
|
|||||||
push eax ; low
|
push eax ; low
|
||||||
|
|
||||||
; External loop for all y from start to end
|
; External loop for all y from start to end
|
||||||
mov ebx, [draw_data+32+RECT.top] ; y start
|
mov ebx, [draw_data + 32 + RECT.top] ; y start
|
||||||
mov ebp, [draw_data+32+RECT.left] ; x start
|
mov ebp, [draw_data + 32 + RECT.left] ; x start
|
||||||
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
|
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
|
||||||
; and LFB data (output for our function) [edi]
|
; and LFB data (output for our function) [edi]
|
||||||
; mov eax, [BytesPerScanLine]
|
; mov eax, [BytesPerScanLine]
|
||||||
@@ -2319,11 +2317,11 @@ vesa20_drawbackground_stretch:
|
|||||||
mov ebx, [esp+24]
|
mov ebx, [esp+24]
|
||||||
add ebx, 1
|
add ebx, 1
|
||||||
mov [esp+24], ebx
|
mov [esp+24], ebx
|
||||||
cmp ebx, [draw_data+32+RECT.bottom]
|
cmp ebx, [draw_data + 32 + RECT.bottom]
|
||||||
ja sdpdone
|
ja sdpdone
|
||||||
|
|
||||||
; advance edi, ebp to next scan line
|
; advance edi, ebp to next scan line
|
||||||
sub eax, [draw_data+32+RECT.left]
|
sub eax, [draw_data + 32 + RECT.left]
|
||||||
sub ebp, eax
|
sub ebp, eax
|
||||||
add ebp, [_display.width]
|
add ebp, [_display.width]
|
||||||
sub edi, eax
|
sub edi, eax
|
||||||
@@ -2348,7 +2346,7 @@ vesa20_drawbackground_stretch:
|
|||||||
lea eax, [eax*3]
|
lea eax, [eax*3]
|
||||||
imul eax, [BgrDataWidth]
|
imul eax, [BgrDataWidth]
|
||||||
sub [esp], eax
|
sub [esp], eax
|
||||||
mov eax, [draw_data+32+RECT.left]
|
mov eax, [draw_data + 32 + RECT.left]
|
||||||
mov [esp+20], eax
|
mov [esp+20], eax
|
||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
jz sdp3
|
jz sdp3
|
||||||
@@ -2388,7 +2386,7 @@ smooth_line:
|
|||||||
mov eax, [esp+20+8]
|
mov eax, [esp+20+8]
|
||||||
add eax, 1
|
add eax, 1
|
||||||
mov [esp+20+8], eax
|
mov [esp+20+8], eax
|
||||||
cmp eax, [draw_data+32+RECT.right]
|
cmp eax, [draw_data + 32 + RECT.right]
|
||||||
ja @f
|
ja @f
|
||||||
add ecx, [esp+36+8]
|
add ecx, [esp+36+8]
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
@@ -2398,7 +2396,7 @@ smooth_line:
|
|||||||
sub esi, eax
|
sub esi, eax
|
||||||
jmp smooth_line
|
jmp smooth_line
|
||||||
@@:
|
@@:
|
||||||
mov eax, [draw_data+32+RECT.left]
|
mov eax, [draw_data + 32 + RECT.left]
|
||||||
mov [esp+20+8], eax
|
mov [esp+20+8], eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -2449,16 +2447,16 @@ else
|
|||||||
movzx eax, cl
|
movzx eax, cl
|
||||||
sub eax, ebx
|
sub eax, ebx
|
||||||
movzx ebx, dh
|
movzx ebx, dh
|
||||||
add dl, [BgrAuxTable+(eax+0x100)+esi]
|
add dl, [BgrAuxTable + (eax + 0x100) + esi]
|
||||||
movzx eax, ch
|
movzx eax, ch
|
||||||
sub eax, ebx
|
sub eax, ebx
|
||||||
add dh, [BgrAuxTable+(eax+0x100)+esi]
|
add dh, [BgrAuxTable + (eax+0x100) + esi]
|
||||||
ror ecx, 16
|
ror ecx, 16
|
||||||
ror edx, 16
|
ror edx, 16
|
||||||
movzx eax, cl
|
movzx eax, cl
|
||||||
movzx ebx, dl
|
movzx ebx, dl
|
||||||
sub eax, ebx
|
sub eax, ebx
|
||||||
add dl, [BgrAuxTable+(eax+0x100)+esi]
|
add dl, [BgrAuxTable + (eax + 0x100) + esi]
|
||||||
pop esi
|
pop esi
|
||||||
mov eax, edx
|
mov eax, edx
|
||||||
pop edx
|
pop edx
|
||||||
@@ -2489,7 +2487,7 @@ init_background:
|
|||||||
loop .loop1
|
loop .loop1
|
||||||
add dl, 4
|
add dl, 4
|
||||||
jnz .loop2
|
jnz .loop2
|
||||||
test byte [cpu_caps+(CAPS_MMX/8)], 1 shl (CAPS_MMX mod 8)
|
test byte [cpu_caps + (CAPS_MMX/8)], 1 shl (CAPS_MMX mod 8)
|
||||||
jz @f
|
jz @f
|
||||||
mov [overlapping_of_points_ptr], overlapping_of_points_mmx
|
mov [overlapping_of_points_ptr], overlapping_of_points_mmx
|
||||||
@@:
|
@@:
|
||||||
|
@@ -250,7 +250,7 @@ align 4
|
|||||||
@@:
|
@@:
|
||||||
push ebx edx esi edi
|
push ebx edx esi edi
|
||||||
shl edx, 9
|
shl edx, 9
|
||||||
lea edx, [edx+edx*4]
|
lea edx, [edx + edx*4]
|
||||||
add esi, edx
|
add esi, edx
|
||||||
shr edx, 5
|
shr edx, 5
|
||||||
add edi, edx
|
add edi, edx
|
||||||
@@ -378,7 +378,7 @@ VGA_putpixel:
|
|||||||
; eax = x
|
; eax = x
|
||||||
; ebx = y
|
; ebx = y
|
||||||
mov ecx, eax
|
mov ecx, eax
|
||||||
mov eax, [esp+32-8+4] ; color
|
mov eax, [esp + 32-8+4] ; color
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
; check for hardware cursor
|
; check for hardware cursor
|
||||||
cmp [_display.select_cursor], select_cursor
|
cmp [_display.select_cursor], select_cursor
|
||||||
@@ -403,8 +403,8 @@ align 4
|
|||||||
align 4
|
align 4
|
||||||
.no_mouseunder:
|
.no_mouseunder:
|
||||||
shl ebx, 9
|
shl ebx, 9
|
||||||
lea ebx, [ebx+ebx*4] ; multiply by 5
|
lea ebx, [ebx + ebx*4] ; multiply by 5
|
||||||
lea edx, [ebx+ecx*4] ; + x*BytesPerPixel (Vesa2.0 32)
|
lea edx, [ebx + ecx*4] ; + x*BytesPerPixel (Vesa2.0 32)
|
||||||
mov edi, edx
|
mov edi, edx
|
||||||
add edi, [LFBAddress] ; + LFB address
|
add edi, [LFBAddress] ; + LFB address
|
||||||
mov [edi], eax ; write to LFB for Vesa2.0
|
mov [edi], eax ; write to LFB for Vesa2.0
|
||||||
@@ -496,14 +496,14 @@ align 4
|
|||||||
VGA_draw_bar_1:
|
VGA_draw_bar_1:
|
||||||
mov [temp.cx], eax
|
mov [temp.cx], eax
|
||||||
mov eax, [current_slot_idx]
|
mov eax, [current_slot_idx]
|
||||||
shl eax, 5
|
shl eax, BSF sizeof.WDATA
|
||||||
add ebx, [eax+window_data+WDATA.box.top]
|
add ebx, [window_data + eax + WDATA.box.top]
|
||||||
mov eax, [eax+window_data+WDATA.box.left]
|
mov eax, [window_data + eax + WDATA.box.left]
|
||||||
add eax, [temp.cx]
|
add eax, [temp.cx]
|
||||||
and eax, 0xfff8
|
and eax, 0xfff8
|
||||||
shl ebx, 9
|
shl ebx, 9
|
||||||
lea ebx, [ebx+ebx*4] ; multiply by 5
|
lea ebx, [ebx + ebx*4] ; multiply by 5
|
||||||
lea ebx, [ebx+eax*4] ; + x*BytesPerPixel (Vesa2.0 32)
|
lea ebx, [ebx + eax*4] ; + x*BytesPerPixel (Vesa2.0 32)
|
||||||
mov esi, ebx
|
mov esi, ebx
|
||||||
add esi, [LFBAddress] ; + LFB address
|
add esi, [LFBAddress] ; + LFB address
|
||||||
shr ebx, 5 ; change BytesPerPixel to 1/8
|
shr ebx, 5 ; change BytesPerPixel to 1/8
|
||||||
@@ -525,7 +525,7 @@ align 4
|
|||||||
VGA_draw_long_line_1:
|
VGA_draw_long_line_1:
|
||||||
push ebx edx esi edi
|
push ebx edx esi edi
|
||||||
shl edx, 9
|
shl edx, 9
|
||||||
lea edx, [edx+edx*4]
|
lea edx, [edx + edx*4]
|
||||||
add esi, edx
|
add esi, edx
|
||||||
shr edx, 5
|
shr edx, 5
|
||||||
add edi, edx
|
add edi, edx
|
||||||
|
Reference in New Issue
Block a user