small update copyright year in kernel

git-svn-id: svn://kolibrios.org@9715 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Doczom 2022-02-12 17:27:41 +00:00
parent 3920d392b0
commit 182f6ade61
61 changed files with 1686 additions and 1734 deletions

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -281,8 +281,6 @@ LFB_BASE = 0xFE000000
new_app_base = 0;
;twdw = TASK_TABLE - window_data
std_application_base_address = new_app_base
RING0_STACK_SIZE = 0x2000

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -76,8 +76,8 @@ end if
; IOAPIC init
xor ebx, ebx
@@:
stdcall map_io_mem, [acpi_ioapic_base+ebx*4], 0x20, PG_GLOBAL+PG_NOCACHE+PG_SWR
mov [IOAPIC_base+ebx*4], eax
stdcall map_io_mem, [acpi_ioapic_base + ebx*4], 0x20, PG_GLOBAL + PG_NOCACHE + PG_SWR
mov [IOAPIC_base + ebx*4], eax
inc ebx
cmp ebx, [ioapic_cnt]
jnz @b
@ -91,7 +91,7 @@ end if
shr eax, 16
inc al
movzx eax, al
mov ecx, [ioapic_gsi_base+edx*4]
mov ecx, [ioapic_gsi_base + edx*4]
cmp ecx, IRQ_RESERVED
jae .lapic_init
add ecx, eax
@ -99,7 +99,7 @@ end if
jbe @f
sub eax, ecx
@@:
mov [IRQ_COUNT+edx*4], eax
mov [IRQ_COUNT + edx*4], eax
; Reroute IOAPIC & mask all interrupts
xor ecx, ecx
@ -110,7 +110,7 @@ end if
mov ah, 0x08; Delivery Mode: Fixed, Destination Mode: Logical
mov al, cl
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
cmp [ioapic_cur], 0
jnz @f
@ -128,7 +128,7 @@ end if
call IOAPIC_write
inc eax
inc ecx
cmp ecx, [IRQ_COUNT+edx*4]
cmp ecx, [IRQ_COUNT + edx*4]
jb .next_irq
inc [ioapic_cur]
@ -158,7 +158,7 @@ LAPIC_init:
mov eax, [LAPIC_BASE]
test eax, eax
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 esi, eax
@ -243,7 +243,7 @@ IOAPIC_read:
; out: EAX - readed value
push esi
mov esi, [ioapic_cur]
mov esi, [IOAPIC_base+esi*4]
mov esi, [IOAPIC_base + esi*4]
mov [esi], eax
mov eax, [esi + 0x10]
pop esi
@ -256,7 +256,7 @@ IOAPIC_write:
; out: none
push esi
mov esi, [ioapic_cur]
mov esi, [IOAPIC_base+esi*4]
mov esi, [IOAPIC_base + esi*4]
mov [esi], eax
mov [esi + 0x10], ebx
pop esi
@ -348,7 +348,7 @@ IRQ_mask_all:
mov [ioapic_cur], 0
.next_ioapic:
mov edx, [ioapic_cur]
mov ecx, [IRQ_COUNT+edx*4]
mov ecx, [IRQ_COUNT + edx*4]
mov eax, 0x10
@@:
mov ebx, eax
@ -454,8 +454,8 @@ proc disable_irq stdcall, irq_line:dword
push [ioapic_cur]
xor eax, eax
.next_ioapic:
mov ecx, [ioapic_gsi_base+eax*4]
add ecx, [IRQ_COUNT+eax*4]
mov ecx, [ioapic_gsi_base + eax*4]
add ecx, [IRQ_COUNT + eax*4]
cmp ebx, ecx
jae .found
inc eax
@ -485,7 +485,7 @@ pci_irq_fixup:
mov esi, [acpi_dev_data]
mov ebx, [acpi_dev_size]
lea edi, [esi+ebx]
lea edi, [esi + ebx]
.iterate:

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -12,7 +12,7 @@ $Revision$
sys_debug_services:
cmp ebx, 9
ja @f
jmp dword [sys_debug_services_table+ebx*4]
jmp dword [sys_debug_services_table + ebx*4]
@@:
ret
iglobal
@ -33,7 +33,7 @@ debug_set_event_data:
; in: ecx = pointer
; destroys eax
mov eax, [current_slot]
mov [eax+APPDATA.dbg_event_mem], ecx
mov [eax + APPDATA.dbg_event_mem], ecx
ret
get_debuggee_slot:
@ -49,7 +49,7 @@ get_debuggee_slot:
shl eax, BSF sizeof.APPDATA
push ebx
mov ebx, [current_slot_idx]
cmp [SLOT_BASE+eax+APPDATA.debugger_slot], ebx
cmp [SLOT_BASE + eax + APPDATA.debugger_slot], ebx
pop ebx
jnz .ret_bad
; clc ; automatically
@ -63,7 +63,7 @@ debug_detach:
; destroys eax,ebx
call get_debuggee_slot
jc .ret
and dword [eax+SLOT_BASE+APPDATA.debugger_slot], 0
and dword [eax + SLOT_BASE + APPDATA.debugger_slot], 0
call do_resume
.ret:
sti
@ -155,15 +155,15 @@ debug_getcontext:
call get_debuggee_slot
jc .ret
shr eax, 8
shr eax, BSF sizeof.APPDATA
cmp eax, [fpu_owner]
jne @f
inc bh ; set swap context flag
@@:
shl eax, BSF sizeof.APPDATA
mov edi, esi
mov eax, [eax+SLOT_BASE+APPDATA.pl0_stack]
lea esi, [eax+RING0_STACK_SIZE]
mov eax, [SLOT_BASE + eax + APPDATA.pl0_stack]
lea esi, [eax + RING0_STACK_SIZE]
.ring0:
; note that following code assumes that all interrupt/exception handlers
@ -231,8 +231,8 @@ debug_setcontext:
call get_debuggee_slot
jc .stiret
; mov esi, edx
mov eax, [eax+SLOT_BASE+APPDATA.pl0_stack]
lea edi, [eax+RING0_STACK_SIZE]
mov eax, [eax + SLOT_BASE+APPDATA.pl0_stack]
lea edi, [eax + RING0_STACK_SIZE]
.ring0:
sub edi, 8+12+20h
@ -267,7 +267,7 @@ debug_set_drx:
call get_debuggee_slot
jc .errret
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+10]=dr7
cmp esi, OS_BASE
@ -288,13 +288,13 @@ debug_set_drx:
; clear breakpoint
movzx edx, dl
add edx, edx
and dword [eax+edx*2], 0 ; clear DR<i>
btr dword [eax+10h], edx ; clear L<i> bit
test byte [eax+10h], 55h
and dword [eax + edx*2], 0 ; clear DR<i>
btr dword [eax + 10h], edx ; clear L<i> bit
test byte [eax + 10h], 55h
jnz .okret
; imul eax, ebp, tss_step/32
; 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:
and dword [esp+32], 0
sti
@ -325,23 +325,23 @@ debug_set_drx:
test bl, dl
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 ecx, dl
add ecx, ecx
bts dword [eax+10h], ecx ; set L<i> flag
bts dword [eax + 10h], ecx ; set L<i> flag
add ecx, ecx
mov [eax+ecx], ebx;esi ; set DR<i>
mov [eax + ecx], ebx;esi ; set DR<i>
shl edx, cl
mov ebx, 0xF
shl ebx, cl
not ebx
and [eax+10h+2], bx
or [eax+10h+2], dx ; set R/W and LEN fields
and [eax + 10h+2], bx
or [eax + 10h+2], dx ; set R/W and LEN fields
; imul eax, ebp, tss_step/32
; 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
debug_read_process_memory:
@ -354,7 +354,7 @@ debug_read_process_memory:
; destroys all
call get_debuggee_slot
jc .err
shr eax, 8
shr eax, BSF sizeof.APPDATA
mov ecx, edi
call read_process_memory
sti
@ -374,7 +374,7 @@ debug_write_process_memory:
; destroys all
call get_debuggee_slot
jc debug_read_process_memory.err
shr eax, 8
shr eax, BSF sizeof.APPDATA
mov ecx, edi
call write_process_memory
sti
@ -393,8 +393,8 @@ debugger_notify:
add edi, 500 ; 5 sec timeout
.1:
mov eax, ebp
shl eax, 8
mov esi, [SLOT_BASE+eax+APPDATA.dbg_event_mem]
shl eax, BSF sizeof.APPDATA
mov esi, [SLOT_BASE + eax + APPDATA.dbg_event_mem]
test esi, esi
jz .ret
; read buffer header
@ -450,6 +450,6 @@ debugger_notify:
; new debug event
mov eax, ebp
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

View File

@ -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. ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -21,12 +21,12 @@ proc get_notify stdcall, p_ev:dword
.wait:
mov ebx, [current_slot]
test dword [ebx+APPDATA.event_mask], EVENT_NOTIFY
test dword [ebx + APPDATA.event_mask], EVENT_NOTIFY
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 dword [edi], EV_INTR
mov eax, [ebx+APPDATA.event]
mov eax, [ebx + APPDATA.event]
mov dword [edi+4], eax
ret
@@:
@ -50,15 +50,15 @@ proc srv_handler stdcall, ioctl:dword
test esi, esi
jz .err
mov edi, [esi+handle]
cmp [edi+SRV.magic], ' SRV'
mov edi, [esi + handle]
cmp [edi + SRV.magic], ' SRV'
jne .fail
cmp [edi+SRV.size], sizeof.SRV
cmp [edi + SRV.size], sizeof.SRV
jne .fail
; stdcall [edi+SRV.srv_proc], esi
mov eax, [edi+SRV.srv_proc]
mov eax, [edi + SRV.srv_proc]
test eax, eax
jz .fail
stdcall eax, esi
@ -66,8 +66,8 @@ proc srv_handler stdcall, ioctl:dword
.fail:
xor eax, eax
not eax
mov [esi+output], eax
mov [esi+out_size], 4
mov [esi + output], eax
mov [esi + out_size], 4
ret
.err:
xor eax, eax
@ -86,19 +86,19 @@ srv_handlerEx:
cmp ecx, OS_BASE
jae .fail
mov eax, [ecx+handle]
mov eax, [ecx + handle]
cmp eax, OS_BASE
jbe .fail
cmp [eax+SRV.magic], ' SRV'
cmp [eax + SRV.magic], ' SRV'
jne .fail
cmp [eax+SRV.size], sizeof.SRV
cmp [eax + SRV.size], sizeof.SRV
jne .fail
; stdcall [eax+SRV.srv_proc], ecx
mov eax, [eax+SRV.srv_proc]
mov eax, [eax + SRV.srv_proc]
test eax, eax
jz .fail
stdcall eax, ecx
@ -123,7 +123,7 @@ proc get_service stdcall, sz_name:dword
@@:
mov edx, [srv.fd]
@@:
cmp edx, srv.fd-SRV.fd
cmp edx, srv.fd - SRV.fd
je .not_load
stdcall strncmp, edx, [sz_name], 16
@ -131,7 +131,7 @@ proc get_service stdcall, sz_name:dword
mov eax, edx
je .nothing
mov edx, [edx+SRV.fd]
mov edx, [edx + SRV.fd]
jmp @B
.not_load:
mov eax, [sz_name]
@ -210,18 +210,18 @@ proc reg_service_ex stdcall, name:dword, handler:dword, srvsize:dword
pop edi
pop esi
mov [eax+SRV.magic], ' SRV'
mov [eax+SRV.size], sizeof.SRV
mov [eax + SRV.magic], ' SRV'
mov [eax + SRV.size], sizeof.SRV
mov ebx, srv.fd-SRV.fd
mov edx, [ebx+SRV.fd]
mov [eax+SRV.fd], edx
mov [eax+SRV.bk], ebx
mov [ebx+SRV.fd], eax
mov [edx+SRV.bk], eax
mov ebx, srv.fd - SRV.fd
mov edx, [ebx + SRV.fd]
mov [eax + SRV.fd], edx
mov [eax + SRV.bk], ebx
mov [ebx + SRV.fd], eax
mov [edx + SRV.bk], eax
mov ecx, [handler]
mov [eax+SRV.srv_proc], ecx
mov [eax + SRV.srv_proc], ecx
;dec [count_services]
pop ebx
ret
@ -236,15 +236,15 @@ stop_all_services: ;used in shutdown system
push ebp
mov edx, [srv.fd]
.next:
cmp edx, srv.fd-SRV.fd
cmp edx, srv.fd - SRV.fd
je .done
cmp [edx+SRV.magic], ' SRV'
cmp [edx + SRV.magic], ' SRV'
jne .next
cmp [edx+SRV.size], sizeof.SRV
cmp [edx + SRV.size], sizeof.SRV
jne .next
mov ebx, [edx+SRV.entry]
mov edx, [edx+SRV.fd]
mov ebx, [edx + SRV.entry]
mov edx, [edx + SRV.fd]
test ebx, ebx
jz .next
@ -543,7 +543,7 @@ proc load_file_umode stdcall, file_name:dword
mov edx, [file_size] ;preallocate page memory
shr eax, 10
lea edi, [page_tabs+eax]
lea edi, [page_tabs + eax]
add edx, 4095
shr edx, 12
@@:
@ -648,7 +648,7 @@ proc get_proc_ex stdcall uses ebx esi, proc_name:dword, imports:dword
.look_up:
mov eax, [ebx+32]
mov eax, [OS_BASE+eax+esi*4]
mov eax, [OS_BASE + eax + esi*4]
add eax, OS_BASE
stdcall strncmp, eax, [proc_name], 256
test eax, eax
@ -662,7 +662,7 @@ proc get_proc_ex stdcall uses ebx esi, proc_name:dword, imports:dword
ret
.ok:
mov eax, [ebx+28]
mov eax, [OS_BASE+eax+esi*4]
mov eax, [OS_BASE + eax + esi*4]
add eax, OS_BASE
ret
endp
@ -677,10 +677,10 @@ proc fix_coff_symbols stdcall uses ebx esi, sec:dword, symbols:dword,\
mov edi, [symbols]
mov [retval], 1
.fix:
movzx ebx, [edi+COFF_SYM.SectionNumber]
movzx ebx, [edi + COFF_SYM.SectionNumber]
test ebx, ebx
jnz .internal
mov eax, dword [edi+COFF_SYM.Name]
mov eax, dword [edi + COFF_SYM.Name]
test eax, eax
jnz @F
@ -706,7 +706,7 @@ proc fix_coff_symbols stdcall uses ebx esi, sec:dword, symbols:dword,\
mov [retval], 0
@@:
mov edi, [symbols]
mov [edi+COFF_SYM.Value], eax
mov [edi + COFF_SYM.Value], eax
jmp .next
.internal:
cmp bx, -1
@ -716,11 +716,11 @@ proc fix_coff_symbols stdcall uses ebx esi, sec:dword, symbols:dword,\
dec ebx
shl ebx, 3
lea ebx, [ebx+ebx*4]
lea ebx, [ebx + ebx*4]
add ebx, [sec]
mov eax, [ebx+COFF_SECTION.VirtualAddress]
add [edi+COFF_SYM.Value], eax
mov eax, [ebx + COFF_SECTION.VirtualAddress]
add [edi + COFF_SYM.Value], eax
.next:
add edi, sizeof.COFF_SYM
mov [symbols], edi
@ -738,38 +738,38 @@ proc fix_coff_relocs stdcall uses ebx esi, coff:dword, sym:dword, \
endl
mov eax, [coff]
movzx ebx, [eax+COFF_HEADER.nSections]
movzx ebx, [eax + COFF_HEADER.nSections]
mov [n_sec], ebx
lea esi, [eax+20]
.fix_sec:
mov edi, [esi+COFF_SECTION.PtrReloc]
mov edi, [esi + COFF_SECTION.PtrReloc]
add edi, [coff]
movzx ecx, [esi+COFF_SECTION.NumReloc]
movzx ecx, [esi + COFF_SECTION.NumReloc]
test ecx, ecx
jz .next
.reloc_loop:
mov ebx, [edi+COFF_RELOC.SymIndex]
mov ebx, [edi + COFF_RELOC.SymIndex]
add ebx, ebx
lea ebx, [ebx+ebx*8]
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
cmp [edi+COFF_RELOC.Type], 20
cmp [edi + COFF_RELOC.Type], 20
jne .next_reloc
.rel_32:
mov eax, [edi+COFF_RELOC.VirtualAddress]
add eax, [esi+COFF_SECTION.VirtualAddress]
mov eax, [edi + COFF_RELOC.VirtualAddress]
add eax, [esi + COFF_SECTION.VirtualAddress]
sub edx, eax
sub edx, 4
jmp .fix
.dir_32:
mov eax, [edi+COFF_RELOC.VirtualAddress]
add eax, [esi+COFF_SECTION.VirtualAddress]
mov eax, [edi + COFF_RELOC.VirtualAddress]
add eax, [esi + COFF_SECTION.VirtualAddress]
.fix:
add eax, [delta]
add [eax], edx
@ -793,24 +793,24 @@ proc rebase_coff stdcall uses ebx esi, coff:dword, sym:dword, \
endl
mov eax, [coff]
movzx ebx, [eax+COFF_HEADER.nSections]
movzx ebx, [eax + COFF_HEADER.nSections]
mov [n_sec], ebx
lea esi, [eax+20]
mov edx, [delta]
.fix_sec:
mov edi, [esi+COFF_SECTION.PtrReloc]
mov edi, [esi + COFF_SECTION.PtrReloc]
add edi, [coff]
movzx ecx, [esi+COFF_SECTION.NumReloc]
movzx ecx, [esi + COFF_SECTION.NumReloc]
test ecx, ecx
jz .next
.reloc_loop:
cmp [edi+COFF_RELOC.Type], 6
cmp [edi + COFF_RELOC.Type], 6
jne .next_reloc
.dir_32:
mov eax, [edi+COFF_RELOC.VirtualAddress]
add eax, [esi+COFF_SECTION.VirtualAddress]
add [eax+edx], edx
mov eax, [edi + COFF_RELOC.VirtualAddress]
add eax, [esi + COFF_SECTION.VirtualAddress]
add [eax + edx], edx
.next_reloc:
add edi, 10
dec ecx
@ -831,7 +831,7 @@ coff_get_align:
; - if alignment is given and is no more than 4K, use it;
; - if alignment is more than 4K, revert to 4K.
push ecx
mov cl, byte [edx+COFF_SECTION.Characteristics+2]
mov cl, byte [edx + COFF_SECTION.Characteristics+2]
mov eax, 1
shr cl, 4
dec cl
@ -871,26 +871,26 @@ proc load_library stdcall, file_name:dword, encoding:dword
cli
mov esi, [current_process]
mov edi, [fullname]
mov ebx, [esi+PROC.dlls_list_ptr]
mov ebx, [esi + PROC.dlls_list_ptr]
test ebx, ebx
jz .not_in_process
mov esi, [ebx+HDLL.fd]
mov esi, [ebx + HDLL.fd]
.scan_in_process:
cmp esi, ebx
jz .not_in_process
mov eax, [esi+HDLL.parent]
mov eax, [esi + HDLL.parent]
add eax, DLLDESCR.name
stdcall strncmp, eax, edi, -1
test eax, eax
jnz .next_in_process
; simple variant: load DLL which is already loaded in this process
; just increment reference counters and return address of exports table
inc [esi+HDLL.refcount]
mov ecx, [esi+HDLL.parent]
inc [ecx+DLLDESCR.refcount]
mov eax, [ecx+DLLDESCR.exports]
sub eax, [ecx+DLLDESCR.defaultbase]
add eax, [esi+HDLL.base]
inc [esi + HDLL.refcount]
mov ecx, [esi + HDLL.parent]
inc [ecx + DLLDESCR.refcount]
mov eax, [ecx + DLLDESCR.exports]
sub eax, [ecx + DLLDESCR.defaultbase]
add eax, [esi + HDLL.base]
sti
push eax
stdcall kernel_free, [fullname]
@ -898,7 +898,7 @@ proc load_library stdcall, file_name:dword, encoding:dword
ret
.next_in_process:
mov esi, [esi+HDLL.fd]
mov esi, [esi + HDLL.fd]
jmp .scan_in_process
.not_in_process:
@ -913,19 +913,19 @@ proc load_library stdcall, file_name:dword, encoding:dword
.scan_for_dlls:
cmp esi, dll_list
jz .load_new
lea eax, [esi+DLLDESCR.name]
lea eax, [esi + DLLDESCR.name]
stdcall strncmp, eax, edi, -1
test eax, eax
jnz .continue_scan
.test_prev_dll:
mov eax, dword [fileinfo+24]; last modified time
mov edx, dword [fileinfo+28]; last modified date
cmp dword [esi+DLLDESCR.timestamp], eax
cmp dword [esi + DLLDESCR.timestamp], eax
jnz .continue_scan
cmp dword [esi+DLLDESCR.timestamp+4], edx
cmp dword [esi + DLLDESCR.timestamp+4], edx
jz .dll_already_loaded
.continue_scan:
mov esi, [esi+DLLDESCR.fd]
mov esi, [esi + DLLDESCR.fd]
jmp .scan_for_dlls
; new DLL
@ -944,24 +944,24 @@ proc load_library stdcall, file_name:dword, encoding:dword
xor eax, eax
repnz scasb
not ecx
lea eax, [ecx+sizeof.DLLDESCR]
lea eax, [ecx + sizeof.DLLDESCR]
push ecx
call malloc
pop ecx
test eax, eax
jz .fail_and_free_coff
; save timestamp
lea edi, [eax+DLLDESCR.name]
lea edi, [eax + DLLDESCR.name]
rep movsb
mov esi, eax
mov eax, dword [fileinfo+24]
mov dword [esi+DLLDESCR.timestamp], eax
mov dword [esi + DLLDESCR.timestamp], eax
mov eax, dword [fileinfo+28]
mov dword [esi+DLLDESCR.timestamp+4], eax
mov dword [esi + DLLDESCR.timestamp+4], eax
; calculate size of loaded DLL
mov edx, [coff]
movzx ecx, [edx+COFF_HEADER.nSections]
movzx ecx, [edx + COFF_HEADER.nSections]
xor ebx, ebx
add edx, 20
@ -970,12 +970,12 @@ proc load_library stdcall, file_name:dword, encoding:dword
add ebx, eax
not eax
and ebx, eax
add ebx, [edx+COFF_SECTION.SizeOfRawData]
add ebx, [edx + COFF_SECTION.SizeOfRawData]
add edx, sizeof.COFF_SECTION
dec ecx
jnz @B
; it must be nonzero and not too big
mov [esi+DLLDESCR.size], ebx
mov [esi + DLLDESCR.size], ebx
test ebx, ebx
jz .fail_and_free_dll
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
test eax, eax
jz .fail_and_free_dll
mov [esi+DLLDESCR.data], eax
mov [esi + DLLDESCR.data], eax
; calculate preferred base address
add ebx, 0x1FFF
and ebx, not 0xFFF
mov ecx, [dll_cur_addr]
lea edx, [ecx+ebx]
lea edx, [ecx + ebx]
cmp edx, MAX_DEFAULT_DLL_ADDR
jb @f
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
; copy sections and set correct values for VirtualAddress'es in headers
push esi
mov edx, [coff]
movzx ebx, [edx+COFF_HEADER.nSections]
movzx ebx, [edx + COFF_HEADER.nSections]
mov edi, eax
add edx, 20
cld
@ -1012,11 +1012,11 @@ proc load_library stdcall, file_name:dword, encoding:dword
not eax
and ecx, eax
and edi, eax
mov [edx+COFF_SECTION.VirtualAddress], ecx
add ecx, [edx+COFF_SECTION.SizeOfRawData]
mov esi, [edx+COFF_SECTION.PtrRawData]
mov [edx + COFF_SECTION.VirtualAddress], ecx
add ecx, [edx + COFF_SECTION.SizeOfRawData]
mov esi, [edx + COFF_SECTION.PtrRawData]
push ecx
mov ecx, [edx+COFF_SECTION.SizeOfRawData]
mov ecx, [edx + COFF_SECTION.SizeOfRawData]
test esi, esi
jnz .copy
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
; and also relocations table for all sections
mov edx, [coff]
mov ebx, [edx+COFF_HEADER.pSymTable]
mov ebx, [edx + COFF_HEADER.pSymTable]
mov edi, dword [fileinfo+32]
sub edi, ebx
jc .fail_and_free_data
mov [esi+DLLDESCR.symbols_lim], edi
mov [esi + DLLDESCR.symbols_lim], edi
add ebx, edx
movzx ecx, [edx+COFF_HEADER.nSections]
movzx ecx, [edx + COFF_HEADER.nSections]
lea ecx, [ecx*5]
lea edi, [edi+ecx*8+20]
lea edi, [edi + ecx*8+20]
add edx, 20
@@:
movzx eax, [edx+COFF_SECTION.NumReloc]
movzx eax, [edx + COFF_SECTION.NumReloc]
lea eax, [eax*5]
lea edi, [edi+eax*2]
lea edi, [edi + eax*2]
add edx, sizeof.COFF_SECTION
sub ecx, 5
jnz @b
@ -1057,33 +1057,33 @@ proc load_library stdcall, file_name:dword, encoding:dword
test eax, eax
jz .fail_and_free_data
mov edx, [coff]
movzx ecx, [edx+COFF_HEADER.nSections]
movzx ecx, [edx + COFF_HEADER.nSections]
lea ecx, [ecx*5]
lea ecx, [ecx*2+5]
mov [esi+DLLDESCR.coff_hdr], eax
mov [esi + DLLDESCR.coff_hdr], eax
push esi
mov esi, edx
mov edi, eax
rep movsd
pop esi
mov [esi+DLLDESCR.symbols_ptr], edi
mov [esi + DLLDESCR.symbols_ptr], edi
push esi
mov ecx, [edx+COFF_HEADER.nSymbols]
mov [esi+DLLDESCR.symbols_num], ecx
mov ecx, [esi+DLLDESCR.symbols_lim]
mov [esi + DLLDESCR.symbols_num], ecx
mov ecx, [esi + DLLDESCR.symbols_lim]
mov esi, ebx
rep movsb
pop esi
mov ebx, [esi+DLLDESCR.coff_hdr]
mov ebx, [esi + DLLDESCR.coff_hdr]
push esi
movzx eax, [edx+COFF_HEADER.nSections]
movzx eax, [edx + COFF_HEADER.nSections]
lea edx, [ebx+20]
@@:
movzx ecx, [edx+COFF_SECTION.NumReloc]
movzx ecx, [edx + COFF_SECTION.NumReloc]
lea ecx, [ecx*5]
mov esi, [edx+COFF_SECTION.PtrReloc]
mov [edx+COFF_SECTION.PtrReloc], edi
sub [edx+COFF_SECTION.PtrReloc], ebx
mov esi, [edx + COFF_SECTION.PtrReloc]
mov [edx + COFF_SECTION.PtrReloc], edi
sub [edx + COFF_SECTION.PtrReloc], ebx
add esi, [coff]
shr ecx, 1
rep movsd
@ -1096,53 +1096,53 @@ proc load_library stdcall, file_name:dword, encoding:dword
; fixup symbols
mov edx, ebx
mov eax, [ebx+COFF_HEADER.nSymbols]
mov eax, [ebx + COFF_HEADER.nSymbols]
add edx, 20
mov ecx, [esi+DLLDESCR.symbols_num]
mov ecx, [esi + DLLDESCR.symbols_num]
lea ecx, [ecx*9]
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
; test eax, eax
; 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
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
; it is first fix; usually this will be enough, but second fix
; can be necessary if real load address will not equal assumption
mov eax, [esi+DLLDESCR.data]
sub eax, [esi+DLLDESCR.defaultbase]
stdcall fix_coff_relocs, ebx, [esi+DLLDESCR.symbols_ptr], eax
mov eax, [esi + DLLDESCR.data]
sub eax, [esi + DLLDESCR.defaultbase]
stdcall fix_coff_relocs, ebx, [esi + DLLDESCR.symbols_ptr], eax
stdcall kernel_free, [coff]
cli
; initialize DLLDESCR struct
and dword [esi+DLLDESCR.refcount], 0; no HDLLs yet; later it will be incremented
mov [esi+DLLDESCR.fd], dll_list
and dword [esi + DLLDESCR.refcount], 0; no HDLLs yet; later it will be incremented
mov [esi + DLLDESCR.fd], dll_list
mov eax, [dll_list.bk]
mov [dll_list.bk], esi
mov [esi+DLLDESCR.bk], eax
mov [eax+DLLDESCR.fd], esi
mov [esi + DLLDESCR.bk], eax
mov [eax + DLLDESCR.fd], esi
.dll_already_loaded:
stdcall kernel_free, [fullname]
inc [esi+DLLDESCR.refcount]
inc [esi + DLLDESCR.refcount]
push esi
call init_heap
pop esi
mov edi, [esi+DLLDESCR.size]
stdcall user_alloc_at, [esi+DLLDESCR.defaultbase], edi
mov edi, [esi + DLLDESCR.size]
stdcall user_alloc_at, [esi + DLLDESCR.defaultbase], edi
test eax, eax
jnz @f
stdcall user_alloc, edi
@ -1157,36 +1157,36 @@ proc load_library stdcall, file_name:dword, encoding:dword
mov ebx, [current_slot_idx]
shl ebx, BSF sizeof.APPDATA
mov edx, [SLOT_BASE + ebx + APPDATA.tid]
mov [eax+HDLL.pid], edx
mov [eax + HDLL.pid], edx
push eax
call init_dlls_in_thread
pop ebx
test eax, eax
jz .fail_and_free_user
mov edx, [eax+HDLL.fd]
mov [ebx+HDLL.fd], edx
mov [ebx+HDLL.bk], eax
mov [eax+HDLL.fd], ebx
mov [edx+HDLL.bk], ebx
mov edx, [eax + HDLL.fd]
mov [ebx + HDLL.fd], edx
mov [ebx + HDLL.bk], eax
mov [eax + HDLL.fd], ebx
mov [edx + HDLL.bk], ebx
mov eax, ebx
mov ebx, [img_base]
mov [eax+HDLL.base], ebx
mov [eax+HDLL.size], edi
mov [eax+HDLL.refcount], 1
mov [eax+HDLL.parent], esi
mov [eax + HDLL.base], ebx
mov [eax + HDLL.size], edi
mov [eax + HDLL.refcount], 1
mov [eax + HDLL.parent], esi
mov edx, ebx
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
; use copy-on-write for user-mode image, so map as readonly
xor edi, edi
mov ecx, [esi+DLLDESCR.data]
mov ecx, [esi + DLLDESCR.data]
shr ecx, 12
.map_pages_loop:
mov eax, [page_tabs+ecx*4]
mov eax, [page_tabs + ecx*4]
and eax, not 0xFFF
or al, PG_UR
xchg eax, [page_tabs+edx*4]
xchg eax, [page_tabs + edx*4]
test al, 1
jz @f
call free_page
@ -1195,23 +1195,23 @@ proc load_library stdcall, file_name:dword, encoding:dword
inc ecx
inc edx
add edi, 0x1000
cmp edi, [esi+DLLDESCR.size]
cmp edi, [esi + DLLDESCR.size]
jb .map_pages_loop
; 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
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]
sub eax, [esi+DLLDESCR.defaultbase]
mov eax, [esi + DLLDESCR.exports]
sub eax, [esi + DLLDESCR.defaultbase]
add eax, [img_base]
sti
ret
.fail_and_free_data:
stdcall kernel_free, [esi+DLLDESCR.data]
stdcall kernel_free, [esi + DLLDESCR.data]
.fail_and_free_dll:
mov eax, esi
call free
@ -1239,7 +1239,7 @@ endp
; NULL if memory allocation failed
init_dlls_in_thread:
mov ebx, [current_process]
mov eax, [ebx+PROC.dlls_list_ptr]
mov eax, [ebx + PROC.dlls_list_ptr]
test eax, eax
jnz .ret
@ -1252,20 +1252,20 @@ init_dlls_in_thread:
mov [eax+4], eax
mov ebx, [current_process]
mov [ebx+PROC.dlls_list_ptr], eax
mov [ebx + PROC.dlls_list_ptr], eax
.ret:
ret
; in: eax = number of references to delete, esi -> DLLDESCR struc
dereference_dll:
sub [esi+DLLDESCR.refcount], eax
sub [esi + DLLDESCR.refcount], eax
jnz .ret
mov eax, [esi+DLLDESCR.fd]
mov edx, [esi+DLLDESCR.bk]
mov [eax+DLLDESCR.bk], edx
mov [edx+DLLDESCR.fd], eax
stdcall kernel_free, [esi+DLLDESCR.coff_hdr]
stdcall kernel_free, [esi+DLLDESCR.data]
mov eax, [esi + DLLDESCR.fd]
mov edx, [esi + DLLDESCR.bk]
mov [eax + DLLDESCR.bk], edx
mov [edx + DLLDESCR.fd], eax
stdcall kernel_free, [esi + DLLDESCR.coff_hdr]
stdcall kernel_free, [esi + DLLDESCR.data]
mov eax, esi
call free
.ret:
@ -1273,19 +1273,19 @@ dereference_dll:
destroy_hdll:
push ebx ecx esi edi
mov ebx, [eax+HDLL.base]
mov esi, [eax+HDLL.parent]
mov edx, [esi+DLLDESCR.size]
mov ebx, [eax + HDLL.base]
mov esi, [eax + HDLL.parent]
mov edx, [esi + DLLDESCR.size]
push eax
mov esi, [eax+HDLL.parent]
mov eax, [eax+HDLL.refcount]
mov esi, [eax + HDLL.parent]
mov eax, [eax + HDLL.refcount]
call dereference_dll
pop eax
mov edx, [eax+HDLL.bk]
mov ebx, [eax+HDLL.fd]
mov [ebx+HDLL.bk], edx
mov [edx+HDLL.fd], ebx
mov edx, [eax + HDLL.bk]
mov ebx, [eax + HDLL.fd]
mov [ebx + HDLL.bk], edx
mov [edx + HDLL.fd], ebx
call free
pop edi esi ecx ebx
ret
@ -1295,7 +1295,7 @@ destroy_all_hdlls:
test esi, esi
jz .ret
.loop:
mov eax, [esi+HDLL.fd]
mov eax, [esi + HDLL.fd]
cmp eax, esi
jz free
call destroy_hdll
@ -1321,13 +1321,13 @@ create_kernel_object:
pushfd
cli
mov edx, [ecx+APPOBJ.fd]
mov [eax+APPOBJ.fd], edx
mov [eax+APPOBJ.bk], ecx
mov [eax+APPOBJ.pid], ebx
mov edx, [ecx + APPOBJ.fd]
mov [eax + APPOBJ.fd], edx
mov [eax + APPOBJ.bk], ecx
mov [eax + APPOBJ.pid], ebx
mov [ecx+APPOBJ.fd], eax
mov [edx+APPOBJ.bk], eax
mov [ecx + APPOBJ.fd], eax
mov [edx + APPOBJ.bk], eax
popfd
.fail:
ret
@ -1340,10 +1340,10 @@ destroy_kernel_object:
pushfd
cli
mov ebx, [eax+APPOBJ.fd]
mov ecx, [eax+APPOBJ.bk]
mov [ebx+APPOBJ.bk], ecx
mov [ecx+APPOBJ.fd], ebx
mov ebx, [eax + APPOBJ.fd]
mov ecx, [eax + APPOBJ.bk]
mov [ebx + APPOBJ.bk], ecx
mov [ecx + APPOBJ.fd], ebx
popfd
xor edx, edx ;clear common header
@ -1370,14 +1370,14 @@ create_object:
cli
mov esi, [current_process]
mov eax, [esi+PROC.ht_free]
mov edi, [esi+PROC.ht_next]
mov eax, [esi + PROC.ht_free]
mov edi, [esi + PROC.ht_next]
dec eax
js .err0
mov [esi+PROC.ht_free], eax
mov eax, [esi+PROC.htab+edi*4]
mov [esi+PROC.ht_next], eax
mov [esi + PROC.ht_free], eax
mov eax, [esi + PROC.htab + edi*4]
mov [esi + PROC.ht_next], eax
popfd
mov eax, ecx
@ -1385,8 +1385,8 @@ create_object:
test eax, eax
jz .err1
mov [eax+FUTEX.handle], edi
mov [esi+PROC.htab+edi*4], eax
mov [eax + FUTEX.handle], edi
mov [esi + PROC.htab+edi*4], eax
pop edi
pop esi
ret
@ -1395,10 +1395,10 @@ create_object:
pushfd
cli
mov eax, [esi+PROC.ht_next]
mov [esi+PROC.htab+edi*4], eax
mov [esi+PROC.ht_next], edi
inc [esi+PROC.ht_free]
mov eax, [esi + PROC.ht_next]
mov [esi + PROC.htab+edi*4], eax
mov [esi + PROC.ht_next], edi
inc [esi + PROC.ht_free]
.err0:
popfd
pop edi
@ -1413,15 +1413,15 @@ align 4
destroy_object:
push esi
mov esi, [current_process]
mov edx, [ecx+FUTEX.handle]
mov edx, [ecx + FUTEX.handle]
pushfd
cli
mov eax, [esi+PROC.ht_next]
mov [esi+PROC.htab+edx*4], eax
mov [esi+PROC.ht_next], edx
inc [esi+PROC.ht_free]
mov eax, [esi + PROC.ht_next]
mov [esi + PROC.htab + edx*4], eax
mov [esi + PROC.ht_next], edx
inc [esi + PROC.ht_free]
popfd
pop esi

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -17,16 +17,16 @@ macro export dllname,[label,string]
forward
count = count+1
common
dd 0,0,0, (module-OS_BASE) , 1
dd count,count,(addresses-OS_BASE),(names-OS_BASE),(ordinal-OS_BASE)
dd 0,0,0, (module - OS_BASE) , 1
dd count,count,(addresses - OS_BASE),(names - OS_BASE),(ordinal - OS_BASE)
addresses:
forward
dd (label-OS_BASE)
dd (label - OS_BASE)
common
names:
forward
local name
dd (name-OS_BASE)
dd (name - OS_BASE)
common
ordinal:
count = 0

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -75,12 +75,12 @@ proc load_k_library stdcall, file_name:dword
jz .fail
mov [coff], eax
movzx ecx, [eax+CFH.nSections]
movzx ecx, [eax + CFH.nSections]
xor ebx, ebx
lea edx, [eax+20]
@@:
add ebx, [edx+CFS.SizeOfRawData]
add ebx, [edx + CFS.SizeOfRawData]
add ebx, 15
and ebx, not 15
add edx, COFF_SECTION_SIZE
@ -95,19 +95,19 @@ proc load_k_library stdcall, file_name:dword
mov [img_base], eax
mov edx, [coff]
movzx ebx, [edx+CFH.nSections]
movzx ebx, [edx + CFH.nSections]
mov edi, [img_base]
lea eax, [edx+20]
@@:
mov [eax+CFS.VirtualAddress], edi
mov esi, [eax+CFS.PtrRawData]
mov [eax + CFS.VirtualAddress], edi
mov esi, [eax + CFS.PtrRawData]
test esi, esi
jnz .copy
add edi, [eax+CFS.SizeOfRawData]
add edi, [eax + CFS.SizeOfRawData]
jmp .next
.copy:
add esi, edx
mov ecx, [eax+CFS.SizeOfRawData]
mov ecx, [eax + CFS.SizeOfRawData]
cld
rep movsb
.next:
@ -117,29 +117,29 @@ proc load_k_library stdcall, file_name:dword
dec ebx
jnz @B
mov ebx, [edx+CFH.pSymTable]
mov ebx, [edx + CFH.pSymTable]
add ebx, edx
mov [sym], ebx
mov ecx, [edx+CFH.nSymbols]
mov ecx, [edx + CFH.nSymbols]
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]
mov [strings], ecx
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
test eax, eax
jnz @F
@@:
mov edx, [coff]
movzx ebx, [edx+CFH.nSections]
movzx ebx, [edx + CFH.nSections]
mov edi, 0
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
dec ebx
jnz @B

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -177,14 +177,14 @@ fpu_save:
.save:
mov [fpu_owner], esi
shl ecx, 8
mov eax, [ecx+SLOT_BASE+APPDATA.fpu_state]
shl ecx, BSF sizeof.APPDATA
mov eax, [SLOT_BASE + ecx + APPDATA.fpu_state]
call save_context
; first 512 bytes of XSAVE area have the same format as FXSAVE
shl esi, 8
mov esi, [esi+SLOT_BASE+APPDATA.fpu_state]
shl esi, BSF sizeof.APPDATA
mov esi, [SLOT_BASE + esi + APPDATA.fpu_state]
mov ecx, 512/4
cld
rep movsd
@ -225,13 +225,13 @@ avx_save:
.save:
mov [fpu_owner], esi
shl ecx, 8
mov eax, [ecx+SLOT_BASE+APPDATA.fpu_state]
shl ecx, BSF sizeof.APPDATA
mov eax, [SLOT_BASE + ecx + APPDATA.fpu_state]
call save_context
shl esi, 8
mov esi, [esi+SLOT_BASE+APPDATA.fpu_state]
shl esi, BSF sizeof.APPDATA
mov esi, [SLOT_BASE + esi + APPDATA.fpu_state]
mov ecx, [xsave_area_size]
add ecx, 3
shr ecx, 2
@ -246,7 +246,7 @@ avx_save:
align 4
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
push eax edx
mov ecx, eax
@ -297,8 +297,8 @@ fpu_restore:
pop ecx
ret
.copy:
shl eax, 8
mov edi, [eax+SLOT_BASE+APPDATA.fpu_state]
shl eax, BSF sizeof.APPDATA
mov edi, [SLOT_BASE + eax + APPDATA.fpu_state]
mov ecx, 512/4
cld
rep movsd
@ -323,7 +323,7 @@ avx_restore:
jne .copy
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
push edx
mov eax, [xsave_eax]
@ -351,8 +351,8 @@ avx_restore:
pop ecx
ret
.copy:
shl eax, 8
mov edi, [eax+SLOT_BASE+APPDATA.fpu_state]
shl eax, BSF sizeof.APPDATA
mov edi, [SLOT_BASE + eax + APPDATA.fpu_state]
mov ecx, [xsave_area_size]
add ecx, 3
shr ecx, 2
@ -375,9 +375,9 @@ except_7: ;#NM exception handler
cmp ebx, [current_slot_idx]
je .exit
shl ebx, 8
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]
bt [cpu_caps+(CAPS_OSXSAVE/32)*4], CAPS_OSXSAVE mod 32
shl ebx, BSF sizeof.APPDATA
mov eax, [SLOT_BASE + ebx + APPDATA.fpu_state]
bt [cpu_caps + (CAPS_OSXSAVE/32)*4], CAPS_OSXSAVE mod 32
jnc .no_xsave
mov ecx, eax
mov eax, [xsave_eax]
@ -385,8 +385,8 @@ except_7: ;#NM exception handler
xsave [ecx]
mov ebx, [current_slot_idx]
mov [fpu_owner], ebx
shl ebx, 8
mov ecx, [ebx+SLOT_BASE+APPDATA.fpu_state]
shl ebx, BSF sizeof.APPDATA
mov ecx, [SLOT_BASE + ebx + APPDATA.fpu_state]
xrstor [ecx]
.exit:
restore_ring3_context
@ -398,8 +398,8 @@ except_7: ;#NM exception handler
fxsave [eax]
mov ebx, [current_slot_idx]
mov [fpu_owner], ebx
shl ebx, 8
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]
shl ebx, BSF sizeof.APPDATA
mov eax, [SLOT_BASE + ebx + APPDATA.fpu_state]
fxrstor [eax]
restore_ring3_context
iret
@ -408,8 +408,8 @@ except_7: ;#NM exception handler
fnsave [eax]
mov ebx, [current_slot_idx]
mov [fpu_owner], ebx
shl ebx, 8
mov eax, [ebx+SLOT_BASE+APPDATA.fpu_state]
shl ebx, BSF sizeof.APPDATA
mov eax, [SLOT_BASE + ebx + APPDATA.fpu_state]
frstor [eax]
restore_ring3_context
iret

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -171,11 +171,11 @@ proc init_kernel_heap
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
loop @B
mov dword[eax-sizeof.MEM_BLOCK], 0
mov dword[eax - sizeof.MEM_BLOCK], 0
mov ecx, heap_mutex
call mutex_init
@ -863,7 +863,7 @@ proc user_unmap stdcall, base:dword, offset:dword, size:dword
shr ebx, 12 ; chek block attributes
lea ebx, [page_tabs + ebx*4]
mov eax, [ebx-4] ; block attributes
mov eax, [ebx - 4] ; block attributes
test al, MEM_BLOCK_USED
jz .error
test al, MEM_BLOCK_DONT_FREE

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -38,7 +38,7 @@ init_hpet:
mov [hpet_timers], eax
mov ecx, eax
mov eax, [ebx+HPET_PERIOD]
mov eax, [ebx + HPET_PERIOD]
xor edx, edx
shld edx, eax, 10
shl eax, 10
@ -46,29 +46,29 @@ init_hpet:
div esi
mov [hpet_period], eax
mov esi, [ebx+HPET_CFG]
mov esi, [ebx + HPET_CFG]
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
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
add edx, 0x20
dec ecx
jmp @B
@@:
mov [ebx+HPET_COUNTER], ecx ;reset main counter
mov [ebx+HPET_COUNTER+4], ecx
mov [ebx + HPET_COUNTER], ecx ;reset main counter
mov [ebx + HPET_COUNTER + 4], ecx
or esi, HPET_CFG_ENABLE
mov [ebx+HPET_CFG], esi ;and start again
mov [ebx + HPET_CFG], esi ;and start again
.done:
rdtsc
mov [hpet_tsc_start], eax
mov [hpet_tsc_start+4], edx
mov [hpet_tsc_start + 4], edx
ret

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -20,7 +20,7 @@ irqh_tab rd sizeof.LHEAD * IRQ_RESERVED / 4
irqh_pool rd sizeof.IRQH * IRQ_POOL_SIZE /4
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
endg
@ -30,7 +30,7 @@ set_irq_active:
mov ecx, ebp
shr ecx, 5
and eax, 31
bts [irq_active_set+ecx*4], eax
bts [irq_active_set + ecx*4], eax
ret
reset_irq_active:
@ -38,7 +38,7 @@ reset_irq_active:
mov ecx, ebp
shr ecx, 5
and eax, 31
btr [irq_active_set+ecx*4], eax
btr [irq_active_set + ecx*4], eax
ret
align 4
@ -53,14 +53,14 @@ init_irqs:
loop @B
mov ecx, IRQ_POOL_SIZE-1
mov eax, irqh_pool+sizeof.IRQH
mov eax, irqh_pool + sizeof.IRQH
mov [next_irqh], irqh_pool
@@:
mov [eax-sizeof.IRQH], eax
mov [eax - sizeof.IRQH], eax
add eax, sizeof.IRQH
loop @B
mov [eax-sizeof.IRQH], dword 0
mov [eax - sizeof.IRQH], dword 0
ret
@ -99,14 +99,14 @@ proc attach_int_handler stdcall, irq:dword, handler:dword, user_data:dword
mov [next_irqh], eax
mov [.irqh], ecx
mov [irq_failed+ebx*4], 0;clear counter
mov [irq_failed + ebx*4], 0;clear counter
mov eax, [user_data]
mov [ecx+IRQH.handler], edx
mov [ecx+IRQH.data], eax
and [ecx+IRQH.num_ints], 0
mov [ecx + IRQH.handler], edx
mov [ecx + IRQH.data], eax
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
stdcall enable_irq, ebx
@ -167,15 +167,15 @@ align 16
mov ds, bx
mov es, bx
cmp [v86_irqhooks+ebp*8], 0
cmp [v86_irqhooks + ebp*8], 0
jnz v86_irq
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
.next:
mov ebx, [ebx+IRQH.list.next]; ebx= irqh pointer
mov ebx, [ebx + IRQH.list.next]; ebx= irqh pointer
cmp ebx, esi
je .done
@ -183,8 +183,8 @@ align 16
push edi
push esi
push [ebx+IRQH.data]
call [ebx+IRQH.handler]
push [ebx + IRQH.data]
call [ebx + IRQH.handler]
pop ecx
pop esi
@ -194,7 +194,7 @@ align 16
test eax, eax
jz .next
inc [ebx+IRQH.num_ints]
inc [ebx + IRQH.num_ints]
call reset_irq_active
jmp .next
@ -231,17 +231,17 @@ align 16
jz .try_next_irq
cmp ebp, 15
jz .try_next_irq
lea esi, [irqh_tab+ebp*8]
lea esi, [irqh_tab + ebp*8]
mov ebx, esi
.try_next_handler:
mov ebx, [ebx+IRQH.list.next]
mov ebx, [ebx + IRQH.list.next]
cmp ebx, esi
je .try_next_irq
cmp [ebx+IRQH.num_ints], 0
cmp [ebx + IRQH.num_ints], 0
jne .try_next_handler
; keyboard handler acknowledges everything
push [ebx+IRQH.data]
call [ebx+IRQH.handler]
push [ebx + IRQH.data]
call [ebx + IRQH.handler]
pop ecx
test eax, eax
jz .try_next_handler
@ -252,7 +252,7 @@ align 16
pop ebp
spin_lock_irqsave IrqsList
list_del ebx
lea edx, [irqh_tab+ebp*8]
lea edx, [irqh_tab + ebp*8]
list_add_tail ebx, edx
spin_unlock_irqrestore IrqsList
jmp .exit
@ -264,7 +264,7 @@ align 16
pop ebp
.fail:
inc [irq_failed+ebp*4]
inc [irq_failed + ebp*4]
.exit:
mov ecx, ebp

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -582,8 +582,8 @@ unlink_large_chunk:
je .done
mov ecx, [edx+28]
cmp edx, [mst.treebins+ecx*4]
lea ecx, [mst.treebins+ecx*4]
cmp edx, [mst.treebins + ecx*4]
lea ecx, [mst.treebins + ecx*4]
jne .l3
test eax, eax
@ -640,7 +640,7 @@ malloc_small:
push edi
bsf eax, [mst.treemap]
mov ecx, [mst.treebins+eax*4]
mov ecx, [mst.treebins + eax*4]
; rsize = (t->head & ~INUSE_BITS) - nb;
@ -690,7 +690,7 @@ malloc_small:
; unlink_large_chunk(v);
mov edx, ebx
lea esi, [ebx+ebp]
lea esi, [ebx + ebp]
call unlink_large_chunk
; if (rsize < 16)
@ -700,19 +700,19 @@ malloc_small:
; v->head = (rsize + nb)|PINUSE_BIT|CINUSE_BIT;
lea ecx, [edi+ebp]
lea ecx, [edi + ebp]
; (v+rsize + nb)->head |= PINUSE_BIT;
add edi, ebx
lea eax, [edi+ebp+4]
lea eax, [edi + ebp + 4]
pop edi
or ecx, 3
mov [ebx+4], ecx
mov [ebx + 4], ecx
or dword [eax], 1
pop ebp
lea eax, [ebx+8]
lea eax, [ebx + 8]
ret
.split:
@ -786,12 +786,12 @@ malloc_large:
lea ecx, [eax+7]
shr esi, cl
and esi, 1
lea ecx, [esi+eax*2]
lea ecx, [esi + eax*2]
mov [.idx], ecx
; if ((t = ms.treebins[idx]) != 0)
mov eax, [mst.treebins+ecx*4]
mov eax, [mst.treebins + ecx*4]
test eax, eax
jz .l3
@ -849,7 +849,7 @@ malloc_large:
; if (rt != 0 && rt != t)
test ecx, ecx
mov eax, [eax+esi*4+16]
mov eax, [eax + esi*4+16]
jz @F
cmp ecx, eax
jz @F
@ -893,7 +893,7 @@ malloc_large:
bsf eax, edx
; 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);
mov edx, ebp
lea esi, [ebx+ebp]
lea esi, [ebx + ebp]
call unlink_large_chunk
; if (rsize < 16)
@ -962,12 +962,12 @@ malloc_large:
; v->head = (rsize + nb)|PINUSE_BIT|CINUSE_BIT;
lea ecx, [edi+ebx]
lea ecx, [edi + ebx]
; (v+rsize + nb)->head |= PINUSE_BIT;
add edi, ebp
lea eax, [edi+ebx+4]
lea eax, [edi + ebx + 4]
or ecx, 3
mov [ebp+4], ecx
or dword [eax], 1
@ -1025,7 +1025,7 @@ init_malloc:
mov [eax+8], eax
mov [eax+12], eax
add eax, 16
cmp eax, mst.smallbins+512
cmp eax, mst.smallbins + 512
jb @B
mov ecx, mst.mutex

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -131,7 +131,7 @@ map_page:
and eax, [pte_valid_mask]
mov ebx, [esp+8] ; lin_addr
shr ebx, 12
mov [page_tabs+ebx*4], eax
mov [page_tabs + ebx*4], eax
mov eax, [esp+8] ; lin_addr
pop ebx
invlpg [eax]
@ -194,7 +194,7 @@ proc map_io_mem stdcall, base:dword, size:dword, flags:dword
or edx, [flags]
and edx, [pte_valid_mask]
@@:
mov [page_tabs+eax*4], edx
mov [page_tabs + eax*4], edx
invlpg [ebx]
inc eax
add ebx, edi
@ -232,7 +232,7 @@ commit_pages:
and eax, [pte_valid_mask ]
mov edi, ebx
shr edi, 12
lea edi, [page_tabs+edi*4]
lea edi, [page_tabs + edi*4]
@@:
stosd
invlpg [ebx]
@ -264,7 +264,7 @@ release_pages:
mov edi, eax
shr esi, 12
lea esi, [page_tabs+esi*4]
lea esi, [page_tabs + esi*4]
push ecx
mov ecx, pg_data.mutex
@ -342,7 +342,7 @@ proc map_page_table stdcall, lin_addr:dword, phis_addr:dword
mov eax, [phis_addr]
and eax, not 0xFFF
or eax, PG_UWR
mov dword [master_tab+ebx*4], eax
mov dword [master_tab + ebx*4], eax
mov eax, [lin_addr]
shr eax, 10
add eax, page_tabs
@ -394,7 +394,7 @@ proc create_trampoline_pgmap
mov esi, master_tab
mov ecx, 1024
rep movsd
mov ecx, [master_tab+(OS_BASE shr 20)]
mov ecx, [master_tab + (OS_BASE shr 20)]
mov [eax], ecx
mov edi, eax
call get_pg_addr
@ -412,9 +412,9 @@ proc new_mem_resize stdcall, new_size:dword
push edi
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
mov edi, [new_size]
@ -422,7 +422,7 @@ proc new_mem_resize stdcall, new_size:dword
and edi, not 4095
mov [new_size], edi
mov esi, [ebx+PROC.mem_used]
mov esi, [ebx + PROC.mem_used]
add esi, 4095
and esi, not 4095
@ -437,11 +437,11 @@ proc new_mem_resize stdcall, new_size:dword
mov ecx, pg_data.mutex
call mutex_lock
@@:
mov eax, [app_page_tabs+edi*4]
mov eax, [app_page_tabs + edi*4]
test eax, 1
jz .next
mov dword [app_page_tabs+edi*4], 0
mov dword [app_page_tabs + edi*4], 0
invlpg [ebx]
call free_page
@ -457,8 +457,8 @@ proc new_mem_resize stdcall, new_size:dword
.update_size:
mov edx, [current_slot]
mov ebx, [new_size]
mov edx, [edx+APPDATA.process]
mov [edx+PROC.mem_used], ebx
mov edx, [edx + APPDATA.process]
mov [edx + PROC.mem_used], ebx
.exit:
pop edi
pop esi
@ -546,7 +546,7 @@ get_pg_addr:
cmp eax, 0x400000
jb @f
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
ret
@ -589,12 +589,12 @@ proc page_fault_handler
shr ebx, 12
mov ecx, ebx
shr ecx, 10
mov edx, [master_tab+ecx*4]
mov edx, [master_tab + ecx*4]
test edx, PG_READ
jz .fail ;page table is not created
;incorrect address in program
mov eax, [page_tabs+ebx*4]
mov eax, [page_tabs + ebx*4]
test eax, 2
jz .fail ;address is not reserved for usage. Error
@ -621,19 +621,19 @@ proc page_fault_handler
; check list of HDLLs
and ebx, not 0xFFF
mov eax, [current_process]
mov eax, [eax+PROC.dlls_list_ptr]
mov eax, [eax + PROC.dlls_list_ptr]
test eax, eax
jz .fail
mov esi, [eax+HDLL.fd]
mov esi, [eax + HDLL.fd]
.scan_hdll:
cmp esi, eax
jz .fail
mov edx, ebx
sub edx, [esi+HDLL.base]
cmp edx, [esi+HDLL.size]
sub edx, [esi + HDLL.base]
cmp edx, [esi + HDLL.size]
jb .fault_in_hdll
.scan_hdll.next:
mov esi, [esi+HDLL.fd]
mov esi, [esi + HDLL.fd]
jmp .scan_hdll
.fault_in_hdll:
; 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
mov edi, ebx
mov ecx, 1024
sub ebx, [esi+HDLL.base]
mov esi, [esi+HDLL.parent]
mov esi, [esi+DLLDESCR.data]
sub ebx, [esi + HDLL.base]
mov esi, [esi + HDLL.parent]
mov esi, [esi + DLLDESCR.data]
add esi, ebx
rep movsd
jmp .exit
@ -687,7 +687,7 @@ proc page_fault_handler
shr ebx, 12
mov edx, [current_slot]
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]
mov ecx, 4096/4
@ -709,15 +709,15 @@ proc map_mem_ipc stdcall, lin_addr:dword,slot:dword,\
jz .exit
mov eax, [slot]
shl eax, 8
mov eax, [SLOT_BASE+eax+APPDATA.process]
shl eax, BSF sizeof.APPDATA
mov eax, [SLOT_BASE + eax + APPDATA.process]
test eax, eax
jz .exit
mov [process], eax
mov ebx, [ofs]
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]
and eax, 0xFFFFF000
jz .exit
@ -748,7 +748,7 @@ proc map_mem_ipc stdcall, lin_addr:dword,slot:dword,\
inc ebx
mov eax, [process]
mov eax, [eax+PROC.pdt_0+ebx*4]
mov eax, [eax + PROC.pdt_0 + ebx*4]
and eax, 0xFFFFF000
jz .exit
@ -772,15 +772,15 @@ proc map_memEx stdcall, lin_addr:dword,slot:dword,\
jz .exit
mov eax, [slot]
shl eax, 8
mov eax, [SLOT_BASE+eax+APPDATA.process]
shl eax, BSF sizeof.APPDATA
mov eax, [SLOT_BASE + eax + APPDATA.process]
test eax, eax
jz .exit
mov [process], eax
mov ebx, [ofs]
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]
and eax, 0xFFFFF000
jz .exit
@ -811,7 +811,7 @@ proc map_memEx stdcall, lin_addr:dword,slot:dword,\
inc ebx
mov eax, [process]
mov eax, [eax+PROC.pdt_0+ebx*4]
mov eax, [eax + PROC.pdt_0 + ebx*4]
and eax, 0xFFFFF000
jz .exit
@ -829,7 +829,7 @@ endp
; out: CF cleared <=> failed
; destroys: only eax
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
jz .not_present
test al, PG_WRITE
@ -851,7 +851,7 @@ proc safe_map_page stdcall, slot:dword, req_access:dword, ofs:dword
test eax, eax
jz .fail
or al, PG_UWR
mov [esi+edx*4], eax
mov [esi + edx*4], eax
jmp .map
.resolve_readonly:
; readonly page, probably copy-on-write
@ -864,21 +864,21 @@ proc safe_map_page stdcall, slot:dword, req_access:dword, ofs:dword
cld
push ebx ecx
mov eax, [slot]
shl eax, 8
mov eax, [SLOT_BASE+eax+APPDATA.process]
mov eax, [eax+PROC.dlls_list_ptr]
shl eax, BSF sizeof.APPDATA
mov eax, [SLOT_BASE + eax + APPDATA.process]
mov eax, [eax + PROC.dlls_list_ptr]
test eax, eax
jz .no_hdll
mov ecx, [eax+HDLL.fd]
mov ecx, [eax + HDLL.fd]
.scan_hdll:
cmp ecx, eax
jz .no_hdll
mov ebx, [ofs]
and ebx, not 0xFFF
sub ebx, [ecx+HDLL.base]
cmp ebx, [ecx+HDLL.size]
sub ebx, [ecx + HDLL.base]
cmp ebx, [ecx + HDLL.size]
jb .hdll_found
mov ecx, [ecx+HDLL.fd]
mov ecx, [ecx + HDLL.fd]
jmp .scan_hdll
.no_hdll:
pop ecx ebx
@ -887,13 +887,13 @@ proc safe_map_page stdcall, slot:dword, req_access:dword, ofs:dword
ret
.hdll_found:
; allocate page, save it in page table, map it, copy contents from base
mov eax, [ecx+HDLL.parent]
add ebx, [eax+DLLDESCR.data]
mov eax, [ecx + HDLL.parent]
add ebx, [eax + DLLDESCR.data]
call alloc_page
test eax, eax
jz .no_hdll
or al, PG_UWR
mov [esi+edx*4], eax
mov [esi + edx*4], eax
stdcall map_page, edi, eax, [req_access]
push esi edi
mov esi, ebx
@ -922,8 +922,8 @@ sys_IPC:
mov eax, [current_slot]
pushf
cli
mov [eax+APPDATA.ipc_start], ecx ;set fields in extended information area
mov [eax+APPDATA.ipc_size], edx
mov [eax + APPDATA.ipc_start], ecx ;set fields in extended information area
mov [eax + APPDATA.ipc_size], edx
add edx, ecx
add edx, 4095
@ -970,8 +970,8 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
jz .no_pid
mov [dst_slot], eax
shl eax, 8
mov edi, [eax+SLOT_BASE+APPDATA.ipc_start] ;is ipc area defined?
shl eax, BSF sizeof.APPDATA
mov edi, [SLOT_BASE + eax + APPDATA.ipc_start] ;is ipc area defined?
test edi, edi
jz .no_ipc_area
@ -979,7 +979,7 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
and ebx, 0xFFF
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 ecx, [ipc_tmp]
@ -1024,26 +1024,26 @@ proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
mov edx, ebx
shr ebx, 12
xor eax, eax
mov [page_tabs+ebx*4], eax
mov [page_tabs + ebx*4], eax
invlpg [edx]
mov ebx, [ipc_pdir]
mov edx, ebx
shr ebx, 12
xor eax, eax
mov [page_tabs+ebx*4], eax
mov [page_tabs + ebx*4], eax
invlpg [edx]
mov ebx, [ipc_ptab]
mov edx, ebx
shr ebx, 12
xor eax, eax
mov [page_tabs+ebx*4], eax
mov [page_tabs + ebx*4], eax
invlpg [edx]
mov eax, [dst_slot]
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
jmp .ret
.no_pid:
@ -1106,25 +1106,25 @@ f68:
cmp ebx, 31
ja undefined_syscall
xor eax, eax
jmp dword [f68call+ebx*4-11*4]
jmp dword [f68call + ebx*4-11*4]
.11:
call init_heap
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
.12:
stdcall user_alloc, ecx
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
.13:
stdcall user_free, ecx
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
.14:
cmp ecx, OS_BASE
jae .fail
mov edi, ecx
call get_event_ex
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
.16:
test ecx, ecx
@ -1132,11 +1132,11 @@ f68:
cmp ecx, OS_BASE
jae .fail
stdcall get_service, ecx
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
.17:
call srv_handlerEx ;ecx
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
.18:
mov eax, edx
@ -1144,13 +1144,13 @@ f68:
cmp ecx, OS_BASE
jae .fail
stdcall load_library, ecx, eax
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
.20:
mov eax, edx
mov ebx, ecx
call user_realloc ;in: eax = pointer, ebx = new size
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
.21:
cmp ecx, OS_BASE
@ -1158,48 +1158,48 @@ f68:
cmp edx, OS_BASE
jae .fail
stdcall load_pe_driver, ecx, edx
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
.22:
cmp ecx, OS_BASE
jae .fail
stdcall shmem_open, ecx, edx, esi
mov [esp+SYSCALL_STACK._edx], edx
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._edx], edx
mov [esp + SYSCALL_STACK._eax], eax
ret
.23:
cmp ecx, OS_BASE
jae .fail
stdcall shmem_close, ecx
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
.24:
mov eax, [current_slot]
xchg ecx, [eax+APPDATA.exc_handler]
xchg edx, [eax+APPDATA.except_mask]
mov [esp+SYSCALL_STACK._ebx], edx
mov [esp+SYSCALL_STACK._eax], ecx
xchg ecx, [eax + APPDATA.exc_handler]
xchg edx, [eax + APPDATA.except_mask]
mov [esp + SYSCALL_STACK._ebx], edx
mov [esp + SYSCALL_STACK._eax], ecx
ret
.25:
cmp ecx, 32
jae .fail
mov eax, [current_slot]
btr [eax+APPDATA.except_mask], ecx
setc byte[esp+SYSCALL_STACK._eax]
btr [eax + APPDATA.except_mask], ecx
setc byte[esp + SYSCALL_STACK._eax]
jecxz @f
bts [eax+APPDATA.except_mask], ecx
bts [eax + APPDATA.except_mask], ecx
@@:
ret
.26:
stdcall user_unmap, ecx, edx, esi
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
.27:
cmp ecx, OS_BASE
jae .fail
stdcall load_file_umode, ecx
mov [esp+SYSCALL_STACK._edx], edx
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._edx], edx
mov [esp + SYSCALL_STACK._eax], eax
ret
.28:
cmp ecx, OS_BASE
@ -1214,15 +1214,15 @@ f68:
test eax, eax
jz @f
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
ret
.29:
stdcall user_ring, ecx
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
; unload driver
@ -1237,7 +1237,7 @@ f68:
cmp [ecx+SRV.size], sizeof.SRV
jne .fail
mov eax, [ecx+SRV.entry]
mov eax, [ecx + SRV.entry]
test eax, eax
jz .fail
push ecx ;save handl
@ -1248,20 +1248,20 @@ f68:
lea esp, [esp+8]
push ecx
mov ebx, [ecx+SRV.base]
mov ebx, [ecx + SRV.base]
mov eax, -2 ;error free RAM
test ebx, ebx
jz .fail
stdcall kernel_free, ebx ;del driver
mov eax, [ecx+SRV.fd]
mov edx, [ecx+SRV.bk]
mov [edx+SRV.fd], eax
mov [eax+SRV.bk], edx
mov eax, [ecx + SRV.fd]
mov edx, [ecx + SRV.bk]
mov [edx + SRV.fd], eax
mov [eax + SRV.bk], edx
stdcall free, ecx
;dec [count_services]
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
.31: ; get list service
test ecx, ecx
@ -1271,9 +1271,9 @@ f68:
mov ebx, [srv.fd]
mov ecx, [srv.bk]
mov [esp+SYSCALL_STACK._ebx], ebx ;fd
mov [esp+SYSCALL_STACK._ecx], ecx ;bk
mov [esp+SYSCALL_STACK._eax], 0
mov [esp + SYSCALL_STACK._ebx], ebx ;fd
mov [esp + SYSCALL_STACK._ecx], ecx ;bk
mov [esp + SYSCALL_STACK._eax], 0
ret
@@:
dec ecx
@ -1284,9 +1284,9 @@ f68:
jbe .fail
stdcall is_region_userspace, edi, 40 ;16+4*6=40 <-max size buffer
jnz .fail ; edi = pointer on buffer
cmp [edx+SRV.magic], ' SRV'
cmp [edx + SRV.magic], ' SRV'
jne .fail
cmp [edx+SRV.size], sizeof.SRV
cmp [edx + SRV.size], sizeof.SRV
jne .fail
mov esi, edx
@ -1303,10 +1303,8 @@ f68:
;movsd ; SRV.srv_proc_ex
xor eax, eax
mov [esp+SYSCALL_STACK._eax], eax
ret
.fail:
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
align 4
@ -1353,8 +1351,8 @@ proc load_pe_driver stdcall, file:dword, cmdline:dword
test eax, eax
jz .fail_init
mov [eax+SRV.base], ebx
mov [eax+SRV.entry], esi
mov [eax + SRV.base], ebx
mov [eax + SRV.entry], esi
pop esi
ret
.fail_init:
@ -1403,8 +1401,8 @@ proc create_ring_buffer stdcall, size:dword, flags:dword
shl edx, 2
shr edi, 10
@@:
mov [page_tabs+edi], eax
mov [page_tabs+edi+edx], eax
mov [page_tabs + edi], eax
mov [page_tabs + edi + edx], eax
invlpg [ebx]
invlpg [ebx+0x10000]
add eax, 0x1000

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -122,7 +122,7 @@ proc mtrr_reconfigure
; 1. Prepare local variables.
; 1a. Create list of MAX_RANGES free (aka not yet allocated) ranges.
xor eax, eax
lea ecx, [eax+MAX_RANGES]
lea ecx, [eax + MAX_RANGES]
.init_ranges:
sub esp, sizeof.mtrr_range - 4
push eax
@ -262,14 +262,14 @@ end virtual
jz .found_place_wb
mov eax, ebx
mov edx, ebp
sub eax, dword [edi+mtrr_range.start]
sbb edx, dword [edi+mtrr_range.start+4]
sub eax, dword [edi + mtrr_range.start]
sbb edx, dword [edi + mtrr_range.start+4]
jb .found_place_wb
; Otherwise, if end of the next range is greater than or equal to ebp:ebx,
; exit the loop to 5e.
mov esi, edi
sub eax, dword [edi+mtrr_range.length]
sbb edx, dword [edi+mtrr_range.length+4]
sub eax, dword [edi + mtrr_range.length]
sbb edx, dword [edi + mtrr_range.length+4]
jb .expand_wb
or eax, edx
jnz .find_range_wb
@ -282,10 +282,10 @@ end virtual
test eax, eax
jz .abort
mov [esi], eax
mov edx, [eax+mtrr_range.next]
mov edx, [eax + mtrr_range.next]
mov [.first_free_range], edx
mov dword [eax+mtrr_range.start], ebx
mov dword [eax+mtrr_range.start+4], ebp
mov dword [eax + mtrr_range.start], ebx
mov dword [eax + mtrr_range.start+4], ebp
; Don't fill [eax+mtrr_range.next] and [eax+mtrr_range.length] yet,
; they will be calculated including merges at step 5e.
mov esi, edi
@ -306,21 +306,21 @@ end virtual
jz .expand_wb_done
mov eax, ebx
mov edx, ebp
sub eax, dword [esi+mtrr_range.start]
sbb edx, dword [esi+mtrr_range.start+4]
sub eax, dword [esi + mtrr_range.start]
sbb edx, dword [esi + mtrr_range.start+4]
jb .expand_wb_done
; Otherwise, if end of the next range is greater than or equal to ebp:ebx,
; exit the loop to 5f.
sub eax, dword [esi+mtrr_range.length]
sbb edx, dword [esi+mtrr_range.length+4]
sub eax, dword [esi + mtrr_range.length]
sbb edx, dword [esi + mtrr_range.length+4]
jb .expand_wb_last
; Otherwise, the current range is completely within the new range.
; Free it and continue the loop.
mov edx, [esi+mtrr_range.next]
mov edx, [esi + mtrr_range.next]
cmp esi, edi
jz @f
mov eax, [.first_free_range]
mov [esi+mtrr_range.next], eax
mov [esi + mtrr_range.next], eax
mov [.first_free_range], esi
@@:
mov esi, edx
@ -334,13 +334,13 @@ end virtual
jz .next_wb_range
; Otherwise, set end of interval at esi to end of interval at edi
; and free range described by edi.
mov ebx, dword [esi+mtrr_range.start]
mov ebp, dword [esi+mtrr_range.start+4]
add ebx, dword [esi+mtrr_range.length]
adc ebp, dword [esi+mtrr_range.length+4]
mov edx, [esi+mtrr_range.next]
mov ebx, dword [esi + mtrr_range.start]
mov ebp, dword [esi + mtrr_range.start+4]
add ebx, dword [esi + mtrr_range.length]
adc ebp, dword [esi + mtrr_range.length+4]
mov edx, [esi + mtrr_range.next]
mov eax, [.first_free_range]
mov [esi+mtrr_range.next], eax
mov [esi + mtrr_range.next], eax
mov [.first_free_range], esi
mov esi, edx
.expand_wb_done:
@ -348,11 +348,11 @@ end virtual
; the new end of range (maybe ebp:ebx from the new range
; or end of another existing interval calculated at step 5f).
; Write them to range at edi.
mov [edi+mtrr_range.next], esi
sub ebx, dword [edi+mtrr_range.start]
sbb ebp, dword [edi+mtrr_range.start+4]
mov dword [edi+mtrr_range.length], ebx
mov dword [edi+mtrr_range.length+4], ebp
mov [edi + mtrr_range.next], esi
sub ebx, dword [edi + mtrr_range.start]
sbb ebp, dword [edi + mtrr_range.start+4]
mov dword [edi + mtrr_range.length], ebx
mov dword [edi + mtrr_range.length+4], ebp
.next_wb_range:
; 5h. Continue the loop 5b-5g over all configured MTRRs.
add ecx, 16
@ -379,16 +379,16 @@ end virtual
jz .next_uc_range
; If start of the next range is greater than or equal to ebp:ebx,
; exit the loop to 6e.
mov eax, dword [edi+mtrr_range.start]
mov edx, dword [edi+mtrr_range.start+4]
mov eax, dword [edi + mtrr_range.start]
mov edx, dword [edi + mtrr_range.start+4]
sub eax, ebx
sbb edx, ebp
jnb .truncate_uc
; Otherwise, continue the loop if end of the next range is less than ebp:ebx,
; exit the loop to 6d otherwise.
mov esi, edi
add eax, dword [edi+mtrr_range.length]
adc edx, dword [edi+mtrr_range.length+4]
add eax, dword [edi + mtrr_range.length]
adc edx, dword [edi + mtrr_range.length+4]
jnb .find_range_uc
; 6d. ebp:ebx is inside (or at end of) an existing range.
; Split the range. (The second range, maybe containing completely within UC-range,
@ -396,21 +396,21 @@ end virtual
mov edi, [.first_free_range]
test edi, edi
jz .abort
mov dword [edi+mtrr_range.start], ebx
mov dword [edi+mtrr_range.start+4], ebp
mov dword [edi+mtrr_range.length], eax
mov dword [edi+mtrr_range.length+4], edx
mov eax, [edi+mtrr_range.next]
mov dword [edi + mtrr_range.start], ebx
mov dword [edi + mtrr_range.start+4], ebp
mov dword [edi + mtrr_range.length], eax
mov dword [edi + mtrr_range.length+4], edx
mov eax, [edi + mtrr_range.next]
mov [.first_free_range], eax
mov eax, [esi+mtrr_range.next]
mov [edi+mtrr_range.next], eax
mov eax, [esi + mtrr_range.next]
mov [edi + mtrr_range.next], eax
; don't change [esi+mtrr_range.next] yet, it will be filled at step 6e
mov eax, ebx
mov edx, ebp
sub eax, dword [esi+mtrr_range.start]
sbb edx, dword [esi+mtrr_range.start+4]
mov dword [esi+mtrr_range.length], eax
mov dword [esi+mtrr_range.length+4], edx
sub eax, dword [esi + mtrr_range.start]
sbb edx, dword [esi + mtrr_range.start+4]
mov dword [esi + mtrr_range.length], eax
mov dword [esi + mtrr_range.length+4], edx
.truncate_uc:
; 6e. edi is the first range after ebp:ebx, check it and next ranges
; for intersection with the new range, truncate heads.
@ -422,21 +422,21 @@ end virtual
; exit the loop to 6g.
mov eax, ebx
mov edx, ebp
sub eax, dword [edi+mtrr_range.start]
sbb edx, dword [edi+mtrr_range.start+4]
sub eax, dword [edi + mtrr_range.start]
sbb edx, dword [edi + mtrr_range.start+4]
jb .truncate_uc_done
; Otherwise, if end of the next range is greater than ebp:ebx,
; exit the loop to 6f.
sub eax, dword [edi+mtrr_range.length]
sbb edx, dword [edi+mtrr_range.length+4]
sub eax, dword [edi + mtrr_range.length]
sbb edx, dword [edi + mtrr_range.length+4]
jb .truncate_uc_last
; Otherwise, the current range is completely within the new range.
; Free it and continue the loop if there is a next range.
; 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 [.first_free_range], edi
mov [edi+mtrr_range.next], eax
mov [edi + mtrr_range.next], eax
mov edi, edx
test edi, edi
jnz .truncate_uc_loop
@ -444,17 +444,17 @@ end virtual
.truncate_uc_last:
; 6f. The range at edi partially intersects with the UC-range described by MTRR.
; Truncate it from the head.
mov dword [edi+mtrr_range.start], ebx
mov dword [edi+mtrr_range.start+4], ebp
mov dword [edi + mtrr_range.start], ebx
mov dword [edi + mtrr_range.start+4], ebp
neg eax
adc edx, 0
neg edx
mov dword [edi+mtrr_range.length], eax
mov dword [edi+mtrr_range.length+4], edx
mov dword [edi + mtrr_range.length], eax
mov dword [edi + mtrr_range.length+4], edx
.truncate_uc_done:
; 6g. We have found the next range (maybe 0) after intersection.
; Write it to [esi+mtrr_range.next].
mov [esi+mtrr_range.next], edi
mov [esi + mtrr_range.next], edi
.next_uc_range:
; 6h. Continue the loop 6b-6g over all configured MTRRs.
add ecx, 16
@ -468,16 +468,16 @@ end virtual
; 7. BIOS has not configured variable-range MTRRs.
; Create one range from 0 to [MEM_AMOUNT].
mov eax, [.first_free_range]
mov edx, [eax+mtrr_range.next]
mov edx, [eax + mtrr_range.next]
mov [.first_free_range], edx
mov [.first_range], eax
xor edx, edx
mov [eax+mtrr_range.next], edx
mov dword [eax+mtrr_range.start], edx
mov dword [eax+mtrr_range.start+4], edx
mov [eax + mtrr_range.next], edx
mov dword [eax + mtrr_range.start], edx
mov dword [eax + mtrr_range.start+4], edx
mov ecx, [MEM_AMOUNT]
mov dword [eax+mtrr_range.length], ecx
mov dword [eax+mtrr_range.length+4], edx
mov dword [eax + mtrr_range.length], ecx
mov dword [eax + mtrr_range.length+4], edx
.ranges_ok:
; 8. We have calculated list of WB-ranges.
; Now we should calculate a list of MTRRs so that
@ -497,20 +497,20 @@ end virtual
; append them to end of range.
xor eax, eax
mov edi, [.first_range]
cmp dword [edi+mtrr_range.start], eax
cmp dword [edi + mtrr_range.start], eax
jnz .abort
cmp dword [edi+mtrr_range.start+4], eax
cmp dword [edi + mtrr_range.start+4], eax
jnz .abort
cmp dword [edi+mtrr_range.length+4], eax
cmp dword [edi + mtrr_range.length+4], eax
jnz .abort
mov edx, [edi+mtrr_range.next]
mov edx, [edi + mtrr_range.next]
test edx, edx
jz @f
cmp dword [edx+mtrr_range.start], eax
cmp dword [edx + mtrr_range.start], eax
jnz .abort
cmp dword [edx+mtrr_range.start+4], 1
cmp dword [edx + mtrr_range.start+4], 1
jnz .abort
cmp [edx+mtrr_range.next], eax
cmp [edx + mtrr_range.next], eax
jnz .abort
@@:
; 8b. Initialize: no MTRRs filled.
@ -522,10 +522,10 @@ end virtual
; reset start to 2*start and return to this step.
; Example: [4G,24G) -> [4G,8G) {returning} + [8G,16G) {returning}
; + [16G,24G) {advancing to ?}.
mov eax, dword [edi+mtrr_range.length+4]
mov eax, dword [edi + mtrr_range.length+4]
test eax, eax
jz .less4G
mov edx, dword [edi+mtrr_range.start+4]
mov edx, dword [edi + mtrr_range.start+4]
cmp eax, edx
jb .start_aligned
inc [.num_used_mtrrs]
@ -536,10 +536,10 @@ end virtual
mov dword [esi+8], 0
mov dword [esi+12], edx
add esi, 16
add dword [edi+mtrr_range.start+4], edx
sub dword [edi+mtrr_range.length+4], edx
add dword [edi + mtrr_range.start+4], edx
sub dword [edi + mtrr_range.length+4], edx
jnz .range2mtrr_loop
cmp dword [edi+mtrr_range.length], 0
cmp dword [edi + mtrr_range.length], 0
jz .range2mtrr_next
.less4G:
; 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
; [0,0x100000000)-(another range to be splitted); we forbid the last variant,
; so the first variant must be used.
bsr ecx, dword [edi+mtrr_range.length]
bsr ecx, dword [edi + mtrr_range.length]
xor edx, edx
inc edx
shl edx, cl
lea eax, [edx*2]
add eax, dword [edi+mtrr_range.start]
add eax, dword [edi + mtrr_range.start]
jnz .start_aligned
inc [.num_used_mtrrs]
cmp [.num_used_mtrrs], MAX_USEFUL_MTRRS
ja .abort
mov eax, dword [edi+mtrr_range.start]
mov eax, dword [edi + mtrr_range.start]
mov dword [esi], eax
or dword [esi], MEM_WB
mov dword [esi+4], 0
mov dword [esi+8], edx
mov dword [esi+12], 0
add esi, 16
add dword [edi+mtrr_range.start], edx
sub dword [edi+mtrr_range.length], edx
add dword [edi + mtrr_range.start], edx
sub dword [edi + mtrr_range.length], edx
jnz .less4G
jmp .range2mtrr_next
.start_aligned:
@ -594,9 +594,9 @@ end virtual
xor eax, eax
xor ebx, ebx
xor ecx, ecx
bsf edx, dword [edi+mtrr_range.length]
bsf edx, dword [edi + mtrr_range.length]
jnz @f
bsf edx, dword [edi+mtrr_range.length+4]
bsf edx, dword [edi + mtrr_range.length+4]
add edx, 32
@@:
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
; Note: bt conveniently works with both .length and .length+4,
; depending on whether edx>=32.
bt dword [edi+mtrr_range.length], edx
bt dword [edi + mtrr_range.length], edx
jc .calc_stat
dec eax ; hope was wrong, decrement difference to correct 'inc'
dec eax ; and again, now getting the real difference
@ -625,20 +625,20 @@ end virtual
inc edx
cmp edx, ecx
ja .fill_hi_init
btc dword [edi+mtrr_range.length], edx
btc dword [edi + mtrr_range.length], edx
jmp @b
.fill_hi_init:
; 8g. Create MTRR ranges corresponding to upper 32 bits.
sub ecx, 32
.fill_hi_loop:
bsr edx, dword [edi+mtrr_range.length+4]
bsr edx, dword [edi + mtrr_range.length+4]
jz .fill_hi_done
inc [.num_used_mtrrs]
cmp [.num_used_mtrrs], MAX_USEFUL_MTRRS
ja .abort
mov eax, dword [edi+mtrr_range.start]
mov eax, dword [edi + mtrr_range.start]
mov [esi], eax
mov eax, dword [edi+mtrr_range.start+4]
mov eax, dword [edi + mtrr_range.start+4]
mov [esi+4], eax
xor eax, eax
mov [esi+8], eax
@ -647,14 +647,14 @@ end virtual
cmp edx, ecx
jl .fill_hi_uc
or dword [esi], MEM_WB
add dword [edi+mtrr_range.start+4], eax
add dword [edi + mtrr_range.start+4], eax
jmp @f
.fill_hi_uc:
sub dword [esi+4], eax
sub dword [edi+mtrr_range.start+4], eax
sub dword [edi + mtrr_range.start+4], eax
@@:
add esi, 16
sub dword [edi+mtrr_range.length], eax
sub dword [edi + mtrr_range.length], eax
jmp .fill_hi_loop
.fill_hi_done:
; 8h. Create MTRR ranges corresponding to lower 32 bits.
@ -665,9 +665,9 @@ end virtual
inc [.num_used_mtrrs]
cmp [.num_used_mtrrs], MAX_USEFUL_MTRRS
ja .abort
mov eax, dword [edi+mtrr_range.start]
mov eax, dword [edi + mtrr_range.start]
mov [esi], eax
mov eax, dword [edi+mtrr_range.start+4]
mov eax, dword [edi + mtrr_range.start+4]
mov [esi+4], eax
xor eax, eax
mov [esi+12], eax
@ -676,18 +676,18 @@ end virtual
cmp edx, ecx
jl .fill_lo_uc
or dword [esi], MEM_WB
add dword [edi+mtrr_range.start], eax
add dword [edi + mtrr_range.start], eax
jmp @f
.fill_lo_uc:
sub dword [esi], eax
sub dword [edi+mtrr_range.start], eax
sub dword [edi + mtrr_range.start], eax
@@:
add esi, 16
sub dword [edi+mtrr_range.length], eax
sub dword [edi + mtrr_range.length], eax
jmp .fill_lo_loop
.range2mtrr_next:
; 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
jnz .range2mtrr_loop
; 9. We have calculated needed MTRRs, now setup them in the CPU.
@ -897,7 +897,7 @@ proc mtrr_validate
dec eax
; LFB is mapped to virtual address LFB_BASE,
; 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
jnz @f
mov ebx, [page_tabs+(LFB_BASE shr 10)]
@ -917,9 +917,9 @@ proc mtrr_validate
mov eax, [pcidev_list.fd]
cmp eax, pcidev_list ; sanity check: fail if no PCI devices
jz .fail
cmp [eax+PCIDEV.vendor_device_id], 0x12378086
cmp [eax + PCIDEV.vendor_device_id], 0x12378086
jz .exit
cmp [eax+PCIDEV.vendor_device_id], 0x01228086
cmp [eax + PCIDEV.vendor_device_id], 0x01228086
jnz .fail
.exit:
ret

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -27,14 +27,14 @@ proc load_PE stdcall, file_name:dword
mov [image], eax
mov edx, [eax+STRIPPED_PE_HEADER.SizeOfImage]
; mov cl, [eax+STRIPPED_PE_HEADER.Subsystem]
mov edx, [eax + STRIPPED_PE_HEADER.SizeOfImage]
; mov cl, [eax + STRIPPED_PE_HEADER.Subsystem]
cmp word [eax], STRIPPED_PE_SIGNATURE
jz @f
mov edx, [eax+60]
; mov cl, [eax+5Ch+edx]
mov edx, [eax+80+edx]
mov edx, [eax + 60]
; mov cl, [eax + 5Ch + edx]
mov edx, [eax + 80 + edx]
@@:
mov [entry], 0
@ -91,50 +91,50 @@ end virtual
jz .stripped
mov edx, ebx
add edx, [ebx+60]
movzx eax, word [edx+6]
add edx, [ebx + 60]
movzx eax, word [edx + 6]
mov [.numsections], eax
mov eax, [edx+40]
mov eax, [edx + 40]
mov [.AddressOfEntryPoint], eax
mov eax, [edx+52]
mov eax, [edx + 52]
mov [.ImageBase], eax
mov ecx, [edx+84]
mov ecx, [edx + 84]
mov [.section_header_size], 40
mov eax, [edx+128]
mov eax, [edx + 128]
mov [.import_descr], eax
mov eax, [edx+160]
mov eax, [edx + 160]
mov [.relocs_rva], eax
mov eax, [edx+164]
mov eax, [edx + 164]
mov [.relocs_size], eax
add edx, 256
jmp .common
.stripped:
mov eax, [ebx+STRIPPED_PE_HEADER.AddressOfEntryPoint]
mov eax, [ebx + STRIPPED_PE_HEADER.AddressOfEntryPoint]
mov [.AddressOfEntryPoint], eax
mov eax, [ebx+STRIPPED_PE_HEADER.ImageBase]
mov eax, [ebx + STRIPPED_PE_HEADER.ImageBase]
mov [.ImageBase], eax
movzx eax, [ebx+STRIPPED_PE_HEADER.NumberOfSections]
movzx eax, [ebx + STRIPPED_PE_HEADER.NumberOfSections]
mov [.numsections], eax
movzx ecx, [ebx+STRIPPED_PE_HEADER.NumberOfRvaAndSizes]
movzx ecx, [ebx + STRIPPED_PE_HEADER.NumberOfRvaAndSizes]
xor eax, eax
mov [.relocs_rva], eax
mov [.relocs_size], eax
test ecx, ecx
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
cmp ecx, SPE_DIRECTORY_BASERELOC
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 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 [.section_header_size], 28
lea edx, [ebx+ecx*8+sizeof.STRIPPED_PE_HEADER+8]
mov ecx, [ebx+STRIPPED_PE_HEADER.SizeOfHeaders]
lea edx, [ebx + ecx*8 + sizeof.STRIPPED_PE_HEADER + 8]
mov ecx, [ebx + STRIPPED_PE_HEADER.SizeOfHeaders]
.common:
mov esi, ebx
@ -145,14 +145,14 @@ end virtual
cmp [.numsections], 0
jz .nosections
.copy_sections:
mov eax, [edx+8]
mov eax, [edx + 8]
test eax, eax
je .no_section_data
mov esi, ebx
mov edi, ebp
add esi, [edx+12]
add esi, [edx + 12]
mov ecx, eax
add edi, [edx+4]
add edi, [edx + 4]
add ecx, 3
shr ecx, 2
@ -163,7 +163,7 @@ end virtual
cmp ecx, eax
jbe .no_section_fill
sub ecx, eax
add eax, [edx+4]
add eax, [edx + 4]
lea edi, [eax+ebp]
xor eax, eax
@ -183,7 +183,7 @@ end virtual
.relocs_block:
mov edi, [ecx]
add edi, ebp
mov ebx, [ecx+4]
mov ebx, [ecx + 4]
add ecx, 8
sub [.relocs_size], ebx
sub ebx, 8
@ -211,13 +211,13 @@ end virtual
mov [.bad_import], 0
.import_block:
mov ecx, [.import_descr]
cmp dword [ecx+4], 0
cmp dword [ecx + 4], 0
jne @f
cmp dword [ecx+12], 0
cmp dword [ecx + 12], 0
je .done_imports
@@:
mov edx, dword [ecx]
mov ecx, dword [ecx+16]
mov ecx, dword [ecx + 16]
test edx, edx
jnz @f
mov edx, ecx
@ -230,18 +230,18 @@ end virtual
.import_func:
mov esi, [.import_idx]
mov edi, [.import_names]
mov eax, [edi+esi*4]
mov eax, [edi + esi*4]
test eax, eax
je .next_import_block
js .next_import_block
lea edi, [ebp+eax]
lea edi, [ebp + eax]
mov eax, [.import_targets]
mov dword [eax+esi*4], 0
lea esi, [edi+2]
mov dword [eax + esi*4], 0
lea esi, [edi + 2]
movzx ebx, word [edi]
push 32
mov ecx, [__exports+32]
mov eax, [ecx+OS_BASE+ebx*4]
mov ecx, [__exports + 32]
mov eax, [ecx + OS_BASE + ebx*4]
add eax, OS_BASE
push eax
push esi
@ -251,8 +251,8 @@ end virtual
xor ebx, ebx
.import_func_candidate:
push 32
mov ecx, [__exports+32]
mov eax, [ecx+OS_BASE+ebx*4]
mov ecx, [__exports + 32]
mov eax, [ecx + OS_BASE + ebx*4]
add eax, OS_BASE
push eax
push esi
@ -260,12 +260,12 @@ end virtual
test eax, eax
je .import_func_found
inc ebx
cmp ebx, [__exports+24]
cmp ebx, [__exports + 24]
jb .import_func_candidate
mov esi, msg_unresolved
call sys_msg_board_str
lea esi, [edi+2]
lea esi, [edi + 2]
call sys_msg_board_str
mov esi, msg_CR
call sys_msg_board_str
@ -273,12 +273,12 @@ end virtual
mov [.bad_import], 1
jmp .next_import_func
.import_func_found:
mov esi, [__exports+28]
mov esi, [__exports + 28]
mov edx, [.import_idx]
mov ecx, [.import_targets]
mov eax, [esi+OS_BASE+ebx*4]
mov eax, [esi + OS_BASE + ebx*4]
add eax, OS_BASE
mov [ecx+edx*4], eax
mov [ecx + edx*4], eax
.next_import_func:
inc [.import_idx]
jmp .import_func

View File

@ -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 ;;
;; Distributed under terms of the GNU General Public License ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -73,8 +73,8 @@ update_counters:
rdtsc
;sub eax, [edi+TASKDATA.counter_add] ; time stamp counter add
;add [edi+TASKDATA.counter_sum], eax ; counter sum
sub eax, [esi-sizeof.APPDATA+APPDATA.counter_add] ; time stamp counter add
add [esi-sizeof.APPDATA+APPDATA.counter_sum], eax ; counter sum
sub eax, [esi - sizeof.APPDATA + APPDATA.counter_add] ; time stamp counter add
add [esi - sizeof.APPDATA + APPDATA.counter_sum], eax ; counter sum
ret
align 4
updatecputimes:
@ -85,9 +85,9 @@ updatecputimes:
xor eax, eax
;xchg eax, [edi+TASKDATA.counter_sum]
;mov [edi+TASKDATA.cpu_usage], eax
xchg eax, [esi+APPDATA.counter_sum]
xchg eax, [esi + APPDATA.counter_sum]
;add edi, 0x20
mov [esi+APPDATA.cpu_usage], eax
mov [esi + APPDATA.cpu_usage], eax
add esi, sizeof.APPDATA
loop .newupdate
ret
@ -100,38 +100,38 @@ do_change_task:
;param:
; ebx = address of the APPDATA for incoming task (new)
;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)
;scratched: eax,ecx,esi
mov esi, ebx
xchg esi, [current_slot]
; set new stack after saving old
mov [esi+APPDATA.saved_esp], esp
mov esp, [ebx+APPDATA.saved_esp]
mov [esi + APPDATA.saved_esp], esp
mov esp, [ebx + APPDATA.saved_esp]
; set new thread io-map
mov eax, [ebx+APPDATA.io_map]
mov dword [page_tabs+((tss._io_map_0 and -4096) shr 10)], eax
mov eax, [ebx+APPDATA.io_map+4]
mov dword [page_tabs+((tss._io_map_1 and -4096) shr 10)], eax
mov eax, [ebx + APPDATA.io_map]
mov dword [page_tabs + ((tss._io_map_0 and -4096) shr 10)], eax
mov eax, [ebx + APPDATA.io_map+4]
mov dword [page_tabs + ((tss._io_map_1 and -4096) shr 10)], eax
; set new thread memory-map
mov eax, [ebx+APPDATA.process]
mov eax, [ebx + APPDATA.process]
cmp eax, [current_process]
je @f
mov [current_process], eax
mov eax, [eax+PROC.pdt_0_phys]
mov eax, [eax + PROC.pdt_0_phys]
mov cr3, eax
@@:
; set tss.esp0
mov eax, [ebx+APPDATA.saved_esp0]
mov eax, [ebx + APPDATA.saved_esp0]
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
mov [tls_data_l+4], dl
mov [tls_data_l+7], dh
mov [tls_data_l + 4], dl
mov [tls_data_l + 7], dh
mov dx, app_tls
mov fs, dx
@ -141,16 +141,16 @@ do_change_task:
Mov gs, ax
; TS flag is not triggered by AVX* instructions, therefore
; 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
mov ecx, [esi+APPDATA.fpu_state]
mov ecx, [esi + APPDATA.fpu_state]
mov eax, [xsave_eax]
mov edx, [xsave_edx]
xsave [ecx]
mov ecx, [current_slot_idx]
mov [fpu_owner], ecx
mov ecx, [current_slot]
mov ecx, [ecx+APPDATA.fpu_state]
mov ecx, [ecx + APPDATA.fpu_state]
xrstor [ecx]
.no_xsave:
; set CR0.TS
@ -163,11 +163,11 @@ do_change_task:
@@: ; set context_counter (only for user pleasure ???)
inc [context_counter] ;noname & halyavin
; set debug-registers, if it's necessary
test byte[ebx+APPDATA.dbg_state], 1
test byte[ebx + APPDATA.dbg_state], 1
jz @f
xor eax, eax
mov dr6, eax
lea esi, [ebx+APPDATA.dbg_regs]
lea esi, [ebx + APPDATA.dbg_regs]
cld
macro lodsReg [reg] {
lodsd
@ -199,26 +199,26 @@ proc scheduler_add_thread
; 1. Acquire the lock.
spin_lock_irqsave SchedulerLock
; 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.
; In first case, go to 6. Otherwise, advance to 4.
mov eax, [scheduler_current+ecx*4]
test eax, eax
jz .new_list
; 4. Insert the new item immediately before the current item.
mov ecx, [eax+APPDATA.in_schedule.prev]
mov [edx+APPDATA.in_schedule.next], eax
mov [edx+APPDATA.in_schedule.prev], ecx
mov [eax+APPDATA.in_schedule.prev], edx
mov [ecx+APPDATA.in_schedule.next], edx
mov ecx, [eax + APPDATA.in_schedule.prev]
mov [edx + APPDATA.in_schedule.next], eax
mov [edx + APPDATA.in_schedule.prev], ecx
mov [eax + APPDATA.in_schedule.prev], edx
mov [ecx + APPDATA.in_schedule.next], edx
; 5. Release the lock and return.
spin_unlock_irqrestore SchedulerLock
ret
.new_list:
; 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.prev], edx
mov [scheduler_current+ecx*4], edx
mov [edx + APPDATA.in_schedule.next], edx
mov [edx + APPDATA.in_schedule.prev], edx
mov [scheduler_current + ecx*4], edx
; 7. Release the lock and return.
spin_unlock_irqrestore SchedulerLock
ret
@ -230,23 +230,23 @@ proc scheduler_remove_thread
; 1. Acquire the lock.
spin_lock_irqsave SchedulerLock
; 2. Remove the item from the corresponding list.
mov eax, [edx+APPDATA.in_schedule.next]
mov ecx, [edx+APPDATA.in_schedule.prev]
mov [eax+APPDATA.in_schedule.prev], ecx
mov [ecx+APPDATA.in_schedule.next], eax
mov eax, [edx + APPDATA.in_schedule.next]
mov ecx, [edx + APPDATA.in_schedule.prev]
mov [eax + APPDATA.in_schedule.prev], ecx
mov [ecx + APPDATA.in_schedule.next], eax
; 3. If the given thread is the current item in the list,
; advance the current item.
; 3a. Check whether the given thread is the current item;
; if no, skip the rest of this step.
mov ecx, [edx+APPDATA.priority]
cmp [scheduler_current+ecx*4], edx
mov ecx, [edx + APPDATA.priority]
cmp [scheduler_current + ecx*4], edx
jnz .return
; 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.
cmp eax, edx
jnz .return
mov [scheduler_current+ecx*4], 0
mov [scheduler_current + ecx*4], 0
.return:
; 4. Release the lock and return.
spin_unlock_irqrestore SchedulerLock
@ -280,7 +280,7 @@ proc find_next_task
test bl, bl
jz .start
mov ebx, [current_slot]
mov eax, [ebx+APPDATA.priority]
mov eax, [ebx + APPDATA.priority]
test eax, eax
jz .unlock_found
mov [esp], eax
@ -291,28 +291,28 @@ proc find_next_task
test ebx, ebx
jz .priority_next
.task_loop:
mov ebx, [ebx+APPDATA.in_schedule.next]
mov al, [ebx+APPDATA.state]
mov ebx, [ebx + APPDATA.in_schedule.next]
mov al, [ebx + APPDATA.state]
test al, al
jz .task_found ; state == 0
cmp al, 5
jne .task_next ; state == 1,2,3,4,9
; state == 5
pushad ; more freedom for [APPDATA.wait_test]
call [ebx+APPDATA.wait_test]
mov [esp+28], eax
call [ebx + APPDATA.wait_test]
mov [esp + 28], eax
popad
or eax, eax
jnz @f
; testing for timeout
mov eax, [timer_ticks]
sub eax, [ebx+APPDATA.wait_begin]
cmp eax, [ebx+APPDATA.wait_timeout]
sub eax, [ebx + APPDATA.wait_begin]
cmp eax, [ebx + APPDATA.wait_timeout]
jb .task_next
xor eax, eax
@@:
mov [ebx+APPDATA.wait_param], eax ; retval for wait
mov [ebx+APPDATA.state], TSTATE_RUNNING
mov [ebx + APPDATA.wait_param], eax ; retval for wait
mov [ebx + APPDATA.state], TSTATE_RUNNING
.task_found:
mov [scheduler_current+ecx*4], ebx
; If we have selected a thread with higher priority
@ -323,8 +323,8 @@ proc find_next_task
cmp ecx, NR_SCHED_QUEUES
jz .unlock_found
mov eax, [current_slot]
mov eax, [eax+APPDATA.in_schedule.prev]
mov [scheduler_current+ecx*4], eax
mov eax, [eax + APPDATA.in_schedule.prev]
mov [scheduler_current + ecx*4], eax
.unlock_found:
pop ecx
spin_unlock_irqrestore SchedulerLock
@ -334,7 +334,7 @@ proc find_next_task
mov byte [current_slot_idx], bh
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
cmp ebx, [current_slot]
ret

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; Author: Kees J. Bot 1 Jan 1994 ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; ;;
;; Synhronization for MenuetOS. ;;
@ -18,9 +18,9 @@ RWSEM_WAITING_FOR_READ = 1
align 4
mutex_init:
mov [ecx+MUTEX.wait_list.next], ecx
mov [ecx+MUTEX.wait_list.prev], ecx
mov [ecx+MUTEX.count], 1
mov [ecx + MUTEX.wait_list.next], ecx
mov [ecx + MUTEX.wait_list.prev], ecx
mov [ecx + MUTEX.count], 1
ret
;void __fastcall mutex_lock(struct mutex *lock)
@ -28,7 +28,7 @@ mutex_init:
align 4
mutex_lock:
dec [ecx+MUTEX.count]
dec [ecx + MUTEX.count]
jns .done
pushfd
@ -39,12 +39,12 @@ mutex_lock:
list_add_tail esp, ecx ;esp= new waiter, ecx= list head
mov edx, [current_slot]
mov [esp+MUTEX_WAITER.task], edx
mov [esp + MUTEX_WAITER.task], edx
.forever:
mov eax, -1
xchg eax, [ecx+MUTEX.count]
xchg eax, [ecx + MUTEX.count]
dec eax
jz @F
@ -55,10 +55,10 @@ mutex_lock:
mov eax, ecx
list_del esp
cmp [eax+MUTEX.wait_list.next], eax
cmp [eax + MUTEX.wait_list.next], eax
jne @F
mov [eax+MUTEX.count], 0
mov [eax + MUTEX.count], 0
@@:
add esp, sizeof.MUTEX_WAITER
@ -74,12 +74,12 @@ mutex_unlock:
pushfd
cli
mov eax, [ecx+MUTEX.wait_list.next]
mov eax, [ecx + MUTEX.wait_list.next]
cmp eax, ecx
mov [ecx+MUTEX.count], 1
mov [ecx + MUTEX.count], 1
je @F
mov eax, [eax+MUTEX_WAITER.task]
mov eax, [eax + MUTEX_WAITER.task]
mov [eax + APPDATA.state], TSTATE_RUNNING
@@:
popfd
@ -90,9 +90,9 @@ mutex_unlock:
align 4
init_rwsem:
mov [ecx+RWSEM.wait_list.next], ecx
mov [ecx+RWSEM.wait_list.prev], ecx
mov [ecx+RWSEM.count], 0
mov [ecx + RWSEM.wait_list.next], ecx
mov [ecx + RWSEM.wait_list.prev], ecx
mov [ecx + RWSEM.count], 0
ret
;void __fastcall down_read(struct rw_semaphore *sem)
@ -102,18 +102,18 @@ down_read:
pushfd
cli
mov eax, [ecx+RWSEM.count]
mov eax, [ecx + RWSEM.count]
test eax, eax
js @F
cmp ecx, [ecx+RWSEM.wait_list.next]
cmp ecx, [ecx + RWSEM.wait_list.next]
je .ok
@@:
sub esp, sizeof.MUTEX_WAITER
mov eax, [current_slot]
mov [esp+MUTEX_WAITER.task], eax
mov [esp+MUTEX_WAITER.type], RWSEM_WAITING_FOR_READ
mov [esp + MUTEX_WAITER.task], eax
mov [esp + MUTEX_WAITER.type], RWSEM_WAITING_FOR_READ
mov [eax + APPDATA.state], TSTATE_RUN_SUSPENDED
list_add_tail esp, ecx ;esp= new waiter, ecx= list head
@ -125,7 +125,7 @@ down_read:
ret
.ok:
inc eax
mov [ecx+RWSEM.count], eax
mov [ecx + RWSEM.count], eax
popfd
ret
@ -139,8 +139,8 @@ down_write:
sub esp, sizeof.MUTEX_WAITER
mov edx, [current_slot]
mov [esp+MUTEX_WAITER.task], edx
mov [esp+MUTEX_WAITER.type], RWSEM_WAITING_FOR_WRITE
mov [esp + MUTEX_WAITER.task], edx
mov [esp + MUTEX_WAITER.type], RWSEM_WAITING_FOR_WRITE
mov [edx + APPDATA.state], TSTATE_RUN_SUSPENDED
list_add_tail esp, ecx ;esp= new waiter, ecx= list head
@ -149,14 +149,14 @@ down_write:
not eax
.forever:
test eax, [ecx+RWSEM.count]
test eax, [ecx + RWSEM.count]
jz @F
mov [edx + APPDATA.state], TSTATE_RUN_SUSPENDED
call change_task
jmp .forever
@@:
mov [ecx+RWSEM.count], eax
mov [ecx + RWSEM.count], eax
list_del esp
add esp, sizeof.MUTEX_WAITER
@ -170,14 +170,14 @@ up_read:
pushfd
cli
dec [ecx+RWSEM.count]
dec [ecx + RWSEM.count]
jnz @F
mov eax, [ecx+RWSEM.wait_list.next]
mov eax, [ecx + RWSEM.wait_list.next]
cmp eax, ecx
je @F
mov eax, [eax+MUTEX_WAITER.task]
mov eax, [eax + MUTEX_WAITER.task]
mov [eax + APPDATA.state], TSTATE_RUNNING
@@:
popfd
@ -191,17 +191,17 @@ up_write:
pushfd
cli
mov eax, [ecx+RWSEM.wait_list.next]
mov [ecx+RWSEM.count], 0
mov eax, [ecx + RWSEM.wait_list.next]
mov [ecx + RWSEM.count], 0
cmp ecx, eax
je .done
mov edx, [eax+MUTEX_WAITER.type]
mov edx, [eax + MUTEX_WAITER.type]
test edx, edx
jnz .wake
mov eax, [eax+MUTEX_WAITER.task]
mov eax, [eax + MUTEX_WAITER.task]
mov [eax + APPDATA.state], TSTATE_RUNNING
.done:
popfd
@ -217,15 +217,15 @@ up_write:
.wake_list:
mov ebx, [eax+MUTEX_WAITER.list.next]
mov ebx, [eax + MUTEX_WAITER.list.next]
list_del eax
mov edx, [eax+MUTEX_WAITER.task]
mov edx, [eax + MUTEX_WAITER.task]
mov [edx + APPDATA.state], TSTATE_RUNNING
inc esi
cmp edi, ebx
je .wake_done
mov ecx, [ebx+MUTEX_WAITER.type]
mov ecx, [ebx + MUTEX_WAITER.type]
test ecx, ecx
jz .wake_done
@ -233,7 +233,7 @@ up_write:
jmp .wake_list
.wake_done:
add [edi+RWSEM.count], esi
add [edi + RWSEM.count], esi
pop edi
pop esi
@ -270,8 +270,8 @@ start_wait=$
jmp start_wait
ok=$
push eax
mov eax, dword [TASK_BASE+second_base_address]
mov eax, [eax+TASKDATA.pid]
mov eax, dword [current_slot]
mov eax, [eax + APPDATA.tid]
mov [name], eax
pop eax
sti
@ -304,8 +304,8 @@ macro WaitSimpleCriticalSection name
{
local start_wait,first_wait,inc_counter,end_wait
push eax
mov eax, [TASK_BASE+second_base_address]
mov eax, [eax+TASKDATA.pid]
mov eax, [current_slot]
mov eax, [eax + APPDATA.tid]
start_wait=$
cli
cmp [name], dword 0
@ -317,10 +317,10 @@ start_wait=$
jmp start_wait
first_wait=$
mov [name], eax
mov [name+4], dword 1
mov [name + 4], dword 1
jmp end_wait
inc_counter=$
inc dword [name+4]
inc dword [name + 4]
end_wait=$
sti
pop eax
@ -328,7 +328,7 @@ end_wait=$
macro ReleaseSimpleCriticalSection name
{
local release_end
dec dword [name+4]
dec dword [name + 4]
jnz release_end
mov [name], dword 0
release_end=$
@ -336,8 +336,8 @@ release_end=$
macro TryWaitSimpleCriticalSection name ;result in eax and in flags
{
local ok,try_end
mov eax, [CURRENT_TASK+second_base_address]
mov eax, [eax+TASKDATA.pid]
mov eax, [current_slot]
mov eax, [eax + APPDATA.tid]
cmp [name], eax
jz ok
cmp [name], 0

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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. ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -139,14 +139,14 @@ exc_c: ; exceptions (all but 7th - #NM)
call page_fault_handler ; SEE: core/memory.inc
@@:
mov esi, [current_slot]
btr [esi+APPDATA.except_mask], ebx
btr [esi + APPDATA.except_mask], ebx
jnc @f
mov eax, [esi+APPDATA.exc_handler]
mov eax, [esi + APPDATA.exc_handler]
test eax, eax
jnz IRetToUserHook
@@:
cli
mov eax, [esi+APPDATA.debugger_slot]
mov eax, [esi + APPDATA.debugger_slot]
test eax, eax
jnz .debug
; not debuggee => say error and terminate
@ -288,27 +288,6 @@ show_error_parameters:
test eax, eax
jnz .error_ESP
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
ret
.error_ESP:
@ -322,12 +301,12 @@ show_error_parameters:
shr ebx, 12
mov ecx, ebx
shr ecx, 10
mov edx, [master_tab+ecx*4]
mov edx, [master_tab + ecx*4]
test edx, PG_READ
jz .fail ; page table is not created
; incorrect address in the program
mov eax, [page_tabs+ebx*4]
mov eax, [page_tabs + ebx*4]
test eax, 2
jz .fail ; address not reserved for use. error
@ -434,7 +413,7 @@ destroy_thread:
push esi ;save .slot
shl esi, BSF sizeof.APPDATA
mov edx, [SLOT_BASE+esi+APPDATA.process]
mov edx, [SLOT_BASE + esi + APPDATA.process]
test edx, edx
jnz @F
mov [SLOT_BASE + esi + APPDATA.state], TSTATE_FREE
@ -442,33 +421,33 @@ destroy_thread:
ret
@@:
push edx ;save .process
lea edx, [SLOT_BASE+esi]
lea edx, [SLOT_BASE + esi]
call scheduler_remove_thread
call lock_application_table
; if the process is in V86 mode...
mov eax, [.slot]
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
cmp [eax+SLOT_BASE+APPDATA.saved_esp0], esi
cmp [SLOT_BASE + eax + APPDATA.saved_esp0], esi
jz .nov86
; ...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 [eax+SLOT_BASE+APPDATA.process], ecx
mov [SLOT_BASE + eax + APPDATA.process], ecx
; ...and I/O permission map for V86 mode
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 [eax+SLOT_BASE+APPDATA.io_map+4], ecx
mov [SLOT_BASE + eax + APPDATA.io_map+4], ecx
.nov86:
; destroy per-thread kernel objects
mov esi, [.slot]
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
jz @F
@ -476,7 +455,7 @@ destroy_thread:
je @F
push esi
call [eax+APPOBJ.destroy]
call [eax + APPOBJ.destroy]
DEBUGF 1,"%s",msg_obj_destroy
pop esi
jmp @B
@ -486,7 +465,7 @@ destroy_thread:
jne @F
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
bt [cpu_caps], CAPS_SSE
jnc .no_SSE
@ -575,13 +554,13 @@ destroy_thread:
cld
shl esi, BSF sizeof.WDATA
add esi, window_data
mov eax, [esi+WDATA.box.left]
mov eax, [esi + WDATA.box.left]
mov [draw_limits.left], eax
add eax, [esi+WDATA.box.width]
add eax, [esi + WDATA.box.width]
mov [draw_limits.right], eax
mov eax, [esi+WDATA.box.top]
mov eax, [esi + WDATA.box.top]
mov [draw_limits.top], eax
add eax, [esi+WDATA.box.height]
add eax, [esi + WDATA.box.height]
mov [draw_limits.bottom], eax
xor eax, eax
@ -589,7 +568,7 @@ destroy_thread:
mov ecx, sizeof.WDATA/4
rep stosd
lea edi, [esi-window_data+draw_data]
lea edi, [esi - window_data + draw_data]
mov ecx, sizeof.WDATA/4
rep stosd
popa
@ -613,20 +592,20 @@ destroy_thread:
mov ebx, [.slot]
shl ebx, BSF sizeof.APPDATA
push ebx
mov ebx, [SLOT_BASE+ebx+APPDATA.pl0_stack]
mov ebx, [SLOT_BASE + ebx + APPDATA.pl0_stack]
stdcall kernel_free, ebx
pop ebx
mov ebx, [SLOT_BASE+ebx+APPDATA.cur_dir]
mov ebx, [SLOT_BASE + ebx + APPDATA.cur_dir]
stdcall kernel_free, ebx
mov edi, [.slot]
shl edi, BSF sizeof.APPDATA
add edi, SLOT_BASE
mov eax, [edi+APPDATA.io_map]
cmp eax, [SLOT_BASE+sizeof.APPDATA+APPDATA.io_map]
mov eax, [edi + APPDATA.io_map]
cmp eax, [SLOT_BASE + sizeof.APPDATA+APPDATA.io_map]
je @F
call free_page
@@:
@ -635,7 +614,7 @@ destroy_thread:
je @F
call free_page
@@:
lea ebx, [edi+APPDATA.list]
lea ebx, [edi + APPDATA.list]
list_del ebx ;destroys edx, ecx
mov eax, 0x20202020
@ -655,7 +634,7 @@ destroy_thread:
dec eax
cmp eax, 1
jbe .nothing_to_activate
lea esi, [WIN_POS+eax*2]
lea esi, [WIN_POS + eax*2]
movzx edi, word [esi] ; edi = process
shl edi, BSF sizeof.APPDATA
cmp [SLOT_BASE + edi + APPDATA.state], TSTATE_FREE ; skip free slots
@ -674,7 +653,7 @@ destroy_thread:
push esi ; remove hd1 & cd & flp reservation
shl esi, BSF sizeof.APPDATA
mov esi, [esi + SLOT_BASE + APPDATA.tid]
mov esi, [SLOT_BASE + esi + APPDATA.tid]
cmp [cd_status], esi
jnz @f
call free_cd_channel
@ -690,7 +669,7 @@ destroy_thread:
pusha ; remove all port reservations
mov edx, esi
shl edx, BSF sizeof.APPDATA
mov edx, [edx + SLOT_BASE + APPDATA.tid]
mov edx, [SLOT_BASE + edx + APPDATA.tid]
rmpr0:
@ -733,10 +712,10 @@ destroy_thread:
popa
mov edi, esi ; do not run this process slot
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
mov eax, 2
mov ecx, SLOT_BASE+2*sizeof.APPDATA + APPDATA.debugger_slot
mov ecx, SLOT_BASE + 2*sizeof.APPDATA + APPDATA.debugger_slot
.xd0:
cmp eax, [thread_count]
ja .xd1
@ -758,8 +737,8 @@ destroy_thread:
bts [thr_slot_map], esi
mov ecx, [.process]
lea eax, [ecx+PROC.thr_list]
cmp eax, [eax+LHEAD.next]
lea eax, [ecx + PROC.thr_list]
cmp eax, [eax + LHEAD.next]
jne @F
call destroy_process.internal
@ -812,7 +791,7 @@ proc protect_from_terminate
mov edx, [current_slot]
; Atomically increment depth of critical areas and get the old value.
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,
; so we are destructing and cannot do anything protected.
; Otherwise, return to the caller.
@ -829,7 +808,7 @@ endp
proc unprotect_from_terminate
mov edx, [current_slot]
; 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,
; but at that moment we were inside a critical area; terminate now.
jz sys_end
@ -843,10 +822,10 @@ proc request_terminate
xor eax, eax ; set return value
; Atomically clear the upper bit. If it was already zero, then
; 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
; 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
; critical area; leave termination to leaving that area.
jnz .unsafe

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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. ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -127,8 +127,8 @@ proc fs_execute
jz .err_0
mov [slot], eax
shl eax, 8
lea edi, [SLOT_BASE+eax]
shl eax, BSF sizeof.APPDATA
lea edi, [SLOT_BASE + eax]
mov [slot_base], edi
; clean extended information about process
mov ecx, sizeof.APPDATA/4
@ -169,26 +169,26 @@ proc fs_execute
jz .err_hdr
; add new process to the list
mov ebx, [sys_proc+LHEAD.prev]
mov ebx, [sys_proc + LHEAD.prev]
__list_add eax, ebx, sys_proc
; fill the structure fields:
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
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
lea edx, [ebx+APPDATA.list]
lea ecx, [eax+PROC.thr_list]
lea edx, [ebx + APPDATA.list]
lea ecx, [eax + PROC.thr_list]
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
mov eax, [cmdline_size]
add eax, sizeof.APP_HDR
stdcall kernel_alloc, eax
mov [ebx+APPDATA.exec_params], eax
mov [ebx + APPDATA.exec_params], eax
mov edi, eax
lea esi, [hdr_cmdline]
mov ecx, sizeof.APP_HDR/4
@ -231,17 +231,17 @@ test_app_header:
jne .check_01_header
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 [ebx+APP_HDR._emem], edx
mov [ebx + APP_HDR._emem], edx
shr edx, 1
sub edx, 0x10
mov [ebx+APP_HDR.esp], edx
mov [ebx + APP_HDR.esp], edx
mov ecx, [APP_HEADER_00.i_param]
mov [ebx+APP_HDR.cmdline], ecx
mov [ebx+APP_HDR.path], 0
mov [ebx + APP_HDR.cmdline], ecx
mov [ebx + APP_HDR.path], 0
mov edx, [APP_HEADER_00.i_end]
mov [ebx+APP_HDR._edata], edx
mov [ebx + APP_HDR._edata], edx
ret
.check_01_header:
@ -252,7 +252,7 @@ test_app_header:
jne .fail
@@:
mov ecx, [APP_HEADER_01.start]
mov [ebx+0x08], ecx
mov [ebx + 0x08], ecx
mov edx, [APP_HEADER_01.mem_size]
; \begin{diamond}[20.08.2006]
@ -262,15 +262,15 @@ test_app_header:
jb .fail
; \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 [ebx+APP_HDR.esp], ecx
mov [ebx + APP_HDR.esp], ecx
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 [ebx+APP_HDR.path], ecx
mov [ebx + APP_HDR.path], ecx
mov edx, [APP_HEADER_01.i_end]
mov [ebx+APP_HDR._edata], edx
mov [ebx + APP_HDR._edata], edx
ret
.fail:
xor eax, eax
@ -294,7 +294,7 @@ alloc_thread_slot:
bsf eax, [edx]
jnz .found
add edx, 4
cmp edx, thr_slot_map+32
cmp edx, thr_slot_map + 32
jb .l1
popfd
@ -303,7 +303,7 @@ alloc_thread_slot:
.found:
btr [edx], eax
sub edx, thr_slot_map
lea eax, [eax+edx*8]
lea eax, [eax + edx*8]
popfd
ret
@ -331,8 +331,8 @@ proc create_process stdcall, app_size:dword
jz .fail
mov [process], eax
lea edi, [eax+PROC.heap_lock]
mov ecx, (PROC.ht_free-PROC.heap_lock)/4
lea edi, [eax + PROC.heap_lock]
mov ecx, (PROC.ht_free - PROC.heap_lock)/4
list_init eax
add eax, PROC.thr_list
@ -355,19 +355,19 @@ proc create_process stdcall, app_size:dword
mov eax, edi
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
xor eax, eax
rep stosd
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
mov eax, [edi-8192+PROC.pdt_0_phys]
mov eax, [edi - 8192 + PROC.pdt_0_phys]
or eax, PG_SWR
mov [edi-4096+(page_tabs shr 20)], eax
mov [edi - 4096 + (page_tabs shr 20)], eax
lea edx, [edi-4096]
mov esi, [app_tabs]
@ -447,7 +447,7 @@ align 4
mov esi, ecx
list_del esi
mov esi, [esi+PROC.dlls_list_ptr]
mov esi, [esi + PROC.dlls_list_ptr]
call destroy_all_hdlls
mov esi, [esp]
@ -475,7 +475,7 @@ align 4
align 4
get_pid:
mov eax, [current_slot]
mov eax, [eax+APPDATA.tid]
mov eax, [eax + APPDATA.tid]
ret
pid_to_slot:
@ -488,10 +488,7 @@ pid_to_slot:
push ecx
mov ebx, [thread_count]
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
;mov ecx, 2*32 ;sizeof.TASKDATA
mov ecx, sizeof.APPDATA
.loop:
@ -499,7 +496,7 @@ pid_to_slot:
;ebx = maximum permitted offset
cmp [SLOT_BASE + ecx + APPDATA.state], TSTATE_FREE
jz .endloop ;skip empty slots
cmp [ecx + SLOT_BASE + APPDATA.tid], eax;check PID
cmp [SLOT_BASE + ecx + APPDATA.tid], eax
jz .pid_found
.endloop:
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 edi, eax
shl edi, 8
shl edi, BSF sizeof.APPDATA
add edi, SLOT_BASE
mov edx, edi ;edx=edi - pointer to extended infomation about new thread
mov ecx, sizeof.APPDATA/4
@ -711,7 +708,7 @@ proc new_sys_threads
rep movsb ;copy process name
mov eax, [ebx+APPDATA.tls_base]
mov eax, [ebx + APPDATA.tls_base]
test eax, eax
jz @F
@ -721,13 +718,13 @@ proc new_sys_threads
test eax, eax
jz .failed1;eax=0
@@:
mov [edx+APPDATA.tls_base], eax
mov [edx + APPDATA.tls_base], eax
mov eax, [ebx+APPDATA.process]
mov [edx+APPDATA.process], eax
mov eax, [ebx + APPDATA.process]
mov [edx + APPDATA.process], eax
lea ebx, [edx+APPDATA.list]
lea ecx, [eax+PROC.thr_list]
lea ebx, [edx + APPDATA.list]
lea ecx, [eax + PROC.thr_list]
list_add_tail ebx, ecx ;add thread to process child's list
lea eax, [app_cmdline]
@ -796,16 +793,16 @@ endp
align 4
common_app_entry:
mov ebp, [current_slot]
mov ebp, [ebp+APPDATA.exec_params]
mov ebp, [ebp + APPDATA.exec_params]
test ebp, ebp
jz .exit
; APPDATA.exec_params have first thread only,
; so second and next threads don't get here (they jump to .exit)
stdcall map_process_image, [ebp+APP_HDR._emem],\
[ebp+APP_HDR.img_base], [ebp+APP_HDR.img_size]
mov esi, [ebp+APP_HDR.path_string]
mov edi, [ebp+APP_HDR.path]
mov ecx, [ebp+APP_HDR.filename_size]
stdcall map_process_image, [ebp + APP_HDR._emem],\
[ebp + APP_HDR.img_base], [ebp + APP_HDR.img_size]
mov esi, [ebp + APP_HDR.path_string]
mov edi, [ebp + APP_HDR.path]
mov ecx, [ebp + APP_HDR.filename_size]
cmp ecx, 1023
jc @f
mov ecx, 1022
@ -813,7 +810,7 @@ common_app_entry:
push esi
test edi, edi
jz @f
stdcall is_region_userspace, edi, [ebp+APP_HDR.filename_size]
stdcall is_region_userspace, edi, [ebp + APP_HDR.filename_size]
jnz @f
mov al, '/'
stosb
@ -821,14 +818,14 @@ common_app_entry:
mov byte [edi], 0
@@:
call kernel_free
mov edi, [ebp+APP_HDR.cmdline]
mov edi, [ebp + APP_HDR.cmdline]
test edi, edi
jz .check_tls_header
lea esi, [ebp+sizeof.APP_HDR]
mov ecx, [ebp+APP_HDR.cmdline_size]
lea esi, [ebp + sizeof.APP_HDR]
mov ecx, [ebp + APP_HDR.cmdline_size]
cmp ecx, 256
jb .copy_cmdline
mov edi, [ebp+APP_HDR._emem]
mov edi, [ebp + APP_HDR._emem]
add edi, 4095
and edi, -4096
sub edi, ecx
@ -852,7 +849,7 @@ common_app_entry:
call init_heap
stdcall user_alloc, 4096
mov edx, [current_slot]
mov [edx+APPDATA.tls_base], eax
mov [edx + APPDATA.tls_base], eax
mov [tls_data_l+2], ax
shr eax, 16
mov [tls_data_l+4], al
@ -862,7 +859,7 @@ common_app_entry:
; { Patch by Coldy, For DLL autoload
.try_load_dll:
; 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
jne .cleanup
;if APP_HEADER.version = 2 => load lib/dll.obj & change eip to APP_STARTUP_THUNK
@ -887,7 +884,7 @@ common_app_entry:
;.change_eip:
mov ecx, [current_slot]
mov ecx, [ecx+APPDATA.pl0_stack]
mov ecx, [ecx + APPDATA.pl0_stack]
mov [ecx+REG_EIP], eax
; } End patch by Coldy, For DLL autoload
@ -895,9 +892,9 @@ common_app_entry:
stdcall free_kernel_space, [ebp+APP_HDR.img_base]
stdcall kernel_free, ebp
mov ebx, [current_slot]
cmp [ebx+APPDATA.debugger_slot], 0
cmp [ebx + APPDATA.debugger_slot], 0
je .exit
mov [ebx+APPDATA.state], TSTATE_RUN_SUSPENDED
mov [ebx + APPDATA.state], TSTATE_RUN_SUSPENDED
mov [ebx + APPDATA.state], TSTATE_RUN_SUSPENDED
call change_task
.exit:
@ -927,16 +924,16 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
mov ebx, eax
shl eax, BSF sizeof.APPDATA
mov [eax+SLOT_BASE+APPDATA.fpu_state], edi
mov [eax+SLOT_BASE+APPDATA.exc_handler], 0
mov [eax+SLOT_BASE+APPDATA.except_mask], 0
mov [eax+SLOT_BASE+APPDATA.terminate_protection], 80000001h
mov [SLOT_BASE + eax + APPDATA.fpu_state], edi
mov [SLOT_BASE + eax + APPDATA.exc_handler], 0
mov [SLOT_BASE + eax + APPDATA.except_mask], 0
mov [SLOT_BASE + eax + APPDATA.terminate_protection], 80000001h
;set default io permission map
mov ecx, [SLOT_BASE+sizeof.APPDATA+APPDATA.io_map]
mov [eax+SLOT_BASE+APPDATA.io_map], ecx
mov ecx, [SLOT_BASE+sizeof.APPDATA+APPDATA.io_map+4]
mov [eax+SLOT_BASE+APPDATA.io_map+4], ecx
mov ecx, [SLOT_BASE + sizeof.APPDATA + APPDATA.io_map]
mov [SLOT_BASE + eax + APPDATA.io_map], ecx
mov ecx, [SLOT_BASE + sizeof.APPDATA + APPDATA.io_map + 4]
mov [SLOT_BASE + eax + APPDATA.io_map + 4], ecx
mov esi, fpu_data
mov ecx, [xsave_area_size]
@ -947,45 +944,45 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
cmp [thread_count], ebx
adc [thread_count], 0 ; update number of processes
shl ebx, BSF sizeof.APPDATA
lea edx, [ebx+SLOT_BASE+APP_EV_OFFSET]
mov [SLOT_BASE+APPDATA.fd_ev+ebx], edx
mov [SLOT_BASE+APPDATA.bk_ev+ebx], edx
lea edx, [SLOT_BASE + ebx + APP_EV_OFFSET]
mov [SLOT_BASE + ebx + APPDATA.fd_ev], edx
mov [SLOT_BASE + ebx + APPDATA.bk_ev], edx
add edx, APP_OBJ_OFFSET-APP_EV_OFFSET
mov [SLOT_BASE+APPDATA.fd_obj+ebx], edx
mov [SLOT_BASE+APPDATA.bk_obj+ebx], edx
add edx, APP_OBJ_OFFSET - APP_EV_OFFSET
mov [SLOT_BASE + ebx + APPDATA.fd_obj], edx
mov [SLOT_BASE + ebx + APPDATA.bk_obj], edx
mov ecx, [def_cursor]
mov [SLOT_BASE+APPDATA.cursor+ebx], ecx
mov [SLOT_BASE + ebx + APPDATA.cursor], ecx
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
mov [SLOT_BASE+APPDATA.saved_esp0+ebx], eax
mov [SLOT_BASE + ebx + APPDATA.saved_esp0], eax
push ebx
stdcall kernel_alloc, maxPathLength
pop ebx
mov esi, [current_slot]
mov esi, [esi+APPDATA.cur_dir]
mov esi, [esi + APPDATA.cur_dir]
mov ecx, maxPathLength/4
mov edi, eax
mov [ebx+SLOT_BASE+APPDATA.cur_dir], eax
mov [SLOT_BASE + ebx + APPDATA.cur_dir], eax
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]
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 [ebx+SLOT_BASE+APPDATA.wnd_number], al
mov [SLOT_BASE + ebx + APPDATA.wnd_number], al
mov ebx, eax
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
mov [ebx+window_data+WDATA.fl_wstate], WSTATE_NORMAL
mov [ebx+window_data+WDATA.fl_redraw], 1
mov [window_data + ebx + WDATA.fl_wstate], WSTATE_NORMAL
mov [window_data + ebx + WDATA.fl_redraw], 1
;set draw data to full screen
xor eax, eax
@ -998,50 +995,50 @@ proc set_app_params stdcall,slot:dword, params:dword, flags:dword
mov ebx, [pl0_stack]
mov esi, [params]
lea ecx, [ebx+REG_EIP]
lea ecx, [ebx + REG_EIP]
xor eax, eax
mov [ebx+REG_RET], dword common_app_entry
mov [ebx+REG_EDI], eax
mov [ebx+REG_ESI], eax
mov [ebx+REG_EBP], eax
mov [ebx+REG_ESP], ecx;ebx+REG_EIP
mov [ebx+REG_EBX], eax
mov [ebx+REG_EDX], eax
mov [ebx+REG_ECX], eax
mov [ebx+REG_EAX], eax
mov [ebx + REG_RET], dword common_app_entry
mov [ebx + REG_EDI], eax
mov [ebx + REG_ESI], eax
mov [ebx + REG_EBP], eax
mov [ebx + REG_ESP], ecx;ebx+REG_EIP
mov [ebx + REG_EBX], eax
mov [ebx + REG_EDX], eax
mov [ebx + REG_ECX], eax
mov [ebx + REG_EAX], eax
mov eax, [esi+APP_HDR.eip]
mov [ebx+REG_EIP], eax
mov [ebx+REG_CS], dword app_code
mov eax, [esi + APP_HDR.eip]
mov [ebx + REG_EIP], eax
mov [ebx + REG_CS], dword app_code
mov ecx, USER_PRIORITY
test byte [flags], 2
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 [ebx+REG_EFLAGS], dword EFL_IOPL1+EFL_IF
mov [ebx + REG_EFLAGS], dword EFL_IOPL1+EFL_IF
mov eax, [esi+APP_HDR.esp]
mov [ebx+REG_APP_ESP], eax
mov [ebx+REG_SS], dword app_data
mov eax, [esi + APP_HDR.esp]
mov [ebx + REG_APP_ESP], eax
mov [ebx + REG_SS], dword app_data
lea edx, [ebx+REG_RET]
lea edx, [ebx + REG_RET]
mov ebx, [slot]
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
; set if debuggee
test byte [flags], 1
jz .no_debug
mov eax, [current_slot_idx]
mov [SLOT_BASE+ebx+APPDATA.debugger_slot], eax
mov [SLOT_BASE + ebx + APPDATA.debugger_slot], eax
.no_debug:
mov [SLOT_BASE + ebx + APPDATA.state], dl
lea edx, [SLOT_BASE+ebx]
lea edx, [SLOT_BASE + ebx]
call scheduler_add_thread
ret
endp
@ -1049,7 +1046,7 @@ endp
align 4
get_stack_base:
mov eax, [current_slot]
mov eax, [eax+APPDATA.pl0_stack]
mov eax, [eax + APPDATA.pl0_stack]
ret

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -91,11 +91,11 @@ proc timer_hs stdcall uses ebx, deltaStart:dword, interval:dword, \
xchg ebx, eax
; 2a. Copy values from the arguments.
mov ecx, [interval]
mov [ebx+TIMER.Interval], ecx
mov [ebx + TIMER.Interval], ecx
mov ecx, [timerFunc]
mov [ebx+TIMER.TimerFunc], ecx
mov [ebx + TIMER.TimerFunc], ecx
mov ecx, [userData]
mov [ebx+TIMER.UserData], ecx
mov [ebx + TIMER.UserData], ecx
; 2b. Get time of the next activation.
mov ecx, [deltaStart]
test ecx, ecx
@ -103,17 +103,17 @@ proc timer_hs stdcall uses ebx, deltaStart:dword, interval:dword, \
mov ecx, [interval]
@@:
add ecx, [timer_ticks]
mov [ebx+TIMER.Time], ecx
mov [ebx + TIMER.Time], ecx
; 3. Insert the TIMER structure to the global list.
; 3a. Acquire the lock.
call lock_timer_list
; 3b. Insert an item at ebx to the tail of the timer_list.
mov eax, timer_list
mov ecx, [eax+TIMER.Prev]
mov [ebx+TIMER.Next], eax
mov [ebx+TIMER.Prev], ecx
mov [eax+TIMER.Prev], ebx
mov [ecx+TIMER.Next], ebx
mov ecx, [eax + TIMER.Prev]
mov [ebx + TIMER.Next], eax
mov [ebx + TIMER.Prev], ecx
mov [eax + TIMER.Prev], ebx
mov [ecx + TIMER.Next], ebx
; 3c. Release the lock.
call unlock_timer_list
; 4. Return with eax = pointer to TIMER structure.
@ -132,10 +132,10 @@ cancel_timer_hs:
call lock_timer_list
mov ebx, [esp+4+4]
; 1b. Delete an item at ebx from the double-linked list.
mov eax, [ebx+TIMER.Next]
mov ecx, [ebx+TIMER.Prev]
mov [eax+TIMER.Prev], ecx
mov [ecx+TIMER.Next], eax
mov eax, [ebx + TIMER.Next]
mov ecx, [ebx + TIMER.Prev]
mov [eax + TIMER.Prev], ecx
mov [ecx + TIMER.Next], eax
; 1c. If we are removing the next timer in currently processing chain,
; the next timer for this timer becomes new next timer.
cmp ebx, [timer_next]
@ -158,14 +158,14 @@ check_timers:
call lock_timer_list
; 2. Loop over all registered timers, checking time.
; 2a. Get the first item.
mov eax, [timer_list+TIMER.Next]
mov eax, [timer_list + TIMER.Next]
mov [timer_next], eax
.loop:
; 2b. Check for end of list.
cmp eax, timer_list
jz .done
; 2c. Get and store the next timer.
mov edx, [eax+TIMER.Next]
mov edx, [eax + TIMER.Next]
mov [timer_next], edx
; 2d. Check time for timer activation.
; 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
; unlikely.
mov edx, [timer_ticks]
sub edx, [eax+TIMER.Time]
sub edx, [eax + TIMER.Time]
js .next
; The timer should be activated now.
; 2e. Store the timer data in the stack. This is required since 2f can delete
; the timer, invalidating the content.
push [eax+TIMER.UserData] ; parameter for TimerFunc
push [eax+TIMER.TimerFunc] ; to be restored in 2g
push [eax + TIMER.UserData] ; parameter for TimerFunc
push [eax + TIMER.TimerFunc] ; to be restored in 2g
; 2f. Calculate time of next activation or delete the timer if it is one-shot.
mov ecx, [eax+TIMER.Interval]
add [eax+TIMER.Time], ecx
mov ecx, [eax + TIMER.Interval]
add [eax + TIMER.Time], ecx
test ecx, ecx
jnz .nodelete
stdcall cancel_timer_hs, eax
@ -208,14 +208,14 @@ check_timers:
proc check_timers_has_work?
pushf
cli
mov eax, [timer_list+TIMER.Next]
mov eax, [timer_list + TIMER.Next]
.loop:
cmp eax, timer_list
jz .done_nowork
mov edx, [timer_ticks]
sub edx, [eax+TIMER.Time]
sub edx, [eax + TIMER.Time]
jns .done_haswork
mov eax, [eax+TIMER.Next]
mov eax, [eax + TIMER.Next]
jmp .loop
.done_nowork:
popf

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -33,7 +33,7 @@ v86_create:
test eax, eax
jz .fail
; initialize mutex
and dword [eax+V86_machine.mutex], 0
and dword [eax + V86_machine.mutex], 0
; allocate tables
mov ebx, eax
@ -41,15 +41,15 @@ v86_create:
test eax, eax
jz .fail2
mov [eax+PROC.mem_used], 4096
mov [ebx+V86_machine.process], eax
mov [eax + PROC.mem_used], 4096
mov [ebx + V86_machine.process], eax
push 2000h
call kernel_alloc
test eax, eax
jz .fail2
mov [ebx+V86_machine.iopm], eax
mov [ebx + V86_machine.iopm], eax
; initialize tables
push edi
@ -58,8 +58,8 @@ v86_create:
mov ecx, 2000h/4
rep stosd
mov eax, [ebx+V86_machine.process]
mov eax, [eax+PROC.pdt_0_phys]
mov eax, [ebx + V86_machine.process]
mov eax, [eax + PROC.pdt_0_phys]
pushfd
cli
@ -107,7 +107,7 @@ v86_create:
add eax, edx
loop @b
mov eax, [sys_proc+PROC.pdt_0_phys]
mov eax, [sys_proc + PROC.pdt_0_phys]
mov cr3, eax
popfd
@ -142,7 +142,7 @@ v86_get_lin_addr:
push ecx edx
mov ecx, eax
shr ecx, 12
mov edx, [page_tabs+ecx*4]
mov edx, [page_tabs + ecx*4]
and eax, 0xFFF
and edx, 0xFFFFF000
or eax, edx
@ -210,7 +210,7 @@ init_sys_v86:
mov esi, eax
if ~DEBUG_SHOW_IO
; allow access to all ports
mov ecx, [esi+V86_machine.iopm]
mov ecx, [esi + V86_machine.iopm]
xor eax, eax
mov edi, ecx
mov ecx, 10000h/8/4
@ -258,30 +258,30 @@ v86_start:
mov ecx, [current_slot]
push dword [ecx+APPDATA.io_map]
push dword [ecx+APPDATA.io_map+4]
push [ecx+APPDATA.process]
push [ecx+APPDATA.saved_esp0]
mov [ecx+APPDATA.saved_esp0], esp
push dword [ecx + APPDATA.io_map]
push dword [ecx + APPDATA.io_map+4]
push [ecx + APPDATA.process]
push [ecx + APPDATA.saved_esp0]
mov [ecx + APPDATA.saved_esp0], esp
mov [tss._esp0], esp
mov eax, [esi+V86_machine.iopm]
mov eax, [esi + V86_machine.iopm]
call get_pg_addr
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 eax, [esi+V86_machine.iopm]
mov eax, [esi + V86_machine.iopm]
add eax, 0x1000
call get_pg_addr
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 eax, [esi+V86_machine.process]
mov [ecx+APPDATA.process], eax
mov eax, [esi + V86_machine.process]
mov [ecx + APPDATA.process], eax
mov [current_process], eax
mov eax, [eax+PROC.pdt_0_phys]
mov eax, [eax + PROC.pdt_0_phys]
mov cr3, eax
; We do not enable interrupts, because V86 IRQ redirector assumes that
@ -301,18 +301,18 @@ v86_start:
uglobal
v86_irqhooks rd IRQ_RESERVED * 2
endg
cmp [v86_irqhooks+edx*8], 0
cmp [v86_irqhooks + edx*8], 0
jz @f
cmp [v86_irqhooks+edx*8], eax
cmp [v86_irqhooks + edx*8], eax
jz @f
mov esi, v86_irqerr
call sys_msg_board_str
inc [v86_irqhooks+edx*8+4]
inc [v86_irqhooks + edx*8 + 4]
mov eax, 3
jmp v86_exc_c.exit
@@:
mov [v86_irqhooks+edx*8], eax
inc [v86_irqhooks+edx*8+4]
mov [v86_irqhooks + edx*8], eax
inc [v86_irqhooks + edx*8 + 4]
.noirqhook:
popad
@ -343,26 +343,26 @@ v86_exc_c:
xor eax, eax
mov dr6, eax
@@:
mov eax, [esp+sizeof.v86_regs+10h+18h]
cmp word [esp+v86_regs.eip], ax
mov eax, [esp + sizeof.v86_regs + 10h+18h]
cmp word [esp + v86_regs.eip], ax
jnz @f
shr eax, 16
cmp word [esp+v86_regs.cs], ax
cmp word [esp + v86_regs.cs], ax
jz .done
@@:
; Various system events, which must be handled, result in #GP
cmp bl, 13
jnz .nogp
; 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
; Otherwise we can safely access byte at CS:IP
; (because it is #GP, not #PF handler)
; If we could get an exception just because of reading code bytes,
; 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
add esi, [esp+v86_regs.eip]
add esi, [esp + v86_regs.eip]
lodsb
cmp al, 0xCD ; int xx command = CD xx
jz .handle_int
@ -394,7 +394,7 @@ v86_exc_c:
jz .handle_66
jmp .nogp
.handle_int:
cmp word [esp+v86_regs.eip], 0xFFFF
cmp word [esp + v86_regs.eip], 0xFFFF
jae .nogp
xor eax, eax
lodsb
@ -403,19 +403,19 @@ v86_exc_c:
; N.B. It is possible that some checks need to be corrected,
; but at least in case of normal execution the code works.
.simulate_int:
cmp word [esp+v86_regs.esp], 6
cmp word [esp + v86_regs.esp], 6
jae @f
mov bl, 12 ; #SS exception
jmp .nogp
@@:
movzx edx, word [esp+v86_regs.ss]
movzx edx, word [esp + v86_regs.ss]
shl edx, 4
push eax
movzx eax, word [esp+4+v86_regs.esp]
movzx eax, word [esp + 4 + v86_regs.esp]
sub eax, 6
add edx, eax
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
cmp eax, 0x1000
jae @f
@ -437,33 +437,33 @@ v86_exc_c:
inc eax
@@:
mov word [edx], ax
mov eax, [esp+4+v86_regs.cs]
mov eax, [esp + 4 + v86_regs.cs]
mov word [edx+2], ax
mov eax, [esp+4+v86_regs.eflags]
mov eax, [esp + 4 + v86_regs.eflags]
mov word [edx+4], ax
pop eax
mov ah, 0
mov cx, [eax*4]
mov word [esp+v86_regs.eip], cx
mov word [esp + v86_regs.eip], cx
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
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
popad
iretd
.handle_iret:
cmp word [esp+v86_regs.esp], 0x10000 - 6
cmp word [esp + v86_regs.esp], 0x10000 - 6
jbe @f
mov bl, 12
jmp .nogp
@@:
movzx edx, word [esp+v86_regs.ss]
movzx edx, word [esp + v86_regs.ss]
shl edx, 4
movzx eax, word [esp+v86_regs.esp]
movzx eax, word [esp + v86_regs.esp]
add edx, eax
mov eax, edx
mov esi, [esp+sizeof.v86_regs+10h+4]
mov esi, [esp + sizeof.v86_regs + 10h+4]
call v86_get_lin_addr
cmp eax, 0x1000
jae @f
@ -478,28 +478,28 @@ v86_exc_c:
jmp .nogp
@@:
mov ax, [edx]
mov word [esp+v86_regs.eip], ax
mov word [esp + v86_regs.eip], ax
mov ax, [edx+2]
mov word [esp+v86_regs.cs], ax
mov word [esp + v86_regs.cs], ax
mov ax, [edx+4]
mov word [esp+v86_regs.eflags], ax
add word [esp+v86_regs.esp], 6
mov word [esp + v86_regs.eflags], ax
add word [esp + v86_regs.esp], 6
popad
iretd
.handle_pushf:
cmp word [esp+v86_regs.esp], 1
cmp word [esp + v86_regs.esp], 1
jnz @f
mov bl, 12
jmp .nogp
@@:
movzx edx, word [esp+v86_regs.ss]
movzx edx, word [esp + v86_regs.ss]
shl edx, 4
mov eax, [esp+v86_regs.esp]
mov eax, [esp + v86_regs.esp]
sub eax, 2
movzx eax, ax
add edx, eax
mov eax, edx
mov esi, [esp+sizeof.v86_regs+10h+4]
mov esi, [esp + sizeof.v86_regs + 10h+4]
call v86_get_lin_addr
cmp eax, 0x1000
jae @f
@ -513,25 +513,25 @@ v86_exc_c:
mov bl, 14
jmp .nogp
@@:
sub word [esp+v86_regs.esp], 2
mov eax, [esp+v86_regs.eflags]
sub word [esp + v86_regs.esp], 2
mov eax, [esp + v86_regs.eflags]
mov [edx], ax
inc word [esp+v86_regs.eip]
inc word [esp + v86_regs.eip]
popad
iretd
.handle_pushfd:
cmp word [esp+v86_regs.esp], 4
cmp word [esp + v86_regs.esp], 4
jae @f
mov bl, 12 ; #SS exception
jmp .nogp
@@:
movzx edx, word [esp+v86_regs.ss]
movzx edx, word [esp + v86_regs.ss]
shl edx, 4
movzx eax, word [esp+v86_regs.esp]
movzx eax, word [esp + v86_regs.esp]
sub eax, 4
add edx, eax
mov eax, edx
mov esi, [esp+sizeof.v86_regs+10h+4]
mov esi, [esp + sizeof.v86_regs + 10h+4]
call v86_get_lin_addr
cmp eax, 0x1000
jae @f
@ -545,24 +545,24 @@ v86_exc_c:
mov bl, 14 ; #PF exception
jmp .nogp
@@:
sub word [esp+v86_regs.esp], 4
movzx eax, word [esp+v86_regs.eflags]
sub word [esp + v86_regs.esp], 4
movzx eax, word [esp + v86_regs.eflags]
mov [edx], eax
add word [esp+v86_regs.eip], 2
add word [esp + v86_regs.eip], 2
popad
iretd
.handle_popf:
cmp word [esp+v86_regs.esp], 0xFFFF
cmp word [esp + v86_regs.esp], 0xFFFF
jnz @f
mov bl, 12
jmp .nogp
@@:
movzx edx, word [esp+v86_regs.ss]
movzx edx, word [esp + v86_regs.ss]
shl edx, 4
movzx eax, word [esp+v86_regs.esp]
movzx eax, word [esp + v86_regs.esp]
add edx, eax
mov eax, edx
mov esi, [esp+sizeof.v86_regs+10h+4]
mov esi, [esp + sizeof.v86_regs+10h+4]
call v86_get_lin_addr
cmp eax, 0x1000
jae @f
@ -577,23 +577,23 @@ v86_exc_c:
jmp .nogp
@@:
mov ax, [edx]
mov word [esp+v86_regs.eflags], ax
add word [esp+v86_regs.esp], 2
inc word [esp+v86_regs.eip]
mov word [esp + v86_regs.eflags], ax
add word [esp + v86_regs.esp], 2
inc word [esp + v86_regs.eip]
popad
iretd
.handle_popfd:
cmp word [esp+v86_regs.esp], 0x10000 - 4
cmp word [esp + v86_regs.esp], 0x10000 - 4
jbe @f
mov bl, 12
jmp .nogp
@@:
movzx edx, word [esp+v86_regs.ss]
movzx edx, word [esp + v86_regs.ss]
shl edx, 4
movzx eax, word [esp+v86_regs.esp]
movzx eax, word [esp + v86_regs.esp]
add edx, eax
mov eax, edx
mov esi, [esp+sizeof.v86_regs+10h+4]
mov esi, [esp + sizeof.v86_regs + 10h+4]
call v86_get_lin_addr
cmp eax, 0x1000
jae @f
@ -608,23 +608,23 @@ v86_exc_c:
jmp .nogp
@@:
mov eax, [edx]
mov word [esp+v86_regs.eflags], ax
add word [esp+v86_regs.esp], 4
add word [esp+v86_regs.eip], 2
mov word [esp + v86_regs.eflags], ax
add word [esp + v86_regs.esp], 4
add word [esp + v86_regs.eip], 2
popad
iretd
.handle_cli:
and byte [esp+v86_regs.eflags+1], not 2
inc word [esp+v86_regs.eip]
and byte [esp + v86_regs.eflags+1], not 2
inc word [esp + v86_regs.eip]
popad
iretd
.handle_sti:
or byte [esp+v86_regs.eflags+1], 2
inc word [esp+v86_regs.eip]
or byte [esp + v86_regs.eflags+1], 2
inc word [esp + v86_regs.eip]
popad
iretd
.handle_rep:
cmp word [esp+v86_regs.eip], 0xFFFF
cmp word [esp + v86_regs.eip], 0xFFFF
jae .nogp
lodsb
cmp al, 6Eh
@ -634,19 +634,19 @@ v86_exc_c:
.handle_in:
.handle_out:
.invalid_io_byte:
movzx ebx, word [esp+v86_regs.edx]
movzx ebx, word [esp + v86_regs.edx]
mov ecx, 1
jmp .invalid_io
.handle_in_imm:
.handle_out_imm:
cmp word [esp+v86_regs.eip], 0xFFFF
cmp word [esp + v86_regs.eip], 0xFFFF
jae .nogp
lodsb
movzx ebx, al
mov ecx, 1
jmp .invalid_io
.handle_66:
cmp word [esp+v86_regs.eip], 0xFFFF
cmp word [esp + v86_regs.eip], 0xFFFF
jae .nogp
lodsb
cmp al, 0x9C
@ -660,13 +660,13 @@ v86_exc_c:
jmp .nogp
.handle_in_word:
.handle_out_word:
movzx ebx, word [esp+v86_regs.edx]
movzx ebx, word [esp + v86_regs.edx]
mov ecx, 2
jmp .invalid_io
.handle_in_dword:
.handle_out_dword:
.invalid_io_dword:
movzx ebx, word [esp+v86_regs.edx]
movzx ebx, word [esp + v86_regs.edx]
mov ecx, 4
.invalid_io:
mov esi, v86_io_str1
@ -686,8 +686,8 @@ if DEBUG_SHOW_IO
mov edx, ebx
mov ebx, 200
call delay_hs
mov esi, [esp+v86_regs.size+10h+4]
mov eax, [esi+V86_machine.iopm]
mov esi, [esp + v86_regs.size + 10h+4]
mov eax, [esi + V86_machine.iopm]
@@:
btr [eax], edx
inc edx
@ -719,12 +719,12 @@ end if
shl edx, 4
add edx, [esp+32]
@@:
mov esi, [esp+sizeof.v86_regs+10h+4]
mov esi, [esp+sizeof.v86_regs + 10h+4]
mov eax, edx
call v86_get_lin_addr
cmp eax, 0x1000
jb .nopage
mov esi, v86_exc_str3-2
mov esi, v86_exc_str3 - 2
call sys_msg_board_str
mov al, [edx]
call sys_msg_board_byte
@ -744,19 +744,19 @@ end if
xor eax, eax
.exit:
mov [esp+sizeof.v86_regs+10h+1Ch], eax
mov [esp+sizeof.v86_regs+10h+18h], ebx
mov [esp + sizeof.v86_regs + 10h+1Ch], eax
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
jz @f
dec [v86_irqhooks+edx*8+4]
dec [v86_irqhooks + edx*8 + 4]
jnz @f
and [v86_irqhooks+edx*8], 0
and [v86_irqhooks + edx*8], 0
@@:
mov esi, esp
mov edi, [esi+sizeof.v86_regs+10h+10h]
mov edi, [esi + sizeof.v86_regs + 10h+10h]
add edi, sizeof.v86_regs
mov ecx, sizeof.v86_regs/4
rep movsd
@ -766,16 +766,16 @@ end if
mov ecx, [current_slot]
pop eax
mov [ecx+APPDATA.saved_esp0], eax
mov [ecx + APPDATA.saved_esp0], eax
mov [tss._esp0], eax
pop eax
mov [ecx+APPDATA.process], eax
mov [ecx + APPDATA.process], eax
mov [current_process], eax
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
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 eax, [eax+PROC.pdt_0_phys]
mov cr3, eax
@ -816,7 +816,7 @@ align 4
v86_irq:
; push irq/pushad/jmp v86_irq
; ebp = irq
lea esi, [esp+1Ch]
lea esi, [esp + 1Ch]
lea edi, [esi+4]
mov ecx, 8
std
@ -825,11 +825,11 @@ v86_irq:
mov edi, ebp
pop eax
v86_irq2:
mov esi, [v86_irqhooks+edi*8] ; get VM handle
mov eax, [esi+V86_machine.process]
mov esi, [v86_irqhooks + edi*8] ; get VM handle
mov eax, [esi + V86_machine.process]
mov ecx, [current_slot_idx]
shl ecx, 8
cmp [SLOT_BASE+ecx+APPDATA.process], eax
shl ecx, BSF sizeof.APPDATA
cmp [SLOT_BASE + ecx + APPDATA.process], eax
jnz .notcurrent
lea eax, [edi+8]
cmp al, 10h
@ -839,19 +839,19 @@ v86_irq2:
@@:
jmp v86_exc_c.simulate_int
.notcurrent:
mov ebx, SLOT_BASE + 0x100
mov ebx, SLOT_BASE + sizeof.APPDATA
mov ecx, [thread_count]
.scan:
cmp [ebx+APPDATA.process], eax
cmp [ebx + APPDATA.process], eax
jnz .cont
push ecx
mov ecx, [ebx+APPDATA.saved_esp0]
cmp word [ecx-sizeof.v86_regs+v86_regs.esp], 6
mov ecx, [ebx + APPDATA.saved_esp0]
cmp word [ecx - sizeof.v86_regs + v86_regs.esp], 6
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
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
add edx, eax
mov eax, edx
@ -877,15 +877,15 @@ v86_irq2:
popad
iretd
.found:
mov eax, [eax+PROC.pdt_0_phys]
mov eax, [eax + PROC.pdt_0_phys]
mov cr3, eax
mov esi, [ebx+APPDATA.saved_esp0]
sub word [esi-sizeof.v86_regs+v86_regs.esp], 6
mov ecx, [esi-sizeof.v86_regs+v86_regs.eip]
mov esi, [ebx + APPDATA.saved_esp0]
sub word [esi - sizeof.v86_regs + v86_regs.esp], 6
mov ecx, [esi - sizeof.v86_regs + v86_regs.eip]
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 ecx, [esi-sizeof.v86_regs+v86_regs.eflags]
mov ecx, [esi - sizeof.v86_regs + v86_regs.eflags]
mov word [edx+4], cx
lea eax, [edi+8]
cmp al, 10h
@ -893,10 +893,10 @@ v86_irq2:
add al, 60h
@@:
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 word [esi-sizeof.v86_regs+v86_regs.cs], cx
and byte [esi-sizeof.v86_regs+v86_regs.eflags+1], not 3
mov word [esi - sizeof.v86_regs + v86_regs.cs], cx
and byte [esi - sizeof.v86_regs + v86_regs.eflags + 1], not 3
call update_counters
call find_next_task.found
call do_change_task

View File

@ -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. ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -167,7 +167,7 @@ DestroyEvent:
WaitEvent:
Бесконечно ожидает установки флага EVENT_SIGNALED в конкретном событии, принадлежащем
вызывающему WaitEvent потоку. Сигнализирующий поток устанавливат этот флаг через
RaiseEvent. Ожидающий поток замораживается путем перевода TASKDATA.state<=TSTATE_WAITING=5.
RaiseEvent. Ожидающий поток замораживается путем перевода APPDATA.state<=TSTATE_WAITING=5.
Перед заморозкой устанавливается флаг EVENT_WATCHED в событии.
Если в полученном событии НЕ установлен MANUAL_RESET, то:
{EVENT_SIGNALED и EVENT_WATCHED по получении события сбрасываются.
@ -182,7 +182,7 @@ WaitEvent:
WaitEventTimeout:
Ожидает с таймаутом установки флага EVENT_SIGNALED в конкретном событии, принадлежащем
вызывающему WaitEventTimeout потоку. Сигнализирующий поток устанавливат этот флаг через
RaiseEvent. Ожидающий поток замораживается путем перевода TASKDATA.state<=TSTATE_WAITING=5.
RaiseEvent. Ожидающий поток замораживается путем перевода APPDATA.state<=TSTATE_WAITING=5.
Перед заморозкой устанавливается флаг EVENT_WATCHED в событии.
Если в полученном событии НЕ установлен MANUAL_RESET, то:
{EVENT_SIGNALED и EVENT_WATCHED по получении события сбрасываются.
@ -216,7 +216,7 @@ GetEvent:
--------------------------------------------------------------------------------------------
Ф 68.14 для приложений: ;это тот же GetEvent, но с обёрткой.
Бесконечно ожидает любое событие в очереди событий текущего потока. Ожидающий поток
замораживается путем перевода TASKDATA.state<=TSTATE_WAITING=5. Данные события (EVENT.code+5*dword)
замораживается путем перевода APPDATA.state<=TSTATE_WAITING=5. Данные события (EVENT.code+5*dword)
копируются в указанный буфер. Сбрасывает байт приоритета (см. выше) в буфере.
Принимает:
eax - 68 - номер функции

View File

@ -176,7 +176,7 @@ DestroyEvent:
WaitEvent:
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.
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.
If flag MANUAL_RESET is NOT set in the event then:
EVENT_SIGNALED and EVENT_WATCHED are reset when the event is
@ -193,7 +193,7 @@ WaitEvent:
WaitEventTimeout:
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.
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.
If flag MANUAL_RESET is NOT set in the event then:
EVENT_SIGNALED and EVENT_WATCHED are reset when the event is
@ -212,7 +212,7 @@ WaitEventTimeout:
--------------------------------------------------------------------------------
GetEvent:
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.
Reset priority byte (see above) in the buffer.
If flag MANUAL_RESET is NOT set in the event then:
@ -232,7 +232,7 @@ GetEvent:
--------------------------------------------------------------------------------
SysFn 68.14 for application: ; wrapped GetEvent
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.
Reset priority byte (see above) in the buffer.
Gets:

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; Distributed under terms of the GNU General Public License ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -104,9 +104,9 @@ hotkey_do_test:
align 4
set_keyboard_data:
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
mov al, [SLOT_BASE+eax+APPDATA.keyboard_mode]
mov al, [SLOT_BASE + eax + APPDATA.keyboard_mode]
mov [keyboard_mode], al
mov eax, ecx
@ -144,25 +144,25 @@ register_keyboard:
test eax, eax
jz .nothing
mov ecx, [esp+4+4]
mov [eax+KEYBOARD.functions], ecx
mov [eax + KEYBOARD.functions], ecx
mov ecx, [esp+8+4]
mov [eax+KEYBOARD.userdata], ecx
mov [eax + KEYBOARD.userdata], ecx
xchg eax, ebx
mov ecx, keyboard_list_mutex
call mutex_lock
mov ecx, keyboards
mov edx, [ecx+KEYBOARD.prev]
mov [ebx+KEYBOARD.next], ecx
mov [ebx+KEYBOARD.prev], edx
mov [edx+KEYBOARD.next], ebx
mov [ecx+KEYBOARD.prev], ebx
mov ecx, [ebx+KEYBOARD.functions]
cmp [ecx+KBDFUNC.strucsize], KBDFUNC.setlights
mov edx, [ecx + KEYBOARD.prev]
mov [ebx + KEYBOARD.next], ecx
mov [ebx + KEYBOARD.prev], edx
mov [edx + KEYBOARD.next], ebx
mov [ecx + KEYBOARD.prev], ebx
mov ecx, [ebx + KEYBOARD.functions]
cmp [ecx + KBDFUNC.strucsize], KBDFUNC.setlights
jbe .unlock
mov ecx, [ecx+KBDFUNC.setlights]
mov ecx, [ecx + KBDFUNC.setlights]
test ecx, ecx
jz .unlock
stdcall ecx, [ebx+KEYBOARD.userdata], dword [kb_lights]
stdcall ecx, [ebx + KEYBOARD.userdata], dword [kb_lights]
.unlock:
mov ecx, keyboard_list_mutex
call mutex_unlock
@ -176,18 +176,18 @@ delete_keyboard:
mov ebx, [esp+4+4]
mov ecx, keyboard_list_mutex
call mutex_lock
mov eax, [ebx+KEYBOARD.next]
mov edx, [ebx+KEYBOARD.prev]
mov [eax+KEYBOARD.prev], edx
mov [edx+KEYBOARD.next], eax
mov eax, [ebx + KEYBOARD.next]
mov edx, [ebx + KEYBOARD.prev]
mov [eax + KEYBOARD.prev], edx
mov [edx + KEYBOARD.next], eax
call mutex_unlock
mov ecx, [ebx+KEYBOARD.functions]
cmp [ecx+KBDFUNC.strucsize], KBDFUNC.close
mov ecx, [ebx + KEYBOARD.functions]
cmp [ecx + KBDFUNC.strucsize], KBDFUNC.close
jbe .nothing
mov ecx, [ecx+KBDFUNC.close]
mov ecx, [ecx + KBDFUNC.close]
test ecx, ecx
jz .nothing
stdcall ecx, [ebx+KEYBOARD.userdata]
stdcall ecx, [ebx + KEYBOARD.userdata]
.nothing:
pop ebx
ret 4
@ -195,9 +195,9 @@ delete_keyboard:
align 4
irq1:
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
mov al, [SLOT_BASE+eax+APPDATA.keyboard_mode]
mov al, [SLOT_BASE + eax + APPDATA.keyboard_mode]
mov [keyboard_mode], al
in al, 0x60
@ -326,7 +326,7 @@ send_scancode:
js .writekey
movzx eax, ch ; plain key
mov bl, [keymap+eax]
mov bl, [keymap + eax]
mov edx, [kb_state]
test dl, VKEY_CONTROL ; ctrl alt del
jz .noctrlaltdel
@ -357,12 +357,12 @@ send_scancode:
test dl, VKEY_SHIFT ; shift on ?
jz @f
.keymap_shif:
mov bl, [keymap_shift+eax]
mov bl, [keymap_shift + eax]
@@:
test dl, VKEY_ALT ; alt on ?
jz @f
mov bl, [keymap_alt+eax]
mov bl, [keymap_alt + eax]
@@:
jmp .writekey
;--------------------------------------
@ -510,7 +510,7 @@ send_scancode:
inc eax
mov [KEY_COUNT], al
; store ascii or scancode
mov [KEY_BUFF+eax-1], bl
mov [KEY_BUFF + eax -1], bl
; store original scancode
add eax, 120+2
push ecx
@ -519,7 +519,7 @@ send_scancode:
xor ch, ch
@@:
mov [KEY_BUFF+eax-1], ch
mov [KEY_BUFF + eax -1], ch
pop ecx
sub eax, 120+2
.exit.irq1:
@ -531,16 +531,16 @@ set_lights:
call mutex_lock
mov esi, keyboards
.loop:
mov esi, [esi+KEYBOARD.next]
mov esi, [esi + KEYBOARD.next]
cmp esi, keyboards
jz .done
mov eax, [esi+KEYBOARD.functions]
mov eax, [esi + KEYBOARD.functions]
cmp dword [eax], KBDFUNC.setlights
jbe .loop
mov eax, [eax+KBDFUNC.setlights]
mov eax, [eax + KBDFUNC.setlights]
test eax, eax
jz .loop
stdcall eax, [esi+KEYBOARD.userdata], dword [kb_lights]
stdcall eax, [esi + KEYBOARD.userdata], dword [kb_lights]
jmp .loop
.done:
mov ecx, keyboard_list_mutex

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -115,15 +115,15 @@ save_draw_mouse:
mov eax, [d_width_calc_area + eax*4]
add eax, [_display.win_map]
movzx edx, byte [ebx+eax]
shl edx, 8
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
movzx edx, byte [ebx + eax]
shl edx, BSF sizeof.APPDATA
mov esi, [SLOT_BASE + edx + APPDATA.cursor]
cmp esi, [current_cursor]
je .draw
mov eax, [thread_count]
movzx eax, word [WIN_POS+eax*2]
movzx eax, word [WIN_POS + eax*2]
shl eax, 8
cmp eax, edx
@ -461,13 +461,13 @@ redrawmouse:
mov esi, [current_cursor]
mov ax, [Y_UNDER]
sub eax, [esi+CURSOR.hot_y]
sub eax, [esi + CURSOR.hot_y]
mov [Y_UNDER_subtraction_CUR_hot_y], ax
add eax, [cur.h]
mov [Y_UNDER_sub_CUR_hot_y_add_curh], ax
mov ax, [X_UNDER]
sub eax, [esi+CURSOR.hot_x]
sub eax, [esi + CURSOR.hot_x]
mov [X_UNDER_subtraction_CUR_hot_x], ax
add eax, [cur.w]
mov [X_UNDER_sub_CUR_hot_x_add_curh], ax

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -14,7 +14,7 @@ proc mem_test
jnz .ret
mov eax, cr0
and eax, not (CR0_CD+CR0_NW)
and eax, not (CR0_CD + CR0_NW)
or eax, CR0_CD ;disable caching
mov cr0, eax
wbinvd ;invalidate cache
@ -28,16 +28,16 @@ proc mem_test
xchg ebx, dword [edi]
je @b
and eax, not (CR0_CD+CR0_NW) ;enable caching
and eax, not (CR0_CD + CR0_NW) ;enable caching
mov cr0, eax
inc dword [BOOT_LO.memmap_block_cnt]
xor eax, 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.size.lo], edi
mov [BOOT_LO.memmap_blocks+e820entry.size.hi], 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.size.lo], edi
mov [BOOT_LO.memmap_blocks + e820entry.size.hi], eax
inc eax
mov [BOOT_LO.memmap_blocks+e820entry.type], eax
mov [BOOT_LO.memmap_blocks + e820entry.type], eax
.ret:
ret
endp
@ -51,29 +51,29 @@ proc init_mem
xor edx, edx; edx will hold maximum allocatable address
.calcmax:
; round all to pages
mov eax, [edi+e820entry.addr.lo]
cmp byte [edi+e820entry.type], 1
mov eax, [edi + e820entry.addr.lo]
cmp byte [edi + e820entry.type], 1
jne .unusable
test eax, 0xFFF
jz @f
neg eax
and eax, 0xFFF
add [edi+e820entry.addr.lo], eax
adc [edi+e820entry.addr.hi], 0
sub [edi+e820entry.size.lo], eax
sbb [edi+e820entry.size.hi], 0
add [edi + e820entry.addr.lo], eax
adc [edi + e820entry.addr.hi], 0
sub [edi + e820entry.size.lo], eax
sbb [edi + e820entry.size.hi], 0
jc .unusable
@@:
and [edi+e820entry.size.lo], not 0xFFF
and [edi + e820entry.size.lo], not 0xFFF
jz .unusable
; ignore memory after 4 GiB
cmp [edi+e820entry.addr.hi], 0
cmp [edi + e820entry.addr.hi], 0
jnz .unusable
mov eax, [edi+e820entry.addr.lo]
cmp [edi+e820entry.size.hi], 0
mov eax, [edi + e820entry.addr.lo]
cmp [edi + e820entry.size.hi], 0
jnz .overflow
add eax, [edi+e820entry.size.lo]
add eax, [edi + e820entry.size.lo]
jnc @f
.overflow:
mov eax, 0xFFFFF000
@ -82,8 +82,8 @@ proc init_mem
jae @f
mov edx, eax
@@:
sub eax, [edi+e820entry.addr.lo]
mov [edi+e820entry.size.lo], eax
sub eax, [edi + e820entry.addr.lo]
mov [edi + e820entry.size.lo], eax
add esi, eax
jmp .usable
.unusable:
@ -92,18 +92,18 @@ proc init_mem
add edi, sizeof.e820entry
loop .calcmax
.calculated:
mov [MEM_AMOUNT-OS_BASE], esi
mov [pg_data.mem_amount-OS_BASE], esi
mov [MEM_AMOUNT - OS_BASE], esi
mov [pg_data.mem_amount - OS_BASE], esi
shr esi, 12
mov [pg_data.pages_count-OS_BASE], esi
mov [pg_data.pages_count - OS_BASE], esi
shr edx, 12
add edx, 31
and edx, not 31
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
mov [tmp_page_tabs], edx
@ -114,29 +114,29 @@ proc init_mem
mov edx, (OS_BASE/4096)
jmp .set
@@:
cmp edx, (HEAP_BASE-OS_BASE+HEAP_MIN_SIZE)/4096
cmp edx, (HEAP_BASE - OS_BASE + HEAP_MIN_SIZE)/4096
jae .set
mov edx, (HEAP_BASE-OS_BASE+HEAP_MIN_SIZE)/4096
mov edx, (HEAP_BASE - OS_BASE + HEAP_MIN_SIZE)/4096
.set:
mov [pg_data.kernel_pages-OS_BASE], edx
mov [pg_data.kernel_pages - OS_BASE], edx
shr edx, 10
mov [pg_data.kernel_tables-OS_BASE], edx
mov [pg_data.kernel_tables - OS_BASE], edx
xor eax, eax
mov edi, sys_proc-OS_BASE
mov edi, sys_proc - OS_BASE
mov ecx, 8192/4
cld
rep stosd
mov edx, (sys_proc-OS_BASE+PROC.pdt_0)+ 0x800; (OS_BASE shr 20)
bt [cpu_caps-OS_BASE], CAPS_PSE
mov edx, (sys_proc - OS_BASE + PROC.pdt_0) + 0x800; (OS_BASE shr 20)
bt [cpu_caps - OS_BASE], CAPS_PSE
jnc .no_PSE
mov ebx, cr4
or ebx, CR4_PSE
mov eax, PDE_LARGE+PG_SWR
mov eax, PDE_LARGE + PG_SWR
mov cr4, ebx
dec [pg_data.kernel_tables-OS_BASE]
dec [pg_data.kernel_tables - OS_BASE]
mov [edx], eax
add edx, 4
@ -156,12 +156,12 @@ proc init_mem
jnz @B
.map_kernel_heap:
mov ecx, [pg_data.kernel_tables-OS_BASE]
mov ecx, [pg_data.kernel_tables - OS_BASE]
shl ecx, 10
xor eax, eax
rep stosd
mov ecx, [pg_data.kernel_tables-OS_BASE]
mov ecx, [pg_data.kernel_tables - OS_BASE]
mov eax, [tmp_page_tabs]
or eax, PG_SWR
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 edi, (sys_proc+PROC.pdt_0-OS_BASE)
lea esi, [edi+(OS_BASE shr 20)]
mov edi, (sys_proc + PROC.pdt_0 - OS_BASE)
lea esi, [edi + (OS_BASE shr 20)]
movsd
movsd
ret
@ -184,8 +184,8 @@ endp
align 4
proc init_page_map
; mark all memory as unavailable
mov edi, sys_pgmap-OS_BASE
mov ecx, [pg_data.pagemap_size-OS_BASE]
mov edi, sys_pgmap - OS_BASE
mov ecx, [pg_data.pagemap_size - OS_BASE]
shr ecx, 2
xor eax, eax
cld
@ -195,18 +195,18 @@ proc init_page_map
mov ebx, BOOT_LO.memmap_blocks
mov edx, [ebx-4]
.scanmap:
cmp byte [ebx+e820entry.type], 1
cmp byte [ebx + e820entry.type], 1
jne .next
mov ecx, [ebx+e820entry.size.lo]
mov ecx, [ebx + e820entry.size.lo]
shr ecx, 12; ecx = number of pages
jz .next
mov edi, [ebx+e820entry.addr.lo]
mov edi, [ebx + e820entry.addr.lo]
shr edi, 12; edi = first page
mov eax, edi
shr edi, 5
shl edi, 2
add edi, sys_pgmap-OS_BASE
add edi, sys_pgmap - OS_BASE
and eax, 31
jz .startok
add ecx, eax
@ -245,13 +245,13 @@ proc init_page_map
; mark kernel memory as allocated (unavailable)
mov ecx, [tmp_page_tabs]
mov edx, [pg_data.pages_count-OS_BASE]
mov edx, [pg_data.pages_count - OS_BASE]
shr ecx, 12
add ecx, [pg_data.kernel_tables-OS_BASE]
add ecx, [pg_data.kernel_tables - OS_BASE]
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
shr ecx, 5
xor eax, eax
@ -263,11 +263,11 @@ proc init_page_map
shl eax, cl
and [edi], eax
add edi, OS_BASE
mov [page_start-OS_BASE], edi;
mov [page_start - OS_BASE], edi;
mov ebx, sys_pgmap
add ebx, [pg_data.pagemap_size-OS_BASE]
mov [page_end-OS_BASE], ebx
add ebx, [pg_data.pagemap_size - OS_BASE]
mov [page_end - OS_BASE], ebx
ret
endp
@ -311,24 +311,24 @@ init_BIOS32:
add ebx, OS_BASE
dec ecx
mov [(pci_code_32-OS_BASE)], cx ;limit 0-15
mov [(pci_data_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_code_32-OS_BASE)+2], bx ;base 0-15
mov [(pci_data_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
shr ebx, 16
mov [(pci_code_32-OS_BASE)+4], bl ;base 16-23
mov [(pci_data_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
shr ecx, 16
and cl, 0x0F
mov ch, bh
add cx, D32
mov [(pci_code_32-OS_BASE)+6], cx ;lim 16-19 &
mov [(pci_data_32-OS_BASE)+6], cx ;base 24-31
mov [(pci_code_32 - OS_BASE)+6], cx ;lim 16-19 &
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
.PCI_BIOS32_not_found:
; pci_emu_dat structure should be filled here
@ -344,9 +344,9 @@ proc test_cpu
xor eax, eax
mov [cpu_type], eax
mov [cpu_caps-OS_BASE], eax
mov [cpu_caps+4-OS_BASE], eax
mov [cpu_phys_addr_width-OS_BASE], 32
mov [cpu_caps - OS_BASE], eax
mov [cpu_caps + 4 - OS_BASE], eax
mov [cpu_phys_addr_width - OS_BASE], 32
pushfd
pop eax
@ -375,22 +375,22 @@ proc test_cpu
xor eax, eax
cpuid
mov [cpu_vendor-OS_BASE], ebx
mov [cpu_vendor+4-OS_BASE], edx
mov [cpu_vendor+8-OS_BASE], ecx
mov [cpu_vendor - OS_BASE], ebx
mov [cpu_vendor + 4 - OS_BASE], edx
mov [cpu_vendor + 8 - OS_BASE], ecx
cmp eax, 1
jl .end_cpuid
mov eax, 1
cpuid
mov [cpu_sign-OS_BASE], eax
mov [cpu_info-OS_BASE], ebx
mov [cpu_caps-OS_BASE], edx
mov [cpu_caps+4-OS_BASE], ecx
mov [cpu_sign - OS_BASE], eax
mov [cpu_info - OS_BASE], ebx
mov [cpu_caps - OS_BASE], edx
mov [cpu_caps + 4 - OS_BASE], ecx
bt edx, CAPS_PAE
jnc @f
mov [cpu_phys_addr_width-OS_BASE], 36
mov [cpu_phys_addr_width - OS_BASE], 36
@@:
mov eax, 0x80000000
cpuid
@ -398,10 +398,10 @@ proc test_cpu
jb @f
mov eax, 0x80000008
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
and eax, 0x0f
ret
@ -415,14 +415,14 @@ ACPI_HI_RSDP_WINDOW_END = 0x00100000
ACPI_RSDP_CHECKSUM_LENGTH = 20
proc acpi_locate_tables uses ebx esi edi
mov ebx, [ebx+ACPI_RSDP.RsdtAddress]
mov [acpi_rsdt_base-OS_BASE], ebx
mov eax, [ebx+ACPI_RSDT.Length]
mov [acpi_rsdt_size-OS_BASE], eax
mov ebx, [ebx + ACPI_RSDP.RsdtAddress]
mov [acpi_rsdt_base - OS_BASE], ebx
mov eax, [ebx + ACPI_RSDT.Length]
mov [acpi_rsdt_size - OS_BASE], eax
mov esi, [acpi_rsdt_base-OS_BASE]
mov ecx, [esi+ACPI_RSDT.Length]
lea edi, [esi+ecx]
mov esi, [acpi_rsdt_base - OS_BASE]
mov ecx, [esi + ACPI_RSDT.Length]
lea edi, [esi + ecx]
add esi, sizeof.ACPI_TABLE
movi ecx, 1
.next_table:
@ -439,35 +439,35 @@ proc acpi_locate_tables uses ebx esi edi
jz .hpet
jmp .next_table
.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 [acpi_ssdt_size+ecx*4-OS_BASE], eax
mov [acpi_ssdt_size + ecx*4 - OS_BASE], eax
inc ecx
jmp .next_table
.fadt:
mov [acpi_fadt_base-OS_BASE], eax
cmp [eax+ACPI_FADT.DSDT], 0
mov [acpi_fadt_base - OS_BASE], eax
cmp [eax + ACPI_FADT.DSDT], 0
jz @f
mov edx, [eax+ACPI_FADT.DSDT]
mov [acpi_ssdt_base-OS_BASE], edx
mov edx, [edx+ACPI_TABLE.Length]
mov [acpi_ssdt_size-OS_BASE], edx
mov edx, [eax + ACPI_FADT.DSDT]
mov [acpi_ssdt_base - OS_BASE], edx
mov edx, [edx + ACPI_TABLE.Length]
mov [acpi_ssdt_size - OS_BASE], edx
@@:
mov eax, [eax+ACPI_TABLE.Length]
mov [acpi_fadt_size-OS_BASE], eax
mov eax, [eax + ACPI_TABLE.Length]
mov [acpi_fadt_size - OS_BASE], eax
jmp .next_table
.madt:
mov [acpi_madt_base-OS_BASE], eax
mov eax, [eax+ACPI_TABLE.Length]
mov [acpi_madt_size-OS_BASE], eax
mov [acpi_madt_base - OS_BASE], eax
mov eax, [eax + ACPI_TABLE.Length]
mov [acpi_madt_size - OS_BASE], eax
jmp .next_table
.hpet:
mov [acpi_hpet_base-OS_BASE], eax
mov eax, [eax+ACPI_TABLE.Length]
mov [acpi_hpet_size-OS_BASE], eax
mov [acpi_hpet_base - OS_BASE], eax
mov eax, [eax + ACPI_TABLE.Length]
mov [acpi_hpet_size - OS_BASE], eax
jmp .next_table
.done:
mov [acpi_ssdt_cnt-OS_BASE], ecx
mov [acpi_ssdt_cnt - OS_BASE], ecx
ret
endp
@ -497,7 +497,7 @@ else
call .check
end if
.done:
mov [acpi_rsdp_base-OS_BASE], ebx
mov [acpi_rsdp_base - OS_BASE], ebx
test ebx, ebx
jz @f
call acpi_locate_tables

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved.
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved.
;; PROGRAMMING:
;; Ivan Poddubny
;; Marat Zakiyanov (Mario79)
@ -195,12 +195,12 @@ B32:
xor eax, eax
mov edi, CLEAN_ZONE
mov ecx, (HEAP_BASE-OS_BASE-CLEAN_ZONE) / 4
mov ecx, (HEAP_BASE - OS_BASE - CLEAN_ZONE) / 4
cld
rep stosd
; CLEAR KERNEL UNDEFINED GLOBALS
mov edi, endofcode-OS_BASE
mov edi, endofcode - OS_BASE
mov ecx, 0x90000
sub ecx, edi
shr ecx, 2
@ -216,7 +216,7 @@ B32:
rep stosd
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 init_BIOS32
@ -227,11 +227,11 @@ B32:
; ENABLE PAGING
mov eax, sys_proc-OS_BASE+PROC.pdt_0
mov eax, sys_proc - OS_BASE + PROC.pdt_0
mov cr3, eax
mov eax, cr0
or eax, CR0_PG+CR0_WP
or eax, CR0_PG + CR0_WP
mov cr0, eax
lgdt [gdts]
@ -243,12 +243,12 @@ tmp_page_tabs dd ?
use16
ap_init16:
cli
lgdt [cs:gdts_ap-ap_init16]
mov eax, [cs:cr3_ap-ap_init16]
lgdt [cs:gdts_ap - ap_init16]
mov eax, [cs:cr3_ap - ap_init16]
mov cr3, eax
mov eax, [cs:cr4_ap-ap_init16]
mov eax, [cs:cr4_ap - ap_init16]
mov cr4, eax
mov eax, CR0_PE+CR0_PG+CR0_WP
mov eax, CR0_PE + CR0_PG + CR0_WP
mov cr0, eax
jmp pword os_code:ap_init_high
align 16
@ -283,7 +283,7 @@ high_code:
mov gs, bx
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
setc al
shl eax, 7
@ -293,7 +293,7 @@ high_code:
bt [cpu_caps], CAPS_PGE
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
mov eax, cr4
@ -303,8 +303,8 @@ high_code:
mov [pte_valid_mask], ebx
xor eax, 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], eax
mov dword [sys_proc + PROC.pdt_0+4], eax
mov eax, cr3
mov cr3, eax ; flush TLB
@ -456,7 +456,7 @@ high_code:
stdcall kernel_alloc, 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._esp0], esp
@ -515,13 +515,13 @@ high_code:
add eax, ebx
mov [ipc_ptab], eax
stdcall kernel_alloc, (unpack.LZMA_BASE_SIZE+(unpack.LZMA_LIT_SIZE shl \
(unpack.lc+unpack.lp)))*4
stdcall kernel_alloc, (unpack.LZMA_BASE_SIZE + (unpack.LZMA_LIT_SIZE shl \
(unpack.lc + unpack.lp)))*4
mov [unpack.p], eax
call init_events
mov eax, srv.fd-SRV.fd
mov eax, srv.fd - SRV.fd
mov [srv.fd], eax
mov [srv.bk], eax
@ -564,7 +564,7 @@ high_code:
mov eax, [hpet_base]
test eax, eax
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 eax, [eax+HPET_ID]
DEBUGF 1, "K : HPET caps %x\n", eax
@ -575,8 +575,8 @@ high_code:
mov esi, boot_setostask
call boot_log
mov edi, sys_proc+PROC.heap_lock
mov ecx, (PROC.ht_free-PROC.heap_lock)/4
mov edi, sys_proc + PROC.heap_lock
mov ecx, (PROC.ht_free - PROC.heap_lock)/4
xor eax, eax
cld
@ -593,7 +593,7 @@ high_code:
cmp eax, ecx
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 edi, thr_slot_map+4
@ -608,19 +608,19 @@ high_code:
mov [current_process], sys_proc
mov edx, SLOT_BASE+sizeof.APPDATA*1
mov edx, SLOT_BASE + sizeof.APPDATA*1
mov ebx, [os_stack_seg]
add ebx, RING0_STACK_SIZE
add ebx, [xsave_area_size]
call setup_os_slot
mov dword [edx], 'IDLE'
sub [edx+APPDATA.saved_esp], 4
mov eax, [edx+APPDATA.saved_esp]
sub [edx + APPDATA.saved_esp], 4
mov eax, [edx + APPDATA.saved_esp]
mov dword [eax], idle_thread
mov ecx, IDLE_PRIORITY
call scheduler_add_thread
mov edx, SLOT_BASE+sizeof.APPDATA*2
mov edx, SLOT_BASE + sizeof.APPDATA*2
mov ebx, [os_stack_seg]
call setup_os_slot
mov dword [edx], 'OS'
@ -645,9 +645,9 @@ endg
cmp ebx, 1
jbe .no_wake_cpus
call create_trampoline_pgmap
mov [cr3_ap+OS_BASE], eax
mov [cr3_ap + OS_BASE], eax
mov eax, cr4
mov [cr4_ap+OS_BASE], eax
mov [cr4_ap + OS_BASE], eax
mov esi, OS_BASE + ap_init16
mov edi, OS_BASE + 8000h
mov ecx, (ap_init16_size + 3) / 4
@ -655,10 +655,10 @@ endg
mov eax, [LAPIC_BASE]
test eax, eax
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
@@:
lea edi, [eax+APIC_ICRL]
lea edi, [eax + APIC_ICRL]
mov esi, smpt+4
dec ebx
.wake_cpus_loop:
@ -694,7 +694,7 @@ endg
@@:
cmp [ap_initialized], eax
jnz @b
mov eax, [cr3_ap+OS_BASE]
mov eax, [cr3_ap + OS_BASE]
call free_page
.no_wake_cpus:
@ -899,8 +899,8 @@ include "detect/vortex86.inc" ; Vortex86 SoC detection code
call init_display
mov eax, [def_cursor]
mov [SLOT_BASE+APPDATA.cursor+sizeof.APPDATA], eax
mov [SLOT_BASE+APPDATA.cursor+sizeof.APPDATA*2], eax
mov [SLOT_BASE + APPDATA.cursor + sizeof.APPDATA], eax
mov [SLOT_BASE + APPDATA.cursor + sizeof.APPDATA*2], eax
; PRINT CPU FREQUENCY
@ -911,12 +911,12 @@ include "detect/vortex86.inc" ; Vortex86 SoC detection code
mov ebx, [hpet_base]
test ebx, ebx
jz @F
mov ebx, [ebx+HPET_COUNTER]
mov ebx, [ebx + HPET_COUNTER]
rdtsc
mov ecx, 1000
sub eax, [hpet_tsc_start]
sbb edx, [hpet_tsc_start+4]
sbb edx, [hpet_tsc_start + 4]
shld edx, eax, 10
shl eax, 10
mov esi, eax
@ -944,7 +944,7 @@ include "detect/vortex86.inc" ; Vortex86 SoC detection code
shl eax, 2
.next:
mov dword [cpu_freq], eax
mov dword [cpu_freq+4], edx
mov dword [cpu_freq + 4], edx
mov ebx, 1000000
div ebx
mov ebx, eax
@ -996,14 +996,14 @@ include "detect/vortex86.inc" ; Vortex86 SoC detection code
; Protect I/O permission 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
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, \
[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, \
[SLOT_BASE+sizeof.APPDATA+APPDATA.io_map+4], PG_READ
[SLOT_BASE + sizeof.APPDATA + APPDATA.io_map + 4], PG_READ
; SET KEYBOARD PARAMETERS
mov al, 0xf6 ; reset keyboard, scan enabled
@ -1098,7 +1098,7 @@ ap_init_high:
mov fs, cx
mov gs, bx
xor esp, esp
mov eax, sys_proc-OS_BASE+PROC.pdt_0
mov eax, sys_proc - OS_BASE + PROC.pdt_0
mov cr3, eax
lock inc [ap_initialized]
jmp idle_loop
@ -1145,18 +1145,18 @@ proc setup_os_slot
mov eax, tss+0x80
call get_pg_addr
inc eax
mov [edx+APPDATA.io_map], eax
mov [edx + APPDATA.io_map], eax
mov eax, tss+0x1080
call get_pg_addr
inc eax
mov [edx+APPDATA.io_map+4], eax
mov [edx + APPDATA.io_map + 4], eax
mov dword [edx+APPDATA.pl0_stack], ebx
lea edi, [ebx+RING0_STACK_SIZE]
mov dword [edx+APPDATA.fpu_state], edi
mov dword [edx+APPDATA.saved_esp0], edi
mov dword [edx+APPDATA.saved_esp], edi
mov dword [edx+APPDATA.terminate_protection], 1 ; make unkillable
mov dword [edx + APPDATA.pl0_stack], ebx
lea edi, [ebx + RING0_STACK_SIZE]
mov dword [edx + APPDATA.fpu_state], edi
mov dword [edx + APPDATA.saved_esp0], edi
mov dword [edx + APPDATA.saved_esp], edi
mov dword [edx + APPDATA.terminate_protection], 1 ; make unkillable
mov esi, fpu_data
mov ecx, [xsave_area_size]
@ -1164,24 +1164,24 @@ proc setup_os_slot
shr ecx, 2
rep movsd
lea eax, [edx+APP_EV_OFFSET]
mov dword [edx+APPDATA.fd_ev], eax
mov dword [edx+APPDATA.bk_ev], eax
lea eax, [edx + APP_EV_OFFSET]
mov dword [edx + APPDATA.fd_ev], eax
mov dword [edx + APPDATA.bk_ev], eax
lea eax, [edx+APP_OBJ_OFFSET]
mov dword [edx+APPDATA.fd_obj], eax
mov dword [edx+APPDATA.bk_obj], eax
lea eax, [edx + APP_OBJ_OFFSET]
mov dword [edx + APPDATA.fd_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
lea ebx, [edx+APPDATA.list]
lea ecx, [sys_proc+PROC.thr_list]
lea ebx, [edx + APPDATA.list]
lea ecx, [sys_proc + PROC.thr_list]
list_add_tail ebx, ecx
mov [edx+APPDATA.wnd_number], dh
mov byte [edx+APPDATA.tid], dh
mov [edx + APPDATA.wnd_number], dh
mov byte [edx + APPDATA.tid], dh
ret
endp
@ -1413,8 +1413,8 @@ display_number_force:
jne displnl1
mov ebp, ebx
add ebp, 4
mov ebp, [ebp+std_application_base_address]
mov ebx, [ebx+std_application_base_address]
mov ebp, [ebp + std_application_base_address]
mov ebx, [ebx + std_application_base_address]
displnl1:
sub esp, 64
@ -1546,14 +1546,14 @@ draw_num_text:
mov edi, [current_slot_idx]
mov ecx, edi
shl edi, 8
shl ecx, 5
shl edi, BSF sizeof.APPDATA
shl ecx, BSF sizeof.WDATA
mov eax, [ecx+window_data+WDATA.box.left]
add eax, [edi+SLOT_BASE+APPDATA.wnd_clientbox.left]
mov eax, [window_data + ecx + WDATA.box.left]
add eax, [SLOT_BASE + edi + APPDATA.wnd_clientbox.left]
shl eax, 16
add eax, [ecx+window_data+WDATA.box.top]
add eax, [edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
add eax, [window_data + ecx + WDATA.box.top]
add eax, [SLOT_BASE + edi + APPDATA.wnd_clientbox.top]
add ebx, eax
mov ecx, [esp+64+32-12+4]
mov eax, [esp+64+8] ; background color (if given)
@ -1906,12 +1906,12 @@ sys_end:
; kill all sockets this process owns
pusha
mov edx, [current_slot]
mov edx, [edx+APPDATA.tid]
mov edx, [edx + APPDATA.tid]
call socket_process_end
popa
;--------------------------------------
mov ecx, [current_slot]
mov eax, [ecx+APPDATA.tls_base]
mov eax, [ecx + APPDATA.tls_base]
test eax, eax
jz @F
@ -1919,7 +1919,7 @@ sys_end:
@@:
mov eax, [current_slot]
mov [eax+APPDATA.state], TSTATE_ZOMBIE
mov [eax + APPDATA.state], TSTATE_ZOMBIE
call wakeup_osloop
.waitterm: ; wait here for termination
@ -1931,16 +1931,16 @@ restore_default_cursor_before_killing:
pushfd
cli
mov eax, [def_cursor]
mov [ecx+APPDATA.cursor], eax
mov [ecx + APPDATA.cursor], eax
movzx eax, word [MOUSE_Y]
movzx ebx, word [MOUSE_X]
mov eax, [d_width_calc_area + eax*4]
add eax, [_display.win_map]
movzx edx, byte [ebx+eax]
movzx edx, byte [ebx + eax]
shl edx, BSF sizeof.APPDATA
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
mov esi, [SLOT_BASE + edx + APPDATA.cursor]
cmp esi, [current_cursor]
je @f
@ -2017,8 +2017,8 @@ sysfn_shutdown: ; 18.9 = system shutdown
; in: eax -- APPDATA ptr
; out: Z/z -- is/not kernel thread
is_kernel_thread:
mov eax, [eax+APPDATA.process]
cmp eax, [SLOT_BASE+2*sizeof.APPDATA+APPDATA.process] ; OS
mov eax, [eax + APPDATA.process]
cmp eax, [SLOT_BASE + 2*sizeof.APPDATA + APPDATA.process] ; OS
ret
;------------------------------------------------------------------------------
sysfn_terminate: ; 18.2 = TERMINATE
@ -2060,7 +2060,7 @@ sysfn_terminate: ; 18.2 = TERMINATE
shl ecx, 8
add ecx, SLOT_BASE
mov eax, [def_cursor]
cmp [ecx+APPDATA.cursor], eax
cmp [ecx + APPDATA.cursor], eax
je @f
call restore_default_cursor_before_killing
@@:
@ -2146,7 +2146,7 @@ sysfn_activate: ; 18.3 = ACTIVATE WINDOW
je .nowindowactivate; already active
mov edi, ecx
shl edi, 5
shl edi, BSF sizeof.WDATA
add edi, window_data
movzx esi, word [WIN_STACK + ecx * 2]
lea esi, [WIN_POS + esi * 2]
@ -2174,7 +2174,7 @@ sysfn_zmodif:
je .fail
mov eax, edx
shl edx, 5
shl edx, BSF sizeof.WDATA
cmp [edx*8 + SLOT_BASE + APPDATA.state], TSTATE_FREE
je .fail
@ -2182,7 +2182,7 @@ sysfn_zmodif:
cmp ecx, 1
jnz .set_zmod
mov al, [edx + window_data + WDATA.z_modif]
mov al, [window_data + edx + WDATA.z_modif]
jmp .exit
.set_zmod:
@ -2195,19 +2195,19 @@ sysfn_zmodif:
cmp bl, ZPOS_ALWAYS_TOP
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 ebx, [edx + window_data + WDATA.box.top]
mov ecx, [edx + window_data + WDATA.box.width]
mov edx, [edx + window_data + WDATA.box.height]
mov eax, [window_data + edx + WDATA.box.left]
mov ebx, [window_data + edx + WDATA.box.top]
mov ecx, [window_data + edx + WDATA.box.width]
mov edx, [window_data + edx + WDATA.box.height]
add ecx, eax
add edx, ebx
call window._.set_screen
call window._.set_top_wnd
call window._.redraw_top_wnd
shl esi, 5
shl esi, BSF sizeof.WDATA
mov [esi + window_data + WDATA.fl_redraw], 1
@ -2222,7 +2222,7 @@ sysfn_zmodif:
;------------------------------------------------------------------------------
sysfn_getidletime: ; 18.4 = GET IDLETIME
;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
ret
;------------------------------------------------------------------------------
@ -2323,7 +2323,7 @@ sysfn_centermouse: ; 18.15 = mouse centered
sysfn_mouse_acceleration: ; 18.19 = set/get mouse features
cmp ecx, 8
jnc @f
jmp dword [.table+ecx*4]
jmp dword [.table + ecx*4]
.get_mouse_acceleration:
xor eax, eax
mov ax, [mouse_speed_factor]
@ -2603,15 +2603,15 @@ sys_cpuusage:
mov ax, [WIN_POS + ecx * 2]
mov [ebx+6], ax
shl ecx, 8 ;5=32 8=256
shl ecx, BSF sizeof.APPDATA
; +0: dword: memory 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
; +10: 11 bytes: name of the process
push ecx
lea eax, [ecx+SLOT_BASE+APPDATA.app_name]
lea eax, [SLOT_BASE + ecx + APPDATA.app_name]
add ebx, 10
mov ecx, 11
call memmove
@ -2626,8 +2626,8 @@ sys_cpuusage:
mov edx, 0x100000*16
cmp ecx, 1 shl 5
je .os_mem
mov edx, [SLOT_BASE+ecx*8+APPDATA.process]
mov edx, [edx+PROC.mem_used]
mov edx, [SLOT_BASE + ecx*8 + APPDATA.process]
mov edx, [edx + PROC.mem_used]
mov eax, std_application_base_address
.os_mem:
stosd
@ -2635,38 +2635,38 @@ sys_cpuusage:
stosd
; +30: PID/TID
mov eax, [ecx*8 + SLOT_BASE + APPDATA.tid]
mov eax, [SLOT_BASE + ecx*8 + APPDATA.tid]
stosd
; window position and size
push esi
lea esi, [ecx + window_data + WDATA.box]
lea esi, [window_data + ecx + WDATA.box]
movsd
movsd
movsd
movsd
; Process state (+50)
movzx eax, byte [ecx*8 + SLOT_BASE + APPDATA.state]
movzx eax, byte [SLOT_BASE + ecx*8 + APPDATA.state]
stosd
; 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
; Window state
mov al, [ecx+window_data+WDATA.fl_wstate]
mov al, [window_data + ecx + WDATA.fl_wstate]
stosb
; Event mask (+71)
mov EAX, dword [ecx*8 + SLOT_BASE + APPDATA.event_mask]
mov EAX, dword [SLOT_BASE + ecx*8 + APPDATA.event_mask]
stosd
; Keyboard mode (+75)
mov al, byte [ecx*8 + SLOT_BASE + APPDATA.keyboard_mode]
mov al, byte [SLOT_BASE + ecx*8 + APPDATA.keyboard_mode]
stosb
pop esi
@ -2728,7 +2728,7 @@ sys_redrawstat:
jnz srl1
mov edx, [current_slot_idx] ; return whole screen draw area for this app
shl edx, 5
shl edx, 5 ;?
add edx, draw_data
mov [edx + RECT.left], 0
mov [edx + RECT.top], 0
@ -2770,7 +2770,7 @@ sheduler:
endg
sys_sheduler:
;rewritten by <Lrz> 29.12.2009
jmp dword [sheduler+ebx*4]
jmp dword [sheduler + ebx*4]
;.shed_counter:
.00:
mov eax, [context_counter]
@ -2906,7 +2906,7 @@ align 4
.set_mouse_event:
add edi, sizeof.APPDATA
add ebx, sizeof.WDATA
test [edi + SLOT_BASE + APPDATA.event_mask], 0x80000000
test [SLOT_BASE + edi + APPDATA.event_mask], 0x80000000
jz .pos_filter
cmp edi, [esp] ; skip if filtration active
@ -2914,7 +2914,7 @@ align 4
;--------------------------------------
align 4
.pos_filter:
test [edi + SLOT_BASE + APPDATA.event_mask], 0x40000000
test [SLOT_BASE + edi + APPDATA.event_mask], 0x40000000
jz .set
mov esi, [ebx + WDATA.box.left]
@ -2933,7 +2933,7 @@ align 4
;--------------------------------------
align 4
.set:
or [edi+SLOT_BASE+APPDATA.occurred_events], EVENT_MOUSE
or [SLOT_BASE + edi + APPDATA.occurred_events], EVENT_MOUSE
;--------------------------------------
align 4
.skip:
@ -2951,14 +2951,14 @@ mouse_not_active:
;--------------------------------------
align 4
backgr:
mov eax, [draw_data+32 + RECT.left]
mov eax, [draw_data + 32 + RECT.left]
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 eax, [draw_data+32 + RECT.top]
mov eax, [draw_data + 32 + RECT.top]
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]
call drawbackground
@ -2975,33 +2975,33 @@ set_bgr_event:
add edi, sizeof.APPDATA
mov eax, [BG_Rect_X_left_right]
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
.join:
cmp word [edi+SLOT_BASE+APPDATA.draw_bgr_x], ax
cmp word [SLOT_BASE + edi + APPDATA.draw_bgr_x], ax
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
cmp word [edi+SLOT_BASE+APPDATA.draw_bgr_x+2], ax
cmp word [SLOT_BASE + edi + APPDATA.draw_bgr_x + 2], ax
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
mov word [edi+SLOT_BASE+APPDATA.draw_bgr_y], dx
mov word [SLOT_BASE + edi + APPDATA.draw_bgr_y], dx
@@:
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
mov word [edi+SLOT_BASE+APPDATA.draw_bgr_y+2], dx
mov word [SLOT_BASE + edi + APPDATA.draw_bgr_y+2], dx
@@:
jmp .common
.set:
mov [edi+SLOT_BASE+APPDATA.draw_bgr_x], eax
mov [edi+SLOT_BASE+APPDATA.draw_bgr_y], edx
mov [SLOT_BASE + edi + APPDATA.draw_bgr_x], eax
mov [SLOT_BASE + edi + APPDATA.draw_bgr_y], edx
.common:
or [edi+SLOT_BASE+APPDATA.occurred_events], EVENT_BACKGROUND
or [SLOT_BASE + edi + APPDATA.occurred_events], EVENT_BACKGROUND
loop set_bgr_event
pop edi ecx
;--------- set event 5 stop -----------
@ -3009,10 +3009,10 @@ set_bgr_event:
jnz backgr
xor eax, eax
mov [draw_data+32 + RECT.left], eax
mov [draw_data+32 + RECT.top], eax
mov [draw_data+32 + RECT.right], eax
mov [draw_data+32 + RECT.bottom], eax
mov [draw_data + 32 + RECT.left], eax
mov [draw_data + 32 + RECT.top], eax
mov [draw_data + 32 + RECT.right], eax
mov [draw_data + 32 + RECT.bottom], eax
;--------------------------------------
align 4
nobackgr:
@ -3034,7 +3034,7 @@ markz:
push ecx edx
cmp [edx + APPDATA.state], TSTATE_FREE
jz .nokill
cmp [edx+APPDATA.process], sys_proc
cmp [edx + APPDATA.process], sys_proc
jz .nokill
call request_terminate
jmp .common
@ -3066,15 +3066,15 @@ noshutdown:
align 4
newct:
mov cl, [ebx]
cmp cl, byte 3
cmp cl, TSTATE_ZOMBIE
jz .terminate
cmp cl, byte 4
cmp cl, TSTATE_TERMINATING
jnz .noterminate
.terminate:
pushad
mov ecx, eax
shl ecx, 8
shl ecx, BSF sizeof.APPDATA
add ecx, SLOT_BASE
call restore_default_cursor_before_killing
popad
@ -3113,7 +3113,7 @@ newdw2:
push ecx
mov eax, ecx
shl eax, 5
shl eax, BSF sizeof.WDATA
add eax, window_data
cmp eax, [esp+4]
@ -3167,9 +3167,9 @@ bgli:
jz .az
mov dl, 0
lea eax, [edi+draw_data-window_data]
lea eax, [edi + draw_data - window_data]
mov ebx, [draw_limits.left]
cmp ebx, [eax+RECT.left]
cmp ebx, [eax + RECT.left]
jae @f
mov [eax+RECT.left], ebx
@ -3178,16 +3178,16 @@ bgli:
align 4
@@:
mov ebx, [draw_limits.top]
cmp ebx, [eax+RECT.top]
cmp ebx, [eax + RECT.top]
jae @f
mov [eax+RECT.top], ebx
mov [eax + RECT.top], ebx
mov dl, 1
;--------------------------------------
align 4
@@:
mov ebx, [draw_limits.right]
cmp ebx, [eax+RECT.right]
cmp ebx, [eax + RECT.right]
jbe @f
mov [eax+RECT.right], ebx
@ -3196,10 +3196,10 @@ align 4
align 4
@@:
mov ebx, [draw_limits.bottom]
cmp ebx, [eax+RECT.bottom]
cmp ebx, [eax + RECT.bottom]
jbe @f
mov [eax+RECT.bottom], ebx
mov [eax + RECT.bottom], ebx
mov dl, 1
;--------------------------------------
align 4
@ -3312,7 +3312,7 @@ calculatebackground: ; background
mov ecx, [_display.win_map_size]
shr ecx, 2
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
ret
;-----------------------------------------------------------------------------
@ -3591,7 +3591,7 @@ no_unmask_io:
shl eax, 4
add eax, RESERVED_PORTS
mov ebx, [current_slot]
mov ebx, [ebx+APPDATA.tid]
mov ebx, [ebx + APPDATA.tid]
mov [eax], ebx
mov [eax+4], ecx
mov [eax+8], edx
@ -3606,7 +3606,7 @@ free_port_area:
test eax, eax
jz frpal2
mov ebx, [current_slot]
mov ebx, [ebx+APPDATA.tid]
mov ebx, [ebx + APPDATA.tid]
frpal3:
mov edi, eax
shl edi, 4
@ -3704,9 +3704,9 @@ align 4
align 4
@@:
mov edi, [current_slot]
add dx, word[edi+APPDATA.wnd_clientbox.top]
add dx, word[edi + APPDATA.wnd_clientbox.top]
rol edx, 16
add dx, word[edi+APPDATA.wnd_clientbox.left]
add dx, word[edi + APPDATA.wnd_clientbox.left]
rol edx, 16
;--------------------------------------
align 4
@ -3741,9 +3741,9 @@ sys_putimage_palette:
mov eax, [current_slot_idx]
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
add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.left]
add dx, word [SLOT_BASE + eax + APPDATA.wnd_clientbox.left]
rol edx, 16
;--------------------------------------
align 4
@ -3881,7 +3881,7 @@ putimage_get8bpp:
movzx eax, byte [esi]
push edx
mov edx, [esp+8]
mov eax, [edx+eax*4]
mov eax, [edx + eax*4]
pop edx
inc esi
ret 4
@ -3953,7 +3953,7 @@ putimage_get2bpp:
mov [edx], ah
mov edx, [edx+4]
movzx eax, al
mov eax, [edx+eax*4]
mov eax, [edx + eax*4]
pop edx
ret 4
;-----------------------------------------------------------------------------
@ -3978,7 +3978,7 @@ putimage_get4bpp:
movzx eax, byte [edx+1]
mov edx, [edx+4]
and eax, 0x0F
mov eax, [edx+eax*4]
mov eax, [edx + eax*4]
pop edx
ret 4
@@:
@ -3987,7 +3987,7 @@ putimage_get4bpp:
mov [edx+1], al
shr eax, 4
mov edx, [edx+4]
mov eax, [edx+eax*4]
mov eax, [edx + eax*4]
pop edx
ret 4
;-----------------------------------------------------------------------------
@ -4293,7 +4293,7 @@ sys_process_def:
jae .not_support ;if >=8 then or eax,-1
mov edi, [current_slot_idx]
jmp dword [f66call+ebx*4]
jmp dword [f66call + ebx*4]
.not_support:
or eax, -1
@ -4301,15 +4301,15 @@ sys_process_def:
;-----------------------------------------------------------------------------
align 4
.1:
shl edi, 8
mov [edi+SLOT_BASE + APPDATA.keyboard_mode], cl
shl edi, BSF sizeof.APPDATA
mov [SLOT_BASE + edi + APPDATA.keyboard_mode], cl
ret
;-----------------------------------------------------------------------------
align 4
.2: ; 2 = get keyboard mode
shl edi, 8
movzx eax, byte [SLOT_BASE+edi + APPDATA.keyboard_mode]
shl edi, BSF sizeof.APPDATA
movzx eax, byte [SLOT_BASE + edi + APPDATA.keyboard_mode]
mov [esp+32], eax
ret
;-----------------------------------------------------------------------------
@ -4391,7 +4391,7 @@ align 4
; get current PID
mov eax, [current_slot_idx]
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
mov [PID_lock_input], eax
@@:
@ -4406,7 +4406,7 @@ align 4
; get current PID
mov ebx, [current_slot_idx]
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
cmp ebx, eax
jne @f
@ -4439,7 +4439,7 @@ sys_gs: ; direct screen access
dec ebx
cmp ebx, 2
ja .not_support
jmp dword [f61call+ebx*4]
jmp dword [f61call + ebx*4]
.not_support:
or [esp+32], dword -1
ret
@ -4482,7 +4482,7 @@ syscall_cdaudio:
mov eax, ecx
shr eax, 2
lea eax, [eax*5]
mov al, [eax+DRIVE_DATA+1]
mov al, [eax + DRIVE_DATA + 1]
push ecx ebx
mov ebx, ecx

View File

@ -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. ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -52,23 +52,7 @@
; 0018 dword color of frames
; 001C dword window flags, +30 = window drawn, +31 redraw flag
;
; 3000 -> 4FFF task list - 256 entries
;
; 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
;
; 3000 -> 4FFF free
;
; 5000 -> 68FF free (6k6)
; 6900 -> 6EFF saved picture under mouse pointer (1k5)

View File

@ -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. ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -17,12 +17,12 @@ create_futex:
test eax, eax
jz .fail
mov [eax+FUTEX.magic], 'FUTX'
mov [eax+FUTEX.destroy], 0
mov [eax+FUTEX.pointer], ecx
lea ecx, [eax+FUTEX.wait_list]
mov [eax + FUTEX.magic], 'FUTX'
mov [eax + FUTEX.destroy], 0
mov [eax + FUTEX.pointer], ecx
lea ecx, [eax + FUTEX.wait_list]
list_init ecx
mov [eax+FUTEX.flags], 0
mov [eax + FUTEX.flags], 0
.fail:
ret
@ -31,19 +31,19 @@ align 4
destroy_futex:
push esi
mov esi, [current_process]
mov edx, [ecx+FUTEX.handle]
mov edx, [ecx + FUTEX.handle]
pushfd
cli
lea eax, [ecx+FUTEX.wait_list]
cmp eax, [eax+LHEAD.next]
lea eax, [ecx + FUTEX.wait_list]
cmp eax, [eax + LHEAD.next]
jne .fail
mov eax, [esi+PROC.ht_next]
mov [esi+PROC.htab+edx*4], eax
mov [esi+PROC.ht_next], edx
inc [esi+PROC.ht_free]
mov eax, [esi + PROC.ht_next]
mov [esi + PROC.htab + edx*4], eax
mov [esi + PROC.ht_next], edx
inc [esi + PROC.ht_free]
popfd
pop esi
@ -67,21 +67,21 @@ sys_futex:
jae .fail
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
cmp [ebp+FUTEX.handle], ecx
cmp [ebp + FUTEX.handle], ecx
jne .fail
jmp dword [sys_futex_call+ebx*4-4]
jmp dword [sys_futex_call + ebx*4-4]
.fail:
.requeue:
.cmp_requeue:
.wait_bitset:
.wake_bitset:
mov [esp+SYSCALL_STACK._eax], -1
mov [esp + SYSCALL_STACK._eax], -1
ret
align 4
@ -89,9 +89,9 @@ align 4
call create_futex
test eax, eax
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
align 4
@ -101,7 +101,7 @@ align 4
.destroy:
mov ecx, ebp
call destroy_futex
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
align 4
@ -113,12 +113,12 @@ align 4
.wait:
test esi, esi
jnz .wait_timeout
mov ecx, [ebp+FUTEX.pointer]
mov ecx, [ebp + FUTEX.pointer]
mov eax, edx
lock cmpxchg [ecx], edx
je .wait_slow
mov [esp+SYSCALL_STACK._eax], -2
mov [esp + SYSCALL_STACK._eax], -2
ret
.wait_slow:
@ -127,8 +127,8 @@ align 4
sub esp, sizeof.MUTEX_WAITER
mov ebx, [current_slot]
mov [esp+MUTEX_WAITER.task], ebx
lea esi, [ebp+FUTEX.wait_list]
mov [esp + MUTEX_WAITER.task], ebx
lea esi, [ebp + FUTEX.wait_list]
list_add_tail esp, esi ;esp= new waiter, esi= list head
mov eax, edx
@ -143,7 +143,7 @@ align 4
add esp, sizeof.MUTEX_WAITER
popfd
mov [esp+SYSCALL_STACK._eax], 0
mov [esp + SYSCALL_STACK._eax], 0
ret
align 4
@ -154,12 +154,12 @@ align 4
;ebp futex object
.wait_timeout:
mov ecx, [ebp+FUTEX.pointer]
mov ecx, [ebp + FUTEX.pointer]
mov eax, edx
lock cmpxchg [ecx], edx ;wait until old_value == new_value
je .wait_slow_timeout
mov [esp+SYSCALL_STACK._eax], -2
mov [esp + SYSCALL_STACK._eax], -2
ret
align 4
@ -174,21 +174,21 @@ align 4
sub esp, sizeof.MUTEX_WAITER
mov ebx, [current_slot]
mov [ebx+APPDATA.wait_test], sys_futex.wait_test
mov [ebx+APPDATA.wait_timeout], esi
mov [ebx+APPDATA.wait_param], ebp
mov [ebx + APPDATA.wait_test], sys_futex.wait_test
mov [ebx + APPDATA.wait_timeout], esi
mov [ebx + APPDATA.wait_param], ebp
mov eax, [timer_ticks]
mov [ebx+APPDATA.wait_begin], eax
mov [ebx + APPDATA.wait_begin], eax
mov [ebx + APPDATA.state], TSTATE_WAITING
mov [esp+MUTEX_WAITER.task], ebx
lea esi, [ebp+FUTEX.wait_list]
mov [esp + MUTEX_WAITER.task], ebx
lea esi, [ebp + FUTEX.wait_list]
list_add_tail esp, esi ;esp= new waiter, esi= list head
.again_timeout:
call change_task
mov eax, [ebx+APPDATA.wait_param]
mov eax, [ebx + APPDATA.wait_param]
test eax, eax
jz .timeout
@ -200,7 +200,7 @@ align 4
add esp, sizeof.MUTEX_WAITER
popfd
mov [esp+SYSCALL_STACK._eax], 0
mov [esp + SYSCALL_STACK._eax], 0
ret
.timeout:
@ -208,7 +208,7 @@ align 4
add esp, sizeof.MUTEX_WAITER
popfd
mov [esp+SYSCALL_STACK._eax], -1
mov [esp + SYSCALL_STACK._eax], -1
ret
@ -224,21 +224,21 @@ align 4
pushfd
cli
lea ebx, [ebp+FUTEX.wait_list]
mov esi, [ebx+LHEAD.next]
lea ebx, [ebp + FUTEX.wait_list]
mov esi, [ebx + LHEAD.next]
.again_wake:
cmp esi, ebx
je .done
mov eax, [esi+MUTEX_WAITER.task]
mov eax, [esi + MUTEX_WAITER.task]
mov [eax + APPDATA.state], TSTATE_RUNNING
mov esi, [esi+MUTEX_WAITER.list.next]
mov esi, [esi + MUTEX_WAITER.list.next]
inc ecx
cmp ecx, edx
jb .again_wake
.done:
popfd
mov [esp+SYSCALL_STACK._eax], ecx
mov [esp + SYSCALL_STACK._eax], ecx
ret

View File

@ -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. ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -72,50 +72,50 @@ sys_pipe2:
test eax, eax
jz .err_3
mov [ebp+PIPE.pipe_ops], pipe_file_ops
mov [ebp+PIPE.buffer], eax
mov [ebp + PIPE.pipe_ops], pipe_file_ops
mov [ebp + PIPE.buffer], eax
xor eax, eax
mov [ebp+PIPE.count], eax
mov [ebp+PIPE.read_end], eax
mov [ebp+PIPE.write_end], eax
mov [ebp + PIPE.count], eax
mov [ebp + PIPE.read_end], eax
mov [ebp + PIPE.write_end], eax
inc eax
mov [ebp+PIPE.readers], eax
mov [ebp+PIPE.writers], eax
mov [ebp + PIPE.readers], eax
mov [ebp + PIPE.writers], eax
lea ecx, [ebp+PIPE.pipe_lock]
lea ecx, [ebp + PIPE.pipe_lock]
call mutex_init
lea ecx, [ebp+PIPE.rlist]
lea ecx, [ebp + PIPE.rlist]
list_init ecx
lea ecx, [ebp+PIPE.wlist]
lea ecx, [ebp + PIPE.wlist]
list_init ecx
mov eax, [.fdread]
mov edx, [.fdwrite]
mov ecx, [.pipefd]
mov [eax+FILED.magic], 'PIPE'
mov [eax+FILED.destroy], 0
mov [eax+FILED.mode], F_READ
mov [eax+FILED.file], ebp
mov [eax + FILED.magic], 'PIPE'
mov [eax + FILED.destroy], 0
mov [eax + FILED.mode], F_READ
mov [eax + FILED.file], ebp
mov [edx+FILED.magic], 'PIPE'
mov [edx+FILED.destroy], 0
mov [edx+FILED.mode], F_WRITE
mov [edx+FILED.file], ebp
mov [edx + FILED.magic], 'PIPE'
mov [edx + FILED.destroy], 0
mov [edx + FILED.mode], F_WRITE
mov [edx + FILED.file], ebp
mov eax, [eax+FILED.handle]
mov edx, [edx+FILED.handle]
mov eax, [eax + FILED.handle]
mov edx, [edx + FILED.handle]
mov [ecx], eax
mov [ecx+4], edx
add esp, 5*4
pop ebp
xor eax, eax
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
.err_3:
mov eax, ebp
@ -132,7 +132,7 @@ sys_pipe2:
.fail:
mov eax, ebp
pop ebp
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
purge .pipeflags
@ -151,14 +151,14 @@ pipe_read:
mov edi, edx
lea ecx, [ebp+PIPE.pipe_lock]
lea ecx, [ebp + PIPE.pipe_lock]
call mutex_lock
.again:
xor eax, eax
cmp eax, [ebp+PIPE.writers]
cmp eax, [ebp + PIPE.writers]
je .eof
mov ecx, [ebp+PIPE.count]
mov ecx, [ebp + PIPE.count]
test ecx, ecx
jz .wait
@ -167,33 +167,33 @@ pipe_read:
jb .read
mov ecx, esi
.read:
mov esi, [ebp+PIPE.buffer]
add esi, [ebp+PIPE.read_end]
mov [esp+SYSCALL_STACK._eax], ecx
sub [ebp+PIPE.count], ecx
mov esi, [ebp + PIPE.buffer]
add esi, [ebp + PIPE.read_end]
mov [esp + SYSCALL_STACK._eax], ecx
sub [ebp + PIPE.count], ecx
cld
rep movsb
and esi, 0xFFF
mov [ebp+PIPE.read_end], esi
mov [ebp + PIPE.read_end], esi
lea ecx, [ebp+PIPE.wlist]
cmp ecx, [ebp+PIPE.wlist.next]
lea ecx, [ebp + PIPE.wlist]
cmp ecx, [ebp + PIPE.wlist.next]
je @F
mov ecx, [ecx+MUTEX_WAITER.task]
mov ecx, [ecx + MUTEX_WAITER.task]
mov [ecx + APPDATA.state], TSTATE_RUNNING ;activate writer task
@@:
cmp [ebp+PIPE.count], 0
cmp [ebp + PIPE.count], 0
je @F
lea eax, [ebp+PIPE.rlist]
cmp eax, [ebp+PIPE.rlist.next]
lea eax, [ebp + PIPE.rlist]
cmp eax, [ebp + PIPE.rlist.next]
je @F
mov eax, [eax+MUTEX_WAITER.task]
mov eax, [eax + MUTEX_WAITER.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
ret
@ -203,18 +203,18 @@ pipe_read:
sub esp, sizeof.MUTEX_WAITER
mov ebx, [current_slot]
mov [esp+MUTEX_WAITER.task], ebx
lea edx, [ebp+PIPE.rlist]
mov [esp + MUTEX_WAITER.task], ebx
lea edx, [ebp + PIPE.rlist]
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
mov [ebx + APPDATA.state], TSTATE_RUN_SUSPENDED
call change_task
lea ecx, [ebp+PIPE.pipe_lock]
lea ecx, [ebp + PIPE.pipe_lock]
call mutex_lock
list_del esp
@ -223,8 +223,8 @@ pipe_read:
jmp .again
.eof:
mov [esp+SYSCALL_STACK._eax], eax
lea ecx, [ebp+PIPE.pipe_lock]
mov [esp + SYSCALL_STACK._eax], eax
lea ecx, [ebp + PIPE.pipe_lock]
call mutex_unlock
ret
@ -241,15 +241,15 @@ pipe_write:
mov ebx, esi ;ebx = write count
mov esi, edx ;esi = src
lea ecx, [ebp+PIPE.pipe_lock]
lea ecx, [ebp + PIPE.pipe_lock]
call mutex_lock
.again:
xor eax, eax
cmp eax, [ebp+PIPE.readers]
cmp eax, [ebp + PIPE.readers]
je .epipe
mov ecx, 4096
sub ecx, [ebp+PIPE.count]
sub ecx, [ebp + PIPE.count]
jz .wait ;wait if buffer full
.check_count:
@ -257,47 +257,47 @@ pipe_write:
jb .write
mov ecx, ebx
.write:
mov edi, [ebp+PIPE.buffer]
add edi, [ebp+PIPE.write_end]
mov edi, [ebp + PIPE.buffer]
add edi, [ebp + PIPE.write_end]
add [.written], ecx
sub ebx, ecx
add [ebp+PIPE.count], ecx
add [ebp + PIPE.count], ecx
cld
rep movsb
and edi, 0xFFF
mov [ebp+PIPE.write_end], edi
mov [ebp + PIPE.write_end], edi
pushfd
cli
lea eax, [ebp+PIPE.rlist]
cmp eax, [ebp+PIPE.rlist.next]
lea eax, [ebp + PIPE.rlist]
cmp eax, [ebp + PIPE.rlist.next]
je @F
mov eax, [eax+MUTEX_WAITER.task]
mov eax, [eax + MUTEX_WAITER.task]
mov [eax + APPDATA.state], TSTATE_RUNNING ;activate reader task
@@:
cmp [ebp+PIPE.count], 4096
cmp [ebp + PIPE.count], 4096
je @F
lea ecx, [ebp+PIPE.wlist]
cmp ecx, [ebp+PIPE.wlist.next]
lea ecx, [ebp + PIPE.wlist]
cmp ecx, [ebp + PIPE.wlist.next]
je @F
mov ecx, [eax+MUTEX_WAITER.task]
mov ecx, [eax + MUTEX_WAITER.task]
mov [ecx + APPDATA.state], TSTATE_RUNNING ;activate writer task
@@:
popfd
lea ecx, [ebp+PIPE.pipe_lock]
lea ecx, [ebp + PIPE.pipe_lock]
call mutex_unlock
test ebx, ebx
jnz .again
pop eax ; written
mov [esp+SYSCALL_STACK._eax], eax
mov [esp + SYSCALL_STACK._eax], eax
ret
.wait:
@ -306,18 +306,18 @@ pipe_write:
sub esp, sizeof.MUTEX_WAITER
mov ecx, [current_slot]
mov [esp+MUTEX_WAITER.task], ecx
mov [esp + MUTEX_WAITER.task], ecx
lea edx, [ebp+PIPE.wlist]
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
mov [ecx + APPDATA.state], TSTATE_RUN_SUSPENDED
call change_task
lea ecx, [ebp+PIPE.pipe_lock]
lea ecx, [ebp + PIPE.pipe_lock]
call mutex_lock
list_del esp
@ -326,14 +326,14 @@ pipe_write:
jmp .again
.epipe:
lea ecx, [ebp+PIPE.pipe_lock]
lea ecx, [ebp + PIPE.pipe_lock]
call mutex_unlock
add esp, 4
mov [esp+SYSCALL_STACK._eax], -EPIPE
mov [esp + SYSCALL_STACK._eax], -EPIPE
ret
align 4
pipe_close:
mov [esp+SYSCALL_STACK._eax], -EBADF
mov [esp + SYSCALL_STACK._eax], -EBADF
ret

View File

@ -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. ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -58,13 +58,13 @@ endg
align 4
sys_posix:
cmp ebx, (sys_posix_call.end-sys_posix_call)/4
cmp ebx, (sys_posix_call.end - sys_posix_call)/4
jae .fail
jmp dword [sys_posix_call+ebx*4]
jmp dword [sys_posix_call + ebx*4]
.fail:
mov [esp+SYSCALL_STACK._eax], -EBADF
mov [esp + SYSCALL_STACK._eax], -EBADF
ret
@ -81,21 +81,21 @@ sys_read:
jae .fail
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
cmp [ebp+FILED.handle], ecx
cmp [ebp + FILED.handle], ecx
jne .fail
test [ebp+FILED.mode], F_READ
test [ebp + FILED.mode], F_READ
jz .fail
mov ebp, [ebp+FILED.file]
mov ebp, [ebp + FILED.file]
mov eax, [ebp]
jmp dword [eax+FILEOP_READ*4]
jmp dword [eax + FILEOP_READ*4]
.fail:
mov [esp+SYSCALL_STACK._eax], -EBADF
mov [esp + SYSCALL_STACK._eax], -EBADF
ret
;ssize_t write(int fd, const void *buf, size_t count);
@ -111,19 +111,19 @@ sys_write:
jae .fail
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
cmp [ebp+FILED.handle], ecx
cmp [ebp + FILED.handle], ecx
jne .fail
test [ebp+FILED.mode], F_WRITE
test [ebp + FILED.mode], F_WRITE
jz .fail
mov ebp, [ebp+FILED.file]
mov ebp, [ebp + FILED.file]
mov eax, [ebp]
jmp dword [eax+FILEOP_WRITE*4]
jmp dword [eax + FILEOP_WRITE*4]
.fail:
mov [esp+SYSCALL_STACK._eax], -EBADF
mov [esp + SYSCALL_STACK._eax], -EBADF
ret

View File

@ -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 ;;
;; ;;
;; PLAYNOTE.INC version 1.1 22 November 2003 ;;

View File

@ -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. ;;
;; Version 2, or (at your option) any later version. ;;
;; ;;

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -41,10 +41,10 @@ block_clip:
push ebx
mov eax, [edi+RECT.left]
mov ebx, [edi+RECT.right]
mov ecx, [esi+RECT.left] ;clip.left
mov edx, [esi+RECT.right] ;clip.right
mov eax, [edi + RECT.left]
mov ebx, [edi + RECT.right]
mov ecx, [esi + RECT.left] ;clip.left
mov edx, [esi + RECT.right] ;clip.right
cmp eax, edx ;left >= clip.right
jge .fail
@ -55,17 +55,17 @@ block_clip:
cmp eax, ecx ;left >= clip.left
jge @F
mov [edi+RECT.left], ecx
mov [edi + RECT.left], ecx
@@:
cmp ebx, edx ;right <= clip.right
jle @f
mov [edi+RECT.right], edx
mov [edi + RECT.right], edx
@@:
mov eax, [edi+RECT.top]
mov ebx, [edi+RECT.bottom]
mov ecx, [esi+RECT.top] ;clip.top
mov edx, [esi+RECT.bottom] ;clip.bottom
mov eax, [edi + RECT.top]
mov ebx, [edi + RECT.bottom]
mov ecx, [esi + RECT.top] ;clip.top
mov edx, [esi + RECT.bottom] ;clip.bottom
cmp eax, edx ;top >= clip.bottom
jge .fail
@ -76,12 +76,12 @@ block_clip:
cmp eax, ecx ;top >= clip.top
jge @F
mov [edi+RECT.top], ecx
mov [edi + RECT.top], ecx
@@:
cmp ebx, edx ;bottom <= clip.bottom
jle @f
mov [edi+RECT.bottom], edx
mov [edi + RECT.bottom], edx
@@:
pop ebx
clc
@ -115,67 +115,67 @@ blit_clip:
sub esp, 40
mov ebx, ecx
mov edx, [ecx+BLITTER.src_x]
mov edx, [ecx + BLITTER.src_x]
mov [esp+.sx0], edx
mov eax, [ecx+BLITTER.src_y]
mov eax, [ecx + BLITTER.src_y]
mov [esp+.sy0], eax
add edx, [ecx+BLITTER.w]
add eax, [ecx+BLITTER.h]
mov [esp+.sx1], edx
mov [esp+.sy1], eax
add edx, [ecx + BLITTER.w]
add eax, [ecx + BLITTER.h]
mov [esp + .sx1], edx
mov [esp + .sy1], eax
lea edi, [esp+.sx0]
lea esi, [ebx+BLITTER.sc]
lea edi, [esp + .sx0]
lea esi, [ebx + BLITTER.sc]
call block_clip
jc .done
mov edi, [esp+.sx0]
mov edx, [ebx+BLITTER.dst_x]
mov edi, [esp + .sx0]
mov edx, [ebx + BLITTER.dst_x]
add edx, edi
sub edx, [ebx+BLITTER.src_x]
mov [esp+.dx0], edx
sub edx, [ebx + BLITTER.src_x]
mov [esp + .dx0], edx
mov ecx, [esp+.sy0]
mov eax, [ebx+BLITTER.dst_y]
mov eax, [ebx + BLITTER.dst_y]
add eax, ecx
sub eax, [ebx+BLITTER.src_y]
mov [esp+.dy0], eax
sub eax, [ebx + BLITTER.src_y]
mov [esp + .dy0], eax
sub edx, edi
add edx, [esp+.sx1]
mov [esp+.dx1], edx
add edx, [esp + .sx1]
mov [esp + .dx1], edx
sub eax, ecx
add eax, [esp+.sy1]
mov [esp+.dy1], eax
add eax, [esp + .sy1]
mov [esp + .dy1], eax
lea edi, [esp+.dx0]
lea esi, [ebx+BLITTER.dc]
lea edi, [esp + .dx0]
lea esi, [ebx + BLITTER.dc]
call block_clip
jc .done
mov edx, [esp+.dx0]
mov eax, [esp+.dx1]
mov edx, [esp + .dx0]
mov eax, [esp + .dx1]
sub eax, edx
mov [ebx+BLITTER.w], eax
mov [ebx + BLITTER.w], eax
mov eax, [esp+.dy0]
mov ecx, [esp+.dy1]
mov eax, [esp + .dy0]
mov ecx, [esp + .dy1]
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
sub ecx, [ebx+BLITTER.dst_x]
mov [ebx+BLITTER.src_x], ecx
sub ecx, [ebx + BLITTER.dst_x]
mov [ebx + BLITTER.src_x], ecx
mov ecx, [ebx+BLITTER.src_y]
mov ecx, [ebx + BLITTER.src_y]
add ecx, eax
sub ecx, [ebx+BLITTER.dst_y]
mov [ebx+BLITTER.src_y], ecx
mov [ebx+BLITTER.dst_x], edx
mov [ebx+BLITTER.dst_y], eax
sub ecx, [ebx + BLITTER.dst_y]
mov [ebx + BLITTER.src_y], ecx
mov [ebx + BLITTER.dst_x], edx
mov [ebx + BLITTER.dst_y], eax
clc
.done:
add esp, 40
@ -211,64 +211,64 @@ virtual at sizeof.BLITTER
end virtual
sub esp, .local_vars_size
mov [esp+.flags], ebx
mov [esp + .flags], ebx
mov eax, [current_slot_idx]
shl eax, 5 ; sizeof.WDATA
mov ebx, [eax + window_data + WDATA.box.width]
mov edx, [eax + window_data + WDATA.box.height]
shl eax, BSF sizeof.WDATA
mov ebx, [window_data + eax + WDATA.box.width]
mov edx, [window_data + eax + WDATA.box.height]
inc ebx
inc edx
xor eax, eax
mov [esp+BLITTER.dc.left], eax
mov [esp+BLITTER.dc.top], eax
mov [esp+BLITTER.dc.right], ebx
mov [esp+BLITTER.dc.bottom], edx
mov [esp + BLITTER.dc.left], eax
mov [esp + BLITTER.dc.top], eax
mov [esp + BLITTER.dc.right], ebx
mov [esp + BLITTER.dc.bottom], edx
mov [esp+BLITTER.sc.left], eax
mov [esp+BLITTER.sc.top], eax
mov [esp + BLITTER.sc.left], eax
mov [esp + BLITTER.sc.top], eax
mov eax, [ecx+24]
mov [esp+BLITTER.sc.right], eax
mov [esp + BLITTER.sc.right], eax
mov eax, [ecx+28]
mov [esp+BLITTER.sc.bottom], eax
mov [esp + BLITTER.sc.bottom], eax
mov eax, [ecx]
mov [esp+BLITTER.dst_x], eax
mov [esp + BLITTER.dst_x], eax
mov eax, [ecx+4]
mov [esp+BLITTER.dst_y], eax
mov [esp + BLITTER.dst_y], eax
mov eax, [ecx+16]
mov [esp+BLITTER.src_x], eax
mov [esp + BLITTER.src_x], eax
mov eax, [ecx+20]
mov [esp+BLITTER.src_y], eax
mov [esp + BLITTER.src_y], eax
mov eax, [ecx+8]
mov [esp+BLITTER.w], eax
mov [esp + BLITTER.w], eax
mov eax, [ecx+12]
mov [esp+BLITTER.h], eax
mov [esp + BLITTER.h], eax
mov eax, [ecx+32]
mov [esp+BLITTER.bitmap], eax
mov [esp + BLITTER.bitmap], eax
mov eax, [ecx+36]
mov [esp+BLITTER.stride], eax
mov [esp + BLITTER.stride], eax
mov ecx, esp
call blit_clip
jc .L57
mov eax, [current_slot_idx]
shl eax, 5 ; sizeof.WDATA
shl eax, BSF sizeof.WDATA
mov ebx, [esp+BLITTER.dst_x]
mov ebp, [esp+BLITTER.dst_y]
add ebx, [eax + window_data + WDATA.box.left]
add ebp, [eax + window_data + WDATA.box.top]
mov ebx, [esp + BLITTER.dst_x]
mov ebp, [esp + BLITTER.dst_y]
add ebx, [window_data + eax + WDATA.box.left]
add ebp, [window_data + eax + WDATA.box.top]
test [esp+.flags], BLIT_CLIENT_RELATIVE
test [esp + .flags], BLIT_CLIENT_RELATIVE
jz .no_client_relative
mov eax, [current_slot]
@ -277,15 +277,15 @@ end virtual
.no_client_relative:
mov ecx, ebx
add ecx, [esp+BLITTER.w]
add ecx, [esp + BLITTER.w]
shl ecx, 16
mov cx, bp
add ecx, [esp+BLITTER.h]
add ecx, [esp + BLITTER.h]
mov eax, ebx
shl eax, 16
mov ax, bp
mov [esp+.position], eax
mov [esp + .position], eax
mov edi, ebp
@ -297,15 +297,15 @@ end virtual
add ebp, ebx
add ebp, [_display.win_map]
mov eax, [esp+BLITTER.src_y]
imul eax, [esp+BLITTER.stride]
mov esi, [esp+BLITTER.src_x]
lea esi, [eax+esi*4]
add esi, [esp+BLITTER.bitmap]
mov eax, [esp + BLITTER.src_y]
imul eax, [esp + BLITTER.stride]
mov esi, [esp + BLITTER.src_x]
lea esi, [eax + esi*4]
add esi, [esp + BLITTER.bitmap]
mov eax, ecx
mov ecx, [esp+BLITTER.h]
mov edx, [esp+BLITTER.w]
mov ecx, [esp + BLITTER.h]
mov edx, [esp + BLITTER.w]
test ecx, ecx ;FIXME check clipping
jz .L57
@ -316,7 +316,7 @@ end virtual
cmp [_display.bits_per_pixel], 32
jne .core_24
lea edi, [edi+ebx*4]
lea edi, [edi + ebx*4]
mov ebx, [current_slot_idx]
; check for hardware cursor
@ -336,28 +336,28 @@ align 4
;--------------------------------------
mov eax, [esi]
mov ecx, [esp+.position]
mov ecx, [esp + .position]
; check mouse area for putpixel
call [_display.check_mouse]
;--------------------------------------
; store to real LFB
mov [LFB_BASE+edi], eax
mov [LFB_BASE + edi], eax
;--------------------------------------
align 4
.skip:
add esi, 4
add edi, 4
inc ebp
add [esp+.position], 1 shl 16
add [esp + .position], 1 shl 16
dec edx
jnz .inner32
add esi, [esp+BLITTER.stride]
add esi, [esp + BLITTER.stride]
add edi, [_display.lfb_pitch]
add ebp, [_display.width]
mov edx, [esp+BLITTER.w]
mov edx, [esp + BLITTER.w]
mov eax, edx
inc [esp+.position]
sub ebp, edx
@ -365,8 +365,8 @@ align 4
sub esi, eax
sub edi, eax
shl eax, 16-2
sub [esp+.position], eax
dec [esp+BLITTER.h]
sub [esp + .position], eax
dec [esp + BLITTER.h]
jnz .outer32
jmp .done
.core_32.hardware_cursor:
@ -376,10 +376,10 @@ align 4
align 4
.hw.inner32:
cmp [ebp+ecx], bl
cmp [ebp + ecx], bl
jne .hw.skip
mov eax, [esi+ecx*4]
mov [LFB_BASE+edi+ecx*4], eax
mov eax, [esi + ecx*4]
mov [LFB_BASE + edi + ecx*4], eax
align 4
.hw.skip:
@ -387,12 +387,12 @@ align 4
dec edx
jnz .hw.inner32
add esi, [esp+BLITTER.stride]
add esi, [esp + BLITTER.stride]
add edi, [_display.lfb_pitch]
add ebp, [_display.width]
mov edx, [esp+BLITTER.w]
dec [esp+BLITTER.h]
mov edx, [esp + BLITTER.w]
dec [esp + BLITTER.h]
jnz .hw.outer32
.done:
@ -410,24 +410,24 @@ align 4
cmp [_display.bits_per_pixel], 24
jne .core_16
lea ebx, [ebx+ebx*2]
lea edi, [LFB_BASE+edi+ebx]
lea ebx, [ebx + ebx*2]
lea edi, [LFB_BASE + edi + ebx]
mov ebx, [current_slot_idx]
align 4
.outer24:
mov [esp+.extra_var1], edi
mov [esp + .extra_var1], edi
xor ecx, ecx
align 4
.inner24:
cmp [ebp+ecx], bl ; Does the process own this pixel?
cmp [ebp + ecx], bl ; Does the process own this pixel?
jne .skip_1
;--------------------------------------
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
cmp [_display.select_cursor], select_cursor
@ -443,7 +443,7 @@ align 4
ror ecx, 16
sub ecx, edx
rol ecx, 16
sub ecx, [esp+BLITTER.h + 8]
sub ecx, [esp + BLITTER.h + 8]
; check mouse area for putpixel
call [_display.check_mouse]
@ -451,44 +451,44 @@ align 4
;--------------------------------------
align 4
.no_mouseunder_1:
mov [edi+ecx], ax
mov [edi + ecx], ax
shr eax, 16
mov [edi+ecx+2], al
mov [edi + ecx+2], al
pop eax
;--------------------------------------
align 4
.skip_1:
mov edi, [esp+.extra_var1]
mov edi, [esp + .extra_var1]
inc ecx
dec edx
jnz .inner24
add esi, [esp+BLITTER.stride]
add esi, [esp + BLITTER.stride]
add edi, [_display.lfb_pitch]
add ebp, [_display.width]
mov edx, [esp+BLITTER.w]
dec [esp+BLITTER.h]
mov edx, [esp + BLITTER.w]
dec [esp + BLITTER.h]
jnz .outer24
jmp .done
.core_16:
lea edi, [LFB_BASE+edi+ebx*2]
lea edi, [LFB_BASE + edi + ebx*2]
mov ebx, [current_slot_idx]
.outer16:
mov [esp+.extra_var1], edi
mov [esp + .extra_var1], edi
xor ecx, ecx
.inner16:
cmp [ebp+ecx], bl ; Does the process own this pixel?
cmp [ebp + ecx], bl ; Does the process own this pixel?
jne .skip_2
;--------------------------------------
push eax
mov eax, [esi+ecx*4]
mov eax, [esi + ecx*4]
; check for hardware cursor
cmp [_display.select_cursor], select_cursor
@ -503,7 +503,7 @@ align 4
ror ecx, 16
sub ecx, edx
rol ecx, 16
sub ecx, [esp+BLITTER.h + 8]
sub ecx, [esp + BLITTER.h + 8]
; check mouse area for putpixel
call [_display.check_mouse]
@ -517,21 +517,21 @@ align 4
ror eax, 8
add al, ah
rol eax, 8
mov [edi+ecx*2], ax
mov [edi + ecx*2], ax
pop eax
;--------------------------------------
.skip_2:
mov edi, [esp+.extra_var1]
mov edi, [esp + .extra_var1]
inc ecx
dec edx
jnz .inner16
add esi, [esp+BLITTER.stride]
add esi, [esp + BLITTER.stride]
add edi, [_display.lfb_pitch]
add ebp, [_display.width]
mov edx, [esp+BLITTER.w]
dec [esp+BLITTER.h]
mov edx, [esp + BLITTER.w]
dec [esp + BLITTER.h]
jnz .outer16
jmp .done

View File

@ -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 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -43,11 +43,11 @@ proc init_cursor stdcall, dst:dword, src:dword
add esi, [esi+18]
mov eax, esi
cmp [esi+BITMAPINFOHEADER.BitCount], 24
cmp [esi + BITMAPINFOHEADER.BitCount], 24
je .img_24
cmp [esi+BITMAPINFOHEADER.BitCount], 8
cmp [esi + BITMAPINFOHEADER.BitCount], 8
je .img_8
cmp [esi+BITMAPINFOHEADER.BitCount], 4
cmp [esi + BITMAPINFOHEADER.BitCount], 4
je .img_4
;--------------------------------------
align 4
@ -90,7 +90,7 @@ align 4
xor ecx, ecx
shl ebx, 1
setc cl
mov ecx, [esi+ecx*4]
mov ecx, [esi + ecx*4]
and ecx, edx
and edx, 0xFF000000
or edx, ecx
@ -147,7 +147,7 @@ align 4
movzx ecx, byte [ebx]
and cl, 0xF0
shr ecx, 2
mov ecx, [esi+ecx]
mov ecx, [esi + ecx]
and ecx, edx
and edx, 0xFF000000
or edx, ecx
@ -160,7 +160,7 @@ align 4
movzx ecx, byte [ebx]
and cl, 0x0F
mov ecx, [esi+ecx*4]
mov ecx, [esi + ecx*4]
and ecx, edx
and edx, 0xFF000000
or edx, ecx
@ -215,7 +215,7 @@ align 4
dec edx
movzx ecx, byte [ebx]
mov ecx, [esi+ecx*4]
mov ecx, [esi + ecx*4]
and ecx, edx
and edx, 0xFF000000
or edx, ecx
@ -240,9 +240,9 @@ align 4
mov [pQuad], eax
add eax, 0xC00
mov [pAnd], eax
mov eax, [esi+BITMAPINFOHEADER.Width]
mov eax, [esi + BITMAPINFOHEADER.Width]
mov [width], eax
mov ebx, [esi+BITMAPINFOHEADER.Height]
mov ebx, [esi + BITMAPINFOHEADER.Height]
shr ebx, 1
mov [height], ebx
@ -289,19 +289,19 @@ endp
align 4
proc set_cursor stdcall, hcursor:dword
mov eax, [hcursor]
cmp [eax+CURSOR.magic], 'CURS'
cmp [eax + CURSOR.magic], 'CURS'
jne .fail
; cmp [eax+CURSOR.size], CURSOR_SIZE
; jne .fail
mov ebx, [current_slot]
xchg eax, [ebx+APPDATA.cursor]
xchg eax, [ebx + APPDATA.cursor]
jmp .end
;--------------------------------------
align 4
.fail:
mov eax, [def_cursor]
mov ebx, [current_slot]
xchg eax, [ebx+APPDATA.cursor]
xchg eax, [ebx + APPDATA.cursor]
align 4
.end:
mov [redrawmouse_unconditional], 1
@ -333,17 +333,17 @@ create_cursor:
mov [.hcursor], eax
xor ebx, ebx
mov [eax+CURSOR.magic], 'CURS'
mov [eax+CURSOR.destroy], destroy_cursor
mov [eax+CURSOR.hot_x], ebx
mov [eax+CURSOR.hot_y], ebx
mov [eax + CURSOR.magic], 'CURS'
mov [eax + CURSOR.destroy], destroy_cursor
mov [eax + CURSOR.hot_x], ebx
mov [eax + CURSOR.hot_y], ebx
stdcall kernel_alloc, 0x1000
test eax, eax
jz .fail
mov edi, [.hcursor]
mov [edi+CURSOR.base], eax
mov [edi + CURSOR.base], eax
mov esi, [.src]
mov ebx, [.flags]
@ -352,15 +352,15 @@ create_cursor:
movzx ecx, word [esi+10]
movzx edx, word [esi+12]
mov [edi+CURSOR.hot_x], ecx
mov [edi+CURSOR.hot_y], edx
mov [edi + CURSOR.hot_x], ecx
mov [edi + CURSOR.hot_y], edx
stdcall init_cursor, eax, esi
align 4
.add_cursor:
mov ecx, [.hcursor]
lea ecx, [ecx+CURSOR.list_next]
lea ecx, [ecx + CURSOR.list_next]
lea edx, [_display.cr_list.next]
pushfd
@ -388,8 +388,8 @@ align 4
shr ebx, 16
movzx ecx, bh
movzx edx, bl
mov [edi+CURSOR.hot_x], ecx
mov [edi+CURSOR.hot_y], edx
mov [edi + CURSOR.hot_x], ecx
mov [edi + CURSOR.hot_y], edx
xchg edi, eax
mov ecx, 1024
@ -423,8 +423,8 @@ align 4
push edi
mov eax, [current_slot_idx]
shl eax, 8
mov eax, [eax + SLOT_BASE + APPDATA.tid]
shl eax, BSF sizeof.APPDATA
mov eax, [SLOT_BASE + eax + APPDATA.tid]
mov ebx, [src]
mov ecx, [flags]
call create_cursor ;eax, ebx, ecx
@ -456,27 +456,25 @@ proc delete_cursor stdcall, hcursor:dword
mov esi, [hcursor]
cmp [esi+CURSOR.magic], 'CURS'
cmp [esi + CURSOR.magic], 'CURS'
jne .fail
mov ebx, [current_slot_idx]
;shl ebx, 5
;mov ebx, [TASK_TABLE+ebx+4]
shl ebx, 8
shl ebx, BSF sizeof.APPDATA
mov ebx, [ebx + SLOT_BASE + APPDATA.tid]
cmp ebx, [esi+CURSOR.pid]
jne .fail
mov ebx, [current_slot]
cmp esi, [ebx+APPDATA.cursor]
cmp esi, [ebx + APPDATA.cursor]
jne @F
mov eax, [def_cursor]
mov [ebx+APPDATA.cursor], eax
mov [ebx + APPDATA.cursor], eax
;--------------------------------------
align 4
@@:
mov eax, [hcursor]
call [eax+APPOBJ.destroy]
call [eax + APPOBJ.destroy]
;--------------------------------------
align 4
.fail:
@ -489,10 +487,10 @@ align 4
destroy_cursor:
push eax
stdcall kernel_free, [eax+CURSOR.base]
stdcall kernel_free, [eax + CURSOR.base]
mov eax, [esp]
lea eax, [eax+CURSOR.list_next]
lea eax, [eax + CURSOR.list_next]
pushfd
cli
@ -631,8 +629,8 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
; mov ebx, [BytesPerScanLine]
xor edx, edx
sub ecx, [esi+CURSOR.hot_x]
lea ebx, [ecx+32-1]
sub ecx, [esi + CURSOR.hot_x]
lea ebx, [ecx + 32-1]
mov [x], ecx
sets dl
dec edx
@ -643,7 +641,7 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
mov [_dx], edi
xor edx, edx
sub eax, [esi+CURSOR.hot_y]
sub eax, [esi + CURSOR.hot_y]
lea edi, [eax+32-1]
mov [y], eax
sets dl
@ -655,8 +653,8 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
mov [_dy], edx
; mul dword [BytesPerScanLine]
mov eax, [BPSLine_calc_area+eax*4]
lea edx, [LFB_BASE+ecx*3]
mov eax, [BPSLine_calc_area + eax*4]
lea edx, [LFB_BASE + ecx*3]
add edx, eax
mov [cur_saved_base], edx
@ -690,7 +688,7 @@ align 4
mov esi, edx
add edx, [_display.lfb_pitch]
mov ecx, [cur.w]
lea ecx, [ecx+ecx*2]
lea ecx, [ecx + ecx*2]
rep movsb
dec eax
jnz @B
@ -702,8 +700,8 @@ align 4
add eax, [_dx]
mov esi, [hcursor]
mov esi, [esi+CURSOR.base]
lea edx, [esi+eax*4]
mov esi, [esi + CURSOR.base]
lea edx, [esi + eax*4]
;--------------------------------------
align 4
.row:
@ -746,7 +744,7 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
mov eax, [y]
xor edx, edx
sub ecx, [esi+CURSOR.hot_x]
sub ecx, [esi + CURSOR.hot_x]
lea ebx, [ecx+32-1]
mov [x], ecx
sets dl
@ -758,7 +756,7 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
mov [_dx], edi
xor edx, edx
sub eax, [esi+CURSOR.hot_y]
sub eax, [esi + CURSOR.hot_y]
lea edi, [eax+32-1]
mov [y], eax
sets dl
@ -771,7 +769,7 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
; mul dword [BytesPerScanLine]
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
cmp ebx, [_display.width]
@ -814,7 +812,7 @@ align 4
add eax, [_dx]
mov esi, [hcursor]
mov esi, [esi+CURSOR.base]
mov esi, [esi + CURSOR.base]
lea edx, [esi+eax*4]
;--------------------------------------
align 4
@ -856,8 +854,8 @@ proc move_cursor_16 stdcall, hcursor:dword, x:dword, y:dword
mov eax, [y]
xor edx, edx
sub ecx, [esi+CURSOR.hot_x]
lea ebx, [ecx+32-1]
sub ecx, [esi + CURSOR.hot_x]
lea ebx, [ecx + 32-1]
mov [x], ecx
sets dl
dec edx
@ -868,8 +866,8 @@ proc move_cursor_16 stdcall, hcursor:dword, x:dword, y:dword
mov [_dx], edi
xor edx, edx
sub eax, [esi+CURSOR.hot_y]
lea edi, [eax+32-1]
sub eax, [esi + CURSOR.hot_y]
lea edi, [eax + 32-1]
mov [y], eax
sets dl
dec edx
@ -880,8 +878,8 @@ proc move_cursor_16 stdcall, hcursor:dword, x:dword, y:dword
mov [_dy], edx
; mul dword [BytesPerScanLine]
mov eax, [BPSLine_calc_area+eax*4]
lea edx, [LFB_BASE+eax+ecx*2]
mov eax, [BPSLine_calc_area + eax*4]
lea edx, [LFB_BASE + eax + ecx*2]
mov [cur_saved_base], edx
cmp ebx, [_display.width]
@ -925,8 +923,8 @@ align 4
add eax, [_dx]
mov esi, [hcursor]
mov esi, [esi+CURSOR.base]
lea edx, [esi+eax*4]
mov esi, [esi + CURSOR.base]
lea edx, [esi + eax*4]
;--------------------------------------
align 4
.row:
@ -1123,8 +1121,8 @@ align 4
add ecx, ebx
mov eax, [current_cursor]
mov eax, [eax+CURSOR.base]
lea eax, [eax+ecx*4]
mov eax, [eax + CURSOR.base]
lea eax, [eax + ecx*4]
mov eax, [eax]
pop ebx
@ -1157,15 +1155,15 @@ init_display:
xor eax, eax
mov edi, _display
mov [edi+display_t.init_cursor], eax
mov [edi+display_t.select_cursor], eax
mov [edi+display_t.show_cursor], eax
mov [edi+display_t.move_cursor], eax
mov [edi+display_t.restore_cursor], eax
mov [edi + display_t.init_cursor], eax
mov [edi + display_t.select_cursor], eax
mov [edi + display_t.show_cursor], eax
mov [edi + display_t.move_cursor], eax
mov [edi + display_t.restore_cursor], eax
lea ecx, [edi+display_t.cr_list.next]
mov [edi+display_t.cr_list.next], ecx
mov [edi+display_t.cr_list.prev], ecx
lea ecx, [edi + display_t.cr_list.next]
mov [edi + display_t.cr_list.next], ecx
mov [edi + display_t.cr_list.prev], ecx
if ~defined UEFI
cmp [SCR_MODE], word 0x13

View File

@ -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 ;;
;; ;;
;; Synhronization for MenuetOS. ;;
@ -30,8 +30,8 @@ create_framebuffer:
test eax, eax
jz .fail
mov [eax+FRB.magic], 'FRMB'
mov [eax+FRB.destroy], 0
mov [eax + FRB.magic], 'FRMB'
mov [eax + FRB.destroy], 0
.fail:
ret
@ -48,7 +48,7 @@ init_video:
cmp eax, MAX_SCREEN_WIDTH
ja $
mov [_display.width], eax
mov [ebp+FRB.width], eax
mov [ebp + FRB.width], eax
mov [display_width_standard], eax
dec eax
mov [screen_workarea.right], eax
@ -57,7 +57,7 @@ init_video:
cmp eax, MAX_SCREEN_HEIGHT
ja $
mov [_display.height], eax
mov [ebp+FRB.height], eax
mov [ebp + FRB.height], eax
mov [display_height_standard], eax
dec eax
mov [screen_workarea.bottom], eax
@ -72,7 +72,7 @@ init_video:
movzx eax, word[BOOT.pitch] ; for other modes
@@:
mov [_display.lfb_pitch], eax
mov [ebp+FRB.pitch], eax
mov [ebp + FRB.pitch], eax
mov eax, [BOOT.lfb]
mov [LFBAddress], eax
@ -131,16 +131,16 @@ init_video:
jnc .create_page_tables
mov edx, 0x00400000
or esi, PG_GLOBAL+PAT_WC+PG_UWR
or esi, PG_GLOBAL + PAT_WC + PG_UWR
and esi, [pte_valid_mask]
or esi, PDE_LARGE
mov [ebp+FRB.pde], esi
mov [ebp + FRB.pde], esi
add esi, edx
mov [ebp+FRB.pde+4], esi
mov [ebp + FRB.pde + 4], esi
add esi, edx
mov [ebp+FRB.pde+8], esi
mov [ebp + FRB.pde + 8], esi
add esi, edx
mov [ebp+FRB.pde+12], esi
mov [ebp + FRB.pde + 12], esi
add esi, edx
.ok:
call calculate_fast_getting_offset_for_WinMapAddress
@ -153,7 +153,7 @@ init_video:
.create_page_tables:
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]
stdcall alloc_kernel_space, 0x1000
@ -162,7 +162,7 @@ init_video:
.new_pd:
call alloc_page
lea edx, [eax+PG_UWR]
lea edx, [eax + PG_UWR]
mov [ebp], edx
stdcall map_page, edi, eax, PG_SWR
@ -190,8 +190,8 @@ init_video:
mov edi, eax ;free_kernel_space call
call alloc_page
lea edx, [eax+PG_UWR]
mov [ebp+FRB.pde], edx
lea edx, [eax + PG_UWR]
mov [ebp + FRB.pde], edx
stdcall map_page, edi, eax, PG_SWR
@ -213,7 +213,7 @@ align 4
set_framebuffer:
push esi
push edi
lea esi, [ecx+FRB.pde]
lea esi, [ecx + FRB.pde]
mov eax, sys_proc
cld
@ -221,11 +221,11 @@ set_framebuffer:
cli
mov [_display.current_lfb], ecx
.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
rep movsd ;patch pde
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
jne .patch_pde

View File

@ -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 ;;
;; ;;
;; VESA12.INC ;;

View File

@ -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 ;;
;; ;;
;; VESA20.INC ;;
@ -54,11 +54,11 @@ Vesa20_getpixel16:
.no_mouseunder:
; 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
add edi, ebx ; edi = x*2+(y*y multiplier)
movzx ecx, word[LFB_BASE+edi]
movzx ecx, word[LFB_BASE + edi]
shl ecx, 3
ror ecx, 8
shl cx, 2
@ -92,11 +92,11 @@ Vesa20_getpixel24:
.no_mouseunder:
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [BPSLine_calc_area+ebx*4]
lea edi, [eax+eax*2] ; edi = x*3
mov ebx, [BPSLine_calc_area + ebx*4]
lea edi, [eax + eax*2] ; edi = x*3
add edi, ebx ; edi = x*3+(y*y multiplier)
mov ecx, [LFB_BASE+edi]
mov ecx, [LFB_BASE + edi]
@@:
and ecx, 0x00ffffff
ret
@ -124,10 +124,10 @@ Vesa20_getpixel32:
.no_mouseunder:
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [BPSLine_calc_area+ebx*4]
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
mov ebx, [BPSLine_calc_area + ebx*4]
lea edi, [ebx + eax*4] ; edi = x*4+(y*y multiplier)
mov ecx, [LFB_BASE+edi]
mov ecx, [LFB_BASE + edi]
@@:
and ecx, 0x00ffffff
ret
@ -189,9 +189,8 @@ end virtual
mov [putimg.image_cx], eax
mov [putimg.image_cy], edx
; calculate absolute (i.e. screen) coordinates
;mov eax, [TASK_BASE]
mov eax, [current_slot_idx]
shl eax, 5 ; sizeof.WDATA
shl eax, BSF sizeof.WDATA
mov ebx, [eax + window_data + WDATA.box.left]
add ebx, [putimg.image_cx]
mov [putimg.abs_cx], ebx
@ -252,7 +251,7 @@ end virtual
; pointer to screen
mov edx, [putimg.abs_cy]
; imul edx, [BytesPerScanLine]
mov edx, [BPSLine_calc_area+edx*4]
mov edx, [BPSLine_calc_area + edx*4]
mov eax, [putimg.abs_cx]
imul eax, ebx
add edx, eax
@ -299,7 +298,7 @@ put_image_end_16:
mov ecx, [putimg.real_sx]
.new_x:
push [putimg.edi]
mov eax, [putimg.ebp+4]
mov eax, [putimg.ebp + 4]
call eax
cmp [ebp], bl
jne .skip
@ -310,7 +309,7 @@ put_image_end_16:
ror eax, 8
add al, ah
rol eax, 8
mov [LFB_BASE+edx], ax
mov [LFB_BASE + edx], ax
.skip:
add edx, 2
inc ebp
@ -347,7 +346,7 @@ put_image_end_16_old:
mov ecx, [putimg.real_sx]
.new_x:
push [putimg.edi]
mov eax, [putimg.ebp+4]
mov eax, [putimg.ebp + 4]
call eax
cmp [ebp], bl
jne .skip
@ -370,7 +369,7 @@ put_image_end_16_old:
;; ror eax, 8
;; add al, ah
;; rol eax, 8
mov [LFB_BASE+edx], ax
mov [LFB_BASE + edx], ax
.skip:
inc edx
inc edx
@ -406,7 +405,7 @@ put_image_end_16_new:
.new_x:
push [putimg.edi]
mov eax, [putimg.ebp+4]
mov eax, [putimg.ebp + 4]
call eax
cmp [ebp], bl
@ -497,15 +496,15 @@ put_image_end_24:
mov ecx, [putimg.real_sx]
.new_x:
push [putimg.edi]
mov eax, [putimg.ebp+4]
mov eax, [putimg.ebp + 4]
call eax
cmp [ebp], bl
jne .skip
; store to LFB
mov [LFB_BASE+edx], ax
mov [LFB_BASE + edx], ax
shr eax, 16
mov [LFB_BASE+edx+2], al
mov [LFB_BASE + edx + 2], al
.skip:
add edx, 3
@ -545,7 +544,7 @@ put_image_end_24_old:
align 4
.new_x:
push [putimg.edi]
mov eax, [putimg.ebp+4]
mov eax, [putimg.ebp + 4]
call eax
cmp [ebp], bl
jne .skip
@ -561,9 +560,9 @@ align 4
call check_mouse_area_for_putpixel
pop ecx
; store to LFB
mov [LFB_BASE+edx], ax
mov [LFB_BASE + edx], ax
shr eax, 16
mov [LFB_BASE+edx+2], al
mov [LFB_BASE + edx + 2], al
.skip:
add edx, 3
@ -601,7 +600,7 @@ put_image_end_24_new:
.new_x:
push [putimg.edi]
mov eax, [putimg.ebp+4]
mov eax, [putimg.ebp + 4]
call eax
cmp [ebp], bl
jne .skip
@ -642,9 +641,9 @@ put_image_end_24_new:
pop ecx
; store to LFB
mov [LFB_BASE+edx], ax
mov [LFB_BASE + edx], ax
shr eax, 16
mov [LFB_BASE+edx+2], al
mov [LFB_BASE + edx + 2], al
.skip:
add edx, 3
@ -691,13 +690,13 @@ put_image_end_32:
.new_x:
push [putimg.edi]
mov eax, [putimg.ebp+4]
mov eax, [putimg.ebp + 4]
call eax
cmp [ebp], bl
jne .skip
; store to LFB
mov [LFB_BASE+edx], eax
mov [LFB_BASE + edx], eax
.skip:
add edx, 4
@ -743,7 +742,7 @@ put_image_end_32_old:
mov ecx, [putimg.real_sx]
.new_x:
push [putimg.edi]
mov eax, [putimg.ebp+4]
mov eax, [putimg.ebp + 4]
call eax
cmp [ebp], bl
jne .skip
@ -797,7 +796,7 @@ put_image_end_32_new:
.new_x:
push [putimg.edi]
mov eax, [putimg.ebp+4]
mov eax, [putimg.ebp + 4]
call eax
cmp [ebp], bl
jne .skip
@ -902,9 +901,9 @@ __sys_putpixel:
not ecx
rol ecx, 8
mov cl, [esp+32-8+3]
mov cl, [esp + 32-8+3]
ror ecx, 8
mov [esp+32-8], ecx
mov [esp + 32-8], ecx
.no_inv:
call [PUTPIXEL] ; call the real put_pixel function
.exit:
@ -923,9 +922,9 @@ Vesa20_putpixel16:
mov cx, bx
; 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
mov eax, [esp+32-8+4]
mov eax, [esp + 32-8+4]
; check for hardware cursor
cmp [_display.select_cursor], 0
@ -943,7 +942,7 @@ Vesa20_putpixel16:
add al, ah
rol eax, 8
mov [LFB_BASE+ebx+edi], ax
mov [LFB_BASE + ebx + edi], ax
ret
;-----------------------------------------------------------------------------
@ -958,9 +957,9 @@ Vesa20_putpixel16_new:
mov cx, bx
; 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
mov eax, [esp+32-8+4]
mov eax, [esp + 32-8+4]
; check for hardware cursor
cmp [_display.select_cursor], select_cursor
@ -993,7 +992,7 @@ Vesa20_putpixel16_new:
add al, ah
rol eax, 8
mov [LFB_BASE+ebx+edi], ax
mov [LFB_BASE + ebx + edi], ax
ret
;-----------------------------------------------------------------------------
@ -1008,9 +1007,9 @@ Vesa20_putpixel24:
mov cx, bx
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [BPSLine_calc_area+ebx*4]
lea edi, [eax+eax*2]; edi = x*3
mov eax, [esp+32-8+4]
mov ebx, [BPSLine_calc_area + ebx*4]
lea edi, [eax + eax*2]; edi = x*3
mov eax, [esp + 32-8+4]
; check for hardware cursor
cmp [_display.select_cursor], 0
@ -1022,9 +1021,9 @@ Vesa20_putpixel24:
@@:
; store to LFB
mov [LFB_BASE+ebx+edi], ax
mov [LFB_BASE + ebx + edi], ax
shr eax, 16
mov [LFB_BASE+ebx+edi+2], al
mov [LFB_BASE + ebx + edi + 2], al
ret
;-----------------------------------------------------------------------------
@ -1040,8 +1039,8 @@ Vesa20_putpixel24_new:
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [BPSLine_calc_area+ebx*4]
lea edi, [eax+eax*2]; edi = x*3
mov eax, [esp+32-8+4]
lea edi, [eax + eax*2]; edi = x*3
mov eax, [esp + 32-8+4]
; check for hardware cursor
cmp [_display.select_cursor], select_cursor
@ -1067,9 +1066,9 @@ Vesa20_putpixel24_new:
call check_mouse_area_for_putpixel_new.1
@@:
; store to LFB
mov [LFB_BASE+ebx+edi], ax
mov [LFB_BASE + ebx + edi], ax
shr eax, 16
mov [LFB_BASE+ebx+edi+2], al
mov [LFB_BASE + ebx + edi + 2], al
ret
;-----------------------------------------------------------------------------
@ -1085,8 +1084,8 @@ Vesa20_putpixel32:
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [BPSLine_calc_area+ebx*4]
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
mov eax, [esp+32-8+4] ; eax = color
lea edi, [ebx + eax*4] ; edi = x*4+(y*y multiplier)
mov eax, [esp + 32-8+4] ; eax = color
; check for hardware cursor
cmp [_display.select_cursor], 0
@ -1098,7 +1097,7 @@ Vesa20_putpixel32:
@@:
and eax, 0xffffff
; store to LFB
mov [LFB_BASE+edi], eax
mov [LFB_BASE + edi], eax
ret
;-----------------------------------------------------------------------------
@ -1114,8 +1113,8 @@ Vesa20_putpixel32_new:
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [BPSLine_calc_area+ebx*4]
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
mov eax, [esp+32-8+4] ; eax = color
lea edi, [ebx + eax*4] ; edi = x*4+(y*y multiplier)
mov eax, [esp + 32-8+4] ; eax = color
; check for hardware cursor
cmp [_display.select_cursor], select_cursor
@ -1142,7 +1141,7 @@ Vesa20_putpixel32_new:
@@:
and eax, 0x00ffffff
; store to LFB
mov [LFB_BASE+edi], eax
mov [LFB_BASE + edi], eax
ret
;-----------------------------------------------------------------------------
@ -1403,9 +1402,8 @@ end virtual
mov [drbar.bar_sx], ecx
mov [drbar.bar_cx], eax
mov [drbar.bar_cy], ebx
;mov edi, [TASK_BASE]
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 ebx, [edi + window_data + WDATA.box.top] ; win_cy
mov [drbar.abs_cx], eax
@ -2015,9 +2013,9 @@ vesa20_drawbackground_tiled:
pushad
; 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:
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]
; and LFB data (output for our function) [edi]
; mov eax, [BytesPerScanLine]
@ -2115,7 +2113,7 @@ vesa20_drawbackground_tiled:
add ebp, edx
add eax, edx
cmp eax, [draw_data+32+RECT.right]
cmp eax, [draw_data + 32 + RECT.right]
ja dp4
sub ecx, edx
jnz dp3
@ -2130,7 +2128,7 @@ vesa20_drawbackground_tiled:
dp4:
; next scan line
inc ebx
cmp ebx, [draw_data+32+RECT.bottom]
cmp ebx, [draw_data + 32 + RECT.bottom]
jbe dp2
popad
mov [EGA_counter], 1
@ -2168,8 +2166,8 @@ vesa20_drawbackground_stretch:
push eax ; low
; External loop for all y from start to end
mov ebx, [draw_data+32+RECT.top] ; y start
mov ebp, [draw_data+32+RECT.left] ; x start
mov ebx, [draw_data + 32 + RECT.top] ; y start
mov ebp, [draw_data + 32 + RECT.left] ; x start
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
; and LFB data (output for our function) [edi]
; mov eax, [BytesPerScanLine]
@ -2319,11 +2317,11 @@ vesa20_drawbackground_stretch:
mov ebx, [esp+24]
add ebx, 1
mov [esp+24], ebx
cmp ebx, [draw_data+32+RECT.bottom]
cmp ebx, [draw_data + 32 + RECT.bottom]
ja sdpdone
; advance edi, ebp to next scan line
sub eax, [draw_data+32+RECT.left]
sub eax, [draw_data + 32 + RECT.left]
sub ebp, eax
add ebp, [_display.width]
sub edi, eax
@ -2348,7 +2346,7 @@ vesa20_drawbackground_stretch:
lea eax, [eax*3]
imul eax, [BgrDataWidth]
sub [esp], eax
mov eax, [draw_data+32+RECT.left]
mov eax, [draw_data + 32 + RECT.left]
mov [esp+20], eax
test ebx, ebx
jz sdp3
@ -2388,7 +2386,7 @@ smooth_line:
mov eax, [esp+20+8]
add eax, 1
mov [esp+20+8], eax
cmp eax, [draw_data+32+RECT.right]
cmp eax, [draw_data + 32 + RECT.right]
ja @f
add ecx, [esp+36+8]
mov eax, edx
@ -2398,7 +2396,7 @@ smooth_line:
sub esi, eax
jmp smooth_line
@@:
mov eax, [draw_data+32+RECT.left]
mov eax, [draw_data + 32 + RECT.left]
mov [esp+20+8], eax
ret
@ -2449,16 +2447,16 @@ else
movzx eax, cl
sub eax, ebx
movzx ebx, dh
add dl, [BgrAuxTable+(eax+0x100)+esi]
add dl, [BgrAuxTable + (eax + 0x100) + esi]
movzx eax, ch
sub eax, ebx
add dh, [BgrAuxTable+(eax+0x100)+esi]
add dh, [BgrAuxTable + (eax+0x100) + esi]
ror ecx, 16
ror edx, 16
movzx eax, cl
movzx ebx, dl
sub eax, ebx
add dl, [BgrAuxTable+(eax+0x100)+esi]
add dl, [BgrAuxTable + (eax + 0x100) + esi]
pop esi
mov eax, edx
pop edx
@ -2489,7 +2487,7 @@ init_background:
loop .loop1
add dl, 4
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
mov [overlapping_of_points_ptr], overlapping_of_points_mmx
@@:

View File

@ -250,7 +250,7 @@ align 4
@@:
push ebx edx esi edi
shl edx, 9
lea edx, [edx+edx*4]
lea edx, [edx + edx*4]
add esi, edx
shr edx, 5
add edi, edx
@ -378,7 +378,7 @@ VGA_putpixel:
; eax = x
; ebx = y
mov ecx, eax
mov eax, [esp+32-8+4] ; color
mov eax, [esp + 32-8+4] ; color
;--------------------------------------
; check for hardware cursor
cmp [_display.select_cursor], select_cursor
@ -403,8 +403,8 @@ align 4
align 4
.no_mouseunder:
shl ebx, 9
lea ebx, [ebx+ebx*4] ; multiply by 5
lea edx, [ebx+ecx*4] ; + x*BytesPerPixel (Vesa2.0 32)
lea ebx, [ebx + ebx*4] ; multiply by 5
lea edx, [ebx + ecx*4] ; + x*BytesPerPixel (Vesa2.0 32)
mov edi, edx
add edi, [LFBAddress] ; + LFB address
mov [edi], eax ; write to LFB for Vesa2.0
@ -496,14 +496,14 @@ align 4
VGA_draw_bar_1:
mov [temp.cx], eax
mov eax, [current_slot_idx]
shl eax, 5
add ebx, [eax+window_data+WDATA.box.top]
mov eax, [eax+window_data+WDATA.box.left]
shl eax, BSF sizeof.WDATA
add ebx, [window_data + eax + WDATA.box.top]
mov eax, [window_data + eax + WDATA.box.left]
add eax, [temp.cx]
and eax, 0xfff8
shl ebx, 9
lea ebx, [ebx+ebx*4] ; multiply by 5
lea ebx, [ebx+eax*4] ; + x*BytesPerPixel (Vesa2.0 32)
lea ebx, [ebx + ebx*4] ; multiply by 5
lea ebx, [ebx + eax*4] ; + x*BytesPerPixel (Vesa2.0 32)
mov esi, ebx
add esi, [LFBAddress] ; + LFB address
shr ebx, 5 ; change BytesPerPixel to 1/8
@ -525,7 +525,7 @@ align 4
VGA_draw_long_line_1:
push ebx edx esi edi
shl edx, 9
lea edx, [edx+edx*4]
lea edx, [edx + edx*4]
add esi, edx
shr edx, 5
add edi, edx