Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 3500 → Rev 3499

/kernel/branches/Kolibri-acpi/kernelsp.inc
File deleted
/kernel/branches/Kolibri-acpi/data32sp.inc
File deleted
/kernel/branches/Kolibri-acpi/blkdev/disk.inc
150,7 → 150,7
; 0 if media fields are not used, nonzero otherwise. If .MediaRefCount is
; nonzero, this field is nonzero too; however, when .MediaRefCount goes
; to zero, there is some time interval during which media object is still used.
dw ? ; padding
align 4
; The following fields are not valid unless either .MediaInserted is nonzero
; or they are accessed from a code which has obtained the reference when
; .MediaInserted was nonzero.
381,7 → 381,6
call mutex_init
xor eax, eax
mov dword [esi+DISK.MediaInserted], eax
mov [esi+DISK.MediaRefCount], eax
inc eax
mov [esi+DISK.RefCount], eax
; The DISK structure is initialized.
/kernel/branches/Kolibri-acpi/blkdev/disk_cache.inc
629,9 → 629,7
mov [hdd_appl_data], 0
call write_cache
mov [hdd_appl_data], 1
call write_cache
mov eax, [hd_error]
ret
jmp write_cache
@@:
; The algorithm is straightforward.
push esi
/kernel/branches/Kolibri-acpi/blkdev/hd_drv.inc
340,11 → 340,7
; call clear_application_table_status
; mov esi,hd_timeout_str
; call sys_msg_board_str
if lang eq sp
DEBUGF 1,"K : FS - HD tiempo de espera agotado\n"
else
DEBUGF 1,"K : FS - HD timeout\n"
end if
 
mov [hd_error], 1
pop eax
356,11 → 352,7
; call clear_application_table_status
; mov esi,hd_read_str
; call sys_msg_board_str
if lang eq sp
DEBUGF 1,"K : FS - HD error de lectura\n"
else
DEBUGF 1,"K : FS - HD read error\n"
end if
pop edx eax
ret
 
370,11 → 362,7
; call clear_application_table_status
; mov esi,hd_write_str
; call sys_msg_board_str
if lang eq sp
DEBUGF 1,"K : FS - HD error de escritura\n"
else
DEBUGF 1,"K : FS - HD write error\n"
end if
ret
 
hd_write_error_dma:
382,11 → 370,7
; call clear_application_table_status
; mov esi, hd_write_str
; call sys_msg_board_str
if lang eq sp
DEBUGF 1,"K : FS - HD error de escritura\n"
else
DEBUGF 1,"K : FS - HD write error\n"
end if
DEBUGF 1,"K : FS - HD read error\n"
pop esi
ret
 
395,11 → 379,7
; call clear_application_table_status
; mov esi,hd_lba_str
; call sys_msg_board_str
if lang eq sp
DEBUGF 1,"K : FS - HD error en LBA\n"
else
DEBUGF 1,"K : FS - HD LBA error\n"
end if
jmp LBA_read_ret
 
 
/kernel/branches/Kolibri-acpi/blkdev/rd.inc
2257,10 → 2257,8
jmp .lfndel
.lfndone:
; delete FAT chain
cmp eax, 2
jb .done
cmp eax, 0xFF8
jae .done
test eax, eax
jz .done
lea eax, [RAMDISK_FAT + eax*2]
push dword [eax]
and word [eax], 0
/kernel/branches/Kolibri-acpi/blkdev/rdsave.inc
24,7 → 24,7
mov ebx, saverd_fileinfo
mov [saverd_fileinfo.name], ecx
pushad
call file_system_lfn_protected ;in ebx
call file_system_lfn ;in ebx
popad
mov [esp+32], eax
ret
/kernel/branches/Kolibri-acpi/boot/booten.inc
File deleted
/kernel/branches/Kolibri-acpi/boot/bootsp.inc
File deleted
/kernel/branches/Kolibri-acpi/boot/rdload.inc
103,7 → 103,7
read_image:
mov ebx, read_image_fsinfo
pushad
call file_system_lfn_protected
call file_system_lfn
popad
ret
 
/kernel/branches/Kolibri-acpi/boot/bootcode.inc
863,14 → 863,6
mov [time_str+9], ' '
mov [time_str+10], ' '
@@:
else if lang eq sp
; esperar 5/4/3/2 segundos, 1 segundo
cmp al, 1
mov cl, 's'
ja @f
mov cl, ' '
@@:
mov [time_str+10], cl
else
; wait 5/4/3/2 seconds, 1 second
cmp al, 1
925,11 → 917,7
or al, 20h
cmp al, 'n'
jz .loadc
if lang eq sp
cmp al, 's'
else
cmp al, 'y'
end if
jnz .waityn
call putchar
mov byte [space_msg+80], 186
/kernel/branches/Kolibri-acpi/core/conf_lib-sp.inc
File deleted
/kernel/branches/Kolibri-acpi/core/sys32-sp.inc
File deleted
/kernel/branches/Kolibri-acpi/core/dll.inc
369,7 → 369,7
 
pushad
lea ebx, [cmd]
call file_system_lfn_protected
call file_system_lfn
popad
ret
endp
/kernel/branches/Kolibri-acpi/core/memory.inc
1471,6 → 1471,33
endp
 
align 4
proc stall stdcall, delay:dword
push ecx
push edx
push ebx
push eax
 
mov eax, [delay]
mul [stall_mcs]
mov ebx, eax ;low
mov ecx, edx ;high
rdtsc
add ebx, eax
adc ecx, edx
@@:
rdtsc
sub eax, ebx
sbb edx, ecx
jb @B
 
pop eax
pop ebx
pop edx
pop ecx
ret
endp
 
align 4
proc create_ring_buffer stdcall, size:dword, flags:dword
locals
buf_ptr dd ?
/kernel/branches/Kolibri-acpi/core/peload.inc
284,14 → 284,10
alloc_pages, 'AllocPages', \ ; stdcall
commit_pages, 'CommitPages', \ ; eax, ebx, ecx
\
disk_add, 'DiskAdd', \ ;stdcall
disk_media_changed, 'DiskMediaChanged', \ ;stdcall
\
create_event, 'CreateEvent', \ ; ecx, esi
destroy_event, 'DestroyEvent', \ ;
raise_event, 'RaiseEvent', \ ; eax, ebx, edx, esi
wait_event, 'WaitEvent', \ ; eax, ebx
wait_event_timeout, 'WaitEventTimeout', \ ; eax, ebx, ecx
get_event_ex, 'GetEvent', \ ; edi
\
create_kernel_object, 'CreateObject', \
335,8 → 331,7
delay_hs, 'Delay', \ ; ebx
set_mouse_data, 'SetMouseData', \ ;
set_keyboard_data, 'SetKeyboardData', \ ; gcc fastcall
timer_hs, 'TimerHs', \ ; stdcall
get_cpu_freq, 'GetCpuFreq'
timer_hs, 'TimerHs' ; stdcall
 
 
 
/kernel/branches/Kolibri-acpi/core/sys32.inc
13,6 → 13,7
 
$Revision$
 
 
align 4 ;3A08
build_interrupt_table:
mov edi, idts
74,12 → 75,8
msg_exc_d db "General protection fault", 0
msg_exc_e db "Page fault", 0
 
if lang eq sp
include 'core/sys32-sp.inc'
else
msg_sel_ker db "kernel", 0
msg_sel_app db "application", 0
end if
 
endg
 
216,11 → 213,7
pop ebx
.no_ud:
mov edx, [TASK_BASE];not scratched below
if lang eq sp
DEBUGF 1, "K : Proceso - terminado forzado PID: %x [%s]\n", [edx+TASKDATA.pid], [current_slot]
else
DEBUGF 1, "K : Process - forced terminate PID: %x [%s]\n", [edx+TASKDATA.pid], [current_slot]
end if
DEBUGF 1, "K : Process - forced terminate PID: %x\n", [edx+TASKDATA.pid]
cmp bl, 0x08
jb .l0
cmp bl, 0x0e
714,78 → 707,3
; mov esi,boot_sched_2
; call boot_log
; ret
 
; Three following procedures are used to guarantee that
; some part of kernel code will not be terminated from outside
; while it is running.
; Note: they do not protect a thread from terminating due to errors inside
; the thread; accessing a nonexisting memory would still terminate it.
 
; First two procedures must be used in pair by thread-to-be-protected
; to signal the beginning and the end of an important part.
; It is OK to have nested areas.
 
; The last procedure must be used by outside wanna-be-terminators;
; if it is safe to terminate the given thread immediately, it returns eax=1;
; otherwise, it returns eax=0 and notifies the target thread that it should
; terminate itself when leaving a critical area (the last critical area if
; they are nested).
 
; Implementation. Those procedures use one dword in APPDATA for the thread,
; APPDATA.terminate_protection.
; * The upper bit is 1 during normal operations and 0 when terminate is requested.
; * Other bits form a number = depth of critical regions,
; plus 1 if the upper bit is 1.
; * When this dword goes to zero, the thread should be destructed,
; and the procedure in which it happened becomes responsible for destruction.
 
; Enter critical area. Called by thread which wants to be protected.
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
; 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.
test eax, eax
jz @f
ret
@@:
; Wait for somebody to finish us.
call change_task
jmp @b
endp
 
; Leave critical area. Called by thread which wants to be protected.
proc unprotect_from_terminate
mov edx, [current_slot]
; Atomically decrement depth of critical areas.
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
; Otherwise, return to the caller.
ret
endp
 
; Request termination of thread identified by edx = SLOT_BASE + slot*256.
; Called by anyone.
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
jnc .unsafe
; Atomically decrement depth of critical areas.
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
; Otherwise, it is safe to kill the target now and the caller is responsible
; for this. Return eax=1.
inc eax
.unsafe:
ret
endp
 
/kernel/branches/Kolibri-acpi/core/syscall.inc
38,13 → 38,9
pushad
cld
 
call protect_from_terminate
 
movzx eax, byte [esp+28]
mov edx, dword [esp+20]
movzx eax, al
call dword [servetable2 + eax * 4]
 
call unprotect_from_terminate
popad
;------------------
xchg ecx, [ss:esp] ; â âåðøèí ñòåêà - app ecx, ecx - app esp + 4
66,11 → 62,8
i40:
pushad
cld
call protect_from_terminate
movzx eax, byte [esp+28]
mov edx, dword [esp+20]
movzx eax, al
call dword [servetable2 + eax * 4]
call unprotect_from_terminate
popad
iretd
 
92,13 → 85,10
;------------------
pushad
cld
call protect_from_terminate
 
movzx eax, byte [esp+28]
mov edx, dword [esp+20]
movzx eax, al
call dword [servetable2 + eax * 4]
 
call unprotect_from_terminate
popad
;------------------
mov ecx, [ss:esp+4]
135,7 → 125,7
dd sys_getkey ; 2-GetKey
dd sys_clock ; 3-GetTime
dd syscall_writetext ; 4-WriteText
dd delay_hs_unprotected ; 5-DelayHs
dd delay_hs ; 5-DelayHs
dd syscall_openramdiskfile ; 6-OpenRamdiskFile
dd syscall_putimage ; 7-PutImage
dd syscall_button ; 8-DefineButton
/kernel/branches/Kolibri-acpi/core/taskman.inc
1023,7 → 1023,6
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
 
;set default io permission map
mov ecx, [SLOT_BASE+256+APPDATA.io_map]
1148,14 → 1147,6
mov eax, [esi+0x08] ;app_eip
mov [ebx+REG_EIP], eax;app_entry
mov [ebx+REG_CS], dword app_code
mov eax, [CURRENT_TASK]
shl eax, 8 ; created by kernel?
cmp [SLOT_BASE+eax+APPDATA.dir_table], sys_pgdir - OS_BASE
jnz @f
cmp [app_path], 0 ; it is a thread?
jnz @f
mov [ebx+REG_CS], dword os_code ; kernel thread
@@:
mov [ebx+REG_EFLAGS], dword EFL_IOPL1+EFL_IF
 
mov eax, [esi+0x0C] ;app_esp
/kernel/branches/Kolibri-acpi/core/apic.inc
380,33 → 380,6
ret
endp
 
proc disable_irq stdcall, irq_line:dword
mov ebx, [irq_line]
cmp [irq_mode], IRQ_APIC
je .APIC
 
mov edx, 0x21
cmp ebx, 8
jb @F
 
mov edx, 0xA1
sub ebx, 8
@@:
in al, dx
bts eax, ebx
out dx, al
ret
.APIC:
shl ebx, 1
add ebx, 0x10
mov eax, ebx
call IOAPIC_read
or eax, 0x10000; bit 16
xchg eax, ebx
call IOAPIC_write
ret
endp
 
align 4
pci_irq_fixup:
 
446,7 → 419,6
pop ebp
ret
 
if 0
align 4
start_ap:
;eax= cpu id
476,8 → 448,6
.exit:
ret
 
end if
 
 
 
 
/kernel/branches/Kolibri-acpi/core/conf_lib.inc
67,8 → 67,12
endp
iglobal
ugui db 'gui',0
ugui_mouse_speed db 'mouse_speed',0
ugui_mouse_speed_def db '2',0
ugui_mouse_delay db 'mouse_delay',0
ugui_mouse_delay_def db '0x00A',0
 
udev db 'dev',0
udev_midibase db 'midibase',0
udev_midibase_def db '0x320',0
endg
121,18 → 125,11
 
endp
iglobal
if lang eq sp
include 'core/conf_lib-sp.inc'
else
ugui_mouse_speed db 'mouse_speed',0
ugui_mouse_delay db 'mouse_delay',0
udev db 'dev',0
unet db 'net',0
unet_active db 'active',0
unet_addr db 'addr',0
unet_mask db 'mask',0
unet_gate db 'gate',0
end if
unet_def db 0
endg
; convert string to DWord
/kernel/branches/Kolibri-acpi/core/heap.inc
154,11 → 154,11
 
mov [ecx+block_next], eax
mov [ecx+block_prev], ebx
mov [ecx+list_fd], eax
mov [ecx+list_bk], eax
mov [ecx+block_base], eax
mov [ecx+block_size], eax
mov [ecx+block_flags], USED_BLOCK
mov [edi+list_fd], eax
mov [edi+list_bk], eax
mov [edi+block_base], eax
mov [edi+block_size], eax
mov [edi+block_flags], USED_BLOCK
 
mov [ebx+block_next], ecx
mov [ebx+block_prev], edi
440,7 → 440,6
cmp edx, [edx]
jne .add_block
btr [mem_block_mask], ecx
 
.add_block:
bts [mem_block_mask], eax
lea edx, [mem_block_list+eax*8]
759,13 → 758,11
inc ebx
dec eax
jnz .fill
 
.second_nofill:
sub ecx, edx
jz .nothird
or cl, FREE_BLOCK
mov [page_tabs+ebx*4], ecx
 
.nothird:
 
mov edx, [current_slot]
825,7 → 822,6
inc esi
dec ecx
jnz .release
 
.released:
push edi
 
/kernel/branches/Kolibri-acpi/core/v86.inc
888,7 → 888,6
.cont2:
pop ecx
.cont:
add ebx, 0x100
loop .scan
mov ecx, edi
call irq_eoi
/kernel/branches/Kolibri-acpi/data32.inc
87,8 → 87,6
if preboot_blogesc
boot_tasking db '‚ᥠ£®â®¢® ¤«ï § ¯ã᪠, ­ ¦¬¨âॠESC ¤«ï áâ àâ ',0
end if
else if lang eq sp
include 'data32sp.inc'
else
boot_initirq db 'Initialize IRQ',0
boot_picinit db 'Initialize PIC',0
133,10 → 131,8
 
msg_unresolved db 'unresolved ',0
msg_module db 'in module ',0
if ~ lang eq sp
msg_version db 'incompatible driver version',13,10,0
msg_www db 'please visit www.kolibrios.org',13,10,0
end if
msg_CR db 13,10,0
 
intel_str db "GenuineIntel",0
159,7 → 155,7
notifyapp db '@notify',0
if lang eq ru
ud_user_message db 'Žè¨¡ª : ­¥¯®¤¤¥à¦¨¢ ¥¬ ï ¨­áâàãªæ¨ï ¯à®æ¥áá®à ',0
else if ~ lang eq sp
else
ud_user_message db 'Error: unsupported processor instruction',0
end if
 
181,10 → 177,6
.bk dd dll_list
.fd dd dll_list
 
pcidev_list:
.bk dd pcidev_list
.fd dd pcidev_list
 
MAX_DEFAULT_DLL_ADDR = 0x80000000
MIN_DEFAULT_DLL_ADDR = 0x70000000
dll_cur_addr dd MIN_DEFAULT_DLL_ADDR
332,8 → 324,6
mem_used_list rd 64*2
mem_hash_cnt rd 64
 
cpu_freq rq 1
 
heap_mutex MUTEX
heap_size rd 1
heap_free rd 1
392,6 → 382,7
 
LFBSize rd 1
 
stall_mcs rd 1
current_slot rd 1
 
; status
/kernel/branches/Kolibri-acpi/docs/sysfuncs.txt
3403,8 → 3403,6
* bit 6 (mask 0x40): CapsLock is on
* bit 7 (mask 0x80): NumLock is on
* bit 8 (mask 0x100): ScrollLock is on
* bit 9 (mask 0x200): left Win is pressed
* bit 10 (mask 0x400): right Win is pressed
* other bits are cleared
 
-------------- Subfunction 4 - set system-wide hotkey. ---------------
4557,7 → 4555,7
B - blit into the background surface
T - transparent blit
 
* ecx = pointer to the function parameters
* ecx = pointer to the function parametrs
destination offset and clipping
+0 signed dword: destination rectangle X offset from the window
top-left corner
4567,19 → 4565,18
+12 dword: destination rectangle height
 
source offset and clipping
+16 signed dword: source rectangle X offset from the bitmap
top-left corner
+20 signed dword: source rectangle Y offset from the bitmap
top-left corner
+16 signed dword: source rectangle X offset from the bitmap top-left corner
+20 signed dword: source rectangle Y offset from the bitmap top-left corner
+24 dword: source rectangle width
+28 dword: source rectangle height
 
+32: dword: bitmap data - must be 32bpp
+36: dword: size of the bitmap row in bytes
+32: dword: size of the bitmap row in bytes
+36: dword: bitmap data - must be 32bpp
 
Returned value:
* function does not return value
 
 
======================================================================
=============== Function -1 - terminate thread/process ===============
======================================================================
/kernel/branches/Kolibri-acpi/docs/sysfuncr.txt
3423,8 → 3423,6
* ¡¨â 6 (¬ áª  0x40): CapsLock ¢ª«îçñ­
* ¡¨â 7 (¬ áª  0x80): NumLock ¢ª«îçñ­
* ¡¨â 8 (¬ áª  0x100): ScrollLock ¢ª«îçñ­
* ¡¨â 9 (¬ áª  0x200): «¥¢ë© Win ­ ¦ â
* ¡¨â 10 (¬ áª  0x400): ¯à ¢ë© Win ­ ¦ â
* ¯à®ç¨¥ ¡¨âë á¡à®è¥­ë
 
----- ®¤äã­ªæ¨ï 4 - ãáâ ­®¢¨âì ®¡é¥á¨á⥬­ãî "£®àïçãî ª« ¢¨èã". -----
4574,46 → 4572,6
* eax = 1 - ¡ãä¥à § ¯®«­¥­
 
======================================================================
===================== ”ã­ªæ¨ï 73 - blit bitmap =====================
======================================================================
¡«¨â - ª®¯¨à®¢ ­¨¥ ¡¨â®¢®£® ¬ áᨢ
 
 à ¬¥âàë:
* eax = 73 - ­®¬¥à ä㭪樨
 
* ebx = ROP ¨ ®¯æ¨®­ «ì­ë¥ ä« £¨
31 6 5 4 3 0
[ reserved ][T][B][ROP]
ROP - ª®¤ à áâ஢ëå ®¯¥à æ¨©
0: ª®¯¨à®¢ âì
1-15: ‡ à¥§¥à¢¨à®¢ ­®
B - ¡«¨â ­  ä®­®¢ãî ¯®ä¥àå­®áâì
T - ¡«¨â á ¯à®§à ç­®áâìî
 
* ecx = 㪠§ â¥«ì ­  ¯ à ¬¥âàë ä㭪樨
ᬥ饭¨¥ 楫¨ÿ¨ ®âá¥ç¥­¨¥
+0 signed dword: ᬥ饭¨¥ ¯® X ®ª­ , ¤«ï 楫¥¢®£® ¯àאַ㣮«ì­¨ª 
¢¥àå­¨© «¥¢ë© 㣮«
+4 signed dword: ᬥ饭¨¥ ¯® Y ®ª­ , ¤«ï 楫¥¢®£® ¯àאַ㣮«ì­¨ª 
¢¥àå­¨© «¥¢ë© 㣮«
+8 dword: è¨à¨­  楫¥¢®£® ¯àאַ㣮«ì­¨ª 
+12 dword: ¢ëá®â  楫¥¢®£® ¯àאַ㣮«ì­¨ª 
 
ᬥ饭¨¥ ¨á室­¨ª ÿ¨ ®âá¥ç¥­¨¥
+16 signed dword: ᬥ饭¨¥ ¯® X bitmap, ¤«ï ¨á室­®£® ¯àאַ㣮«ì­¨ª 
¢¥àå­¨© «¥¢ë© 㣮«
+20 signed dword: ᬥ饭¨¥ ¯® Y bitmap, ¤«ï ¨á室­®£® ¯àאַ㣮«ì­¨ª 
¢¥àå­¨© «¥¢ë© 㣮«
+24 dword: è¨à¨­  ¨á室­®£® ¯àאַ㣮«ì­¨ª 
+28 dword: ¢ëá®â  ¨á室­®£® ¯àאַ㣮«ì­¨ª 
 
+32: dword: ¤ ­­ë¥ bitmap - ¤®«¦­ë ¡ëâì 32bpp
+36: dword: à §¬¥à áâப¨ bitmap ¢ ¡ ©â å
 
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* äã­ªæ¨ï ­¥ ¢®§¢à é ¥â §­ ç¥­¨ï
 
======================================================================
========== ”ã­ªæ¨ï -1 - § ¢¥àè¨âì ¢ë¯®«­¥­¨¥ ¯®â®ª /¯à®æ¥áá  =========
======================================================================
 à ¬¥âàë:
/kernel/branches/Kolibri-acpi/docs/drivers_api.txt
13,12 → 13,14
more DiskMediaChanged, then optionally DiskDel. The driver must not call
two functions in parallel, including two calls to DiskMediaChanged.
 
void* stdcall DiskAdd(DISKFUNC* functions, const char* name, void* userdata,
int flags); ; The pointer 'functions' must be valid at least until the disk
will be deleted ; (until DISKFUNC.close is called). ; The pointer 'name' can
be invalid after this function returns. ; It should point to ASCIIZ-string
without leading '/' in latin lowercase and ; digits, like 'usbhd0'. ; The
value 'userdata' is any pointer-sized data, passed as is to all ; callbacks.
void* DiskAdd(DISKFUNC* functions, const char* name, void* userdata, int flags);
; The pointer 'functions' must be valid at least until the disk will be deleted
; (until DISKFUNC.close is called).
; The pointer 'name' can be invalid after this function returns.
; It should point to ASCIIZ-string without leading '/' in latin lowercase and
; digits, like 'usbhd0'.
; The value 'userdata' is any pointer-sized data, passed as is to all
; callbacks.
DISK_NO_INSERT_NOTIFICATION = 1
; The bitfield 'flags' has currently only one bit defined. If it is set, the
; driver will never call DiskMediaChanged(hDisk, true), so the kernel must scan
27,13 → 29,13
{
.strucsize dd ?
.close dd ?
; void stdcall (*close)(void* userdata);
; void close(void* userdata);
; Optional.
; The last function that is called for the given disk. The kernel calls it when
; the kernel has finished all operations with the disk and it is safe to free
; all driver-specific data identified by 'userdata'.
.closemedia dd ?
; void stdcall (*closemedia)(void* userdata);
; void closemedia(void* userdata);
; Optional.
; The kernel calls this function when it finished all processing with the
; current media. If media is removed, the driver should decline all requests
41,25 → 43,25
; until this function is called. If media is removed, a new call to
; DiskMediaChanged(hDisk, true) is not allowed until this function is called.
.querymedia dd ?
; int stdcall (*querymedia)(void* userdata, DISKMEDIAINFO* info);
; int querymedia(void* userdata, DISKMEDIAINFO* info);
; return value: 0 = success, otherwise = error
.read dd ?
; int stdcall (*read)(void* userdata, void* buffer, __int64 startsector,
; int read(void* userdata, void* buffer, __int64 startsector,
; int* numsectors);
; return value: 0 = success, otherwise = error
.write dd ?
; int stdcall (*write)(void* userdata, const void* buffer, __int64 startsector,
; int write(void* userdata, const void* buffer, __int64 startsector,
; int* numsectors);
; Optional.
; return value: 0 = success, otherwise = error
.flush dd ?
; int stdcall (*flush)(void* userdata);
; int flush(void* userdata);
; Optional.
; Flushes the hardware cache, if it exists. Note that a driver should not
; implement a software cache for read/write, since they are called from the
; kernel cache manager.
.adjust_cache_size dd ?
; unsigned int stdcall (*adjust_cache_size)(unsigned int suggested_size);
; unsigned int adjust_cache_size(unsigned int suggested_size);
; Optional.
; Returns the cache size for this device in bytes. 0 = disable cache.
}
/kernel/branches/Kolibri-acpi/drivers/tmpdisk_fat.inc
74,7 → 74,7
mov edx, eax
@@:
; 2. Zero all system areas on the disk.
lea ecx, [256*(1+FAT16_ROOTDIR_SECTORS)+edx+255]
lea ecx, [256*(1+FAT16_ROOTDIR_SECTORS)/2+edx+255]
and ecx, not 255
shr ecx, 1
xor eax, eax
299,7 → 299,7
db 'KOLIBRI ' ; BS_OEMName
dw 512 ; BPB_BytsPerSec
db 1 ; BPB_SecsPerClus
dw 2 ; BPB_RsvdSecCnt
dw 1 ; BPB_RsvdSecCnt
db 1 ; BPB_NumFATs
dw 0 ; BPB_RootEntCnt
dw 0 ; BPB_TotSec16
/kernel/branches/Kolibri-acpi/fs/fs-sp.inc
File deleted
/kernel/branches/Kolibri-acpi/fs/ext2.inc
450,7 → 450,7
mov ebx, [ext2_data.ext2_temp_block]
call ext2_get_block
test eax, eax
jnz @F ;если не было ошибки
jz @F ;если не было ошибки
 
mov ecx, [ebx + ecx*4] ;заносим результат
@@:
565,7 → 565,7
rep movsd
pop ecx
@@:
cmp [ebp + EXT2_INODE_STRUC.i_size], 0 ;папка пуста
cmp [ebp + EXT2_INODE_STRUC.i_blocks], 0 ;папка пуста
je .error_empty_dir
push edx ;адрес результата [edi + 28]
616,7 → 616,6
test ebx, 0x3 ; длина записи должна делиться на 4
jnz .error_bad_len
 
sub [ebp + EXT2_INODE_STRUC.i_size], ebx ;вычитаем напрямую из структуры inode
add esi, ebx ; к следующей записи
cmp esi, [edi + 24] ; сравниваем с концом блока
jb .find_wanted_start
623,7 → 622,8
 
push .find_wanted_start
.end_block: ;вылетели из цикла
cmp [ebp + EXT2_INODE_STRUC.i_size], 0
mov ebx, [ext2_data.count_block_in_block]
sub [ebp + EXT2_INODE_STRUC.i_blocks], ebx ;вычитаем напрямую из структуры inode
jle .end_dir
 
inc dword [edi] ;получаем новый блок
727,7 → 727,6
test ebx, 0x3 ; длина записи должна делиться на 4
jnz .error_bad_len
 
sub [ebp + EXT2_INODE_STRUC.i_size], ebx ;вычитаем напрямую из структуры inode
add esi, ebx
cmp esi, [edi + 24] ;дошли ли до конца блока?
jb .wanted_start
896,13 → 895,15
jae .size_great_great
 
.size_great_less:
push 1 ;читаем по границе размера
push 1
; or [EXT2_files_in_folder], 1 ;читаем по границе размера
mov ecx, [ebp + EXT2_INODE_STRUC.i_size]
sub ecx, [esi] ;(размер - старт) = сколько читать
jmp @F
 
.size_great_great:
push 0 ;читаем столько сколько запросили
push 0
; and [EXT2_files_in_folder], 0 ;читаем столько сколько запросили
 
@@:
;здесь мы точно знаем сколько байт читать - ecx
918,7 → 919,7
mov eax, [esi]
div [ext2_data.block_size]
 
push eax ;счетчик блоков ложим в стек
push eax ;номер блока запоминаем
push ecx
mov ecx, eax
948,7 → 949,7
 
.zero_start:
mov eax, ecx
push 0 ;счетчик блоков ложим в стек
push 0 ;счетчик блоков
;теперь в eax кол-во оставшихся байт для чтения
.calc_blocks_count:
mov ebx, edi ;чтение блока прям в ->ebx
981,7 → 982,7
inc ecx
call ext2_get_inode_block
test eax, eax
jnz .error_at_finish_block
jz .error_at_finish_block
 
mov edi, ebx
mov eax, ecx
993,13 → 994,9
mov ecx, edx
mov esi, ebx
rep movsb ;кусок last блока
jmp @F
 
.end_read:
pop ecx ;счетчик блоков, который хранился в стеке
@@:
pop ebx ;количество считанных байт
pop eax ; 1 или 0 - достигли ли конца файла
pop ebx
pop eax
test eax, eax
jz @F
 
1012,6 → 1009,7
.only_one_block:
mov esi, ebx
rep movsb ;кусок last блока
pop eax
jmp .end_read
.error_at_first_block:
1096,7 → 1094,6
push [ebp + EXT2_INODE_STRUC.i_blocks]
xor ecx, ecx
.folder_block_cycle:
push ecx
call ext2_get_inode_block
test eax, eax
jnz .error_get_inode_block
1109,7 → 1106,7
push esi
call ext2_test_block_by_name
pop edi ecx
pop edi
 
cmp edi, esi ;нашли имя?
je .next_folder_block ;не нашли -> к след. блоку
1135,11 → 1132,11
sub eax, [ext2_data.count_block_in_block]
jle .not_found
push eax
inc ecx
jmp .folder_block_cycle
 
.not_found:
pop ebx
mov eax, ERROR_FILE_NOT_FOUND
ret
 
1155,7 → 1152,6
 
.error_get_inode_block:
.error_get_block:
pop ecx
.error_get_inode:
pop ebx
.error_empty_root:
/kernel/branches/Kolibri-acpi/fs/fat12.inc
2257,17 → 2257,15
popa
; delete FAT chain
pop eax
test eax, eax
jz .done
@@:
cmp eax, 2
jb .done
cmp eax, 0xFF8
jae .done
lea eax, [FLOPPY_FAT + eax*2]
push dword [eax]
and word [eax], 0
pop eax
and eax, 0xFFF
jmp @b
jnz @b
.done:
call save_flp_fat
pop edi
/kernel/branches/Kolibri-acpi/fs/fs.inc
21,10 → 21,6
 
 
iglobal
 
if lang eq sp
include 'fs/fs-sp.inc'
else
dir0:
db 'HARDDISK '
db 'RAMDISK '
37,7 → 33,6
db 'THIRD '
db 'FOURTH '
db 0
end if
 
not_select_IDE db 0
 
/kernel/branches/Kolibri-acpi/fs/fs_lfn.inc
103,17 → 103,6
dd 0
 
endg
 
file_system_lfn_protected:
pushad
call protect_from_terminate
call file_system_lfn
call unprotect_from_terminate
popad
mov [image_of_eax], eax
mov [image_of_ebx], ebx
ret
 
file_system_lfn:
; in: ebx->fileinfo block
; operation codes:
/kernel/branches/Kolibri-acpi/gui/char_sp.mt
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/kernel/branches/Kolibri-acpi/gui/char2_sp.mt
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/kernel/branches/Kolibri-acpi/gui/event.inc
165,7 → 165,6
; esi - event data (=0 => skip)
;scratched: ebx,ecx,esi,edi
call NotDummyTest ; not returned for fail !!!
mov [check_idle_semaphore], 5
or esi, esi
jz @f
lea edi, [ebx+EVENT.code]
308,23 → 307,6
jmp wait_finish
;-----------------------------------------------------------------------------
align 4
wait_event_timeout:
;param:
; eax - event
; ebx - uid (for Dummy testing)
; ecx - timeout in timer ticks
;retval:
; eax - EVENT handle or 0 if timeout
call DummyTest
mov ebx, ecx
mov ecx, eax ; wait_param
mov edx, get_event_alone ; wait_test
call Wait_events_ex
test eax, eax
jnz wait_finish
ret
;-----------------------------------------------------------------------------
align 4
get_event_ex: ;; f68:14
;info:
; Îæèäàíèå ëþáîãî ñîáûòèÿ â î÷åðåäè EventList òåêóùåãî ñëîòà
459,7 → 441,7
;--------------------------------------
align 4
.result:
setae byte[esp+32+4] ;ñ÷èòàåì, ÷òî èñõîäíî: dword[esp+32+4]==72
setae byte[esp+32] ;ñ÷èòàåì, ÷òî èñõîäíî: dword[esp+32]==72
;--------------------------------------
align 4
.retf:
485,11 → 467,9
;--------------------------------------
align 4
sys_wait_event_timeout: ;; f23
call unprotect_from_terminate
mov edx, get_event_for_app; wait_test
call Wait_events_ex ; ebx - timeout
mov [esp+32], eax
call protect_from_terminate
ret
;-----------------------------------------------------------------------------
align 4
/kernel/branches/Kolibri-acpi/gui/font.inc
7,8 → 7,6
 
$Revision$
 
include "lang.inc"
 
;------------------------------------------------------------------------------
align 4
dtext_asciiz_esi: ; for skins title out
233,17 → 231,9
;------------------------------------------------------------------------------
align 4
FONT_I:
if lang eq sp
file 'char_sp.mt'
else
file 'char.mt'
end if
;------------------------------------------------------------------------------
align 4
FONT_II:
if lang eq sp
file 'char2_sp.mt'
else
file 'char2.mt'
end if
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
/kernel/branches/Kolibri-acpi/gui/window.inc
381,16 → 381,6
push esi edx ecx ebx
mov eax, esp
mov bl, [edi + WDATA.fl_wstate]
;--------------------------------------
align 4
@@:
cmp [REDRAW_BACKGROUND], byte 0
jz @f
call change_task
jmp @b
;--------------------------------------
align 4
@@:
call window._.set_window_box
add esp, sizeof.BOX
 
/kernel/branches/Kolibri-acpi/hid/keyboard.inc
17,8 → 17,6
VKEY_CAPSLOCK = 0000000001000000b
VKEY_NUMLOCK = 0000000010000000b
VKEY_SCRLOCK = 0000000100000000b
VKEY_LWIN = 0000001000000000b
VKEY_RWIN = 0000010000000000b
 
VKEY_SHIFT = 0000000000000011b
VKEY_CONTROL = 0000000000001100b
226,30 → 224,7
xchg cl, [ext_code]
and al, 0x7F
mov bh, 1
;--------------------------------------
@@:
cmp al, 0x5B
jne @f
cmp cl, 0xE0
jne @f
mov eax, VKEY_LWIN
mov bh, 0
jmp .modifier
;--------------------------------------
@@:
cmp al, 0x5C
jne @f
cmp cl, 0xE0
jne @f
mov eax, VKEY_RWIN
mov bh, 0
jmp .modifier
;--------------------------------------
@@:
cmp al, 0x2A
jne @f
384,6 → 359,9
xor [kb_state], eax
xor [kb_lights], bl
push ecx
call set_lights
pop ecx
.writekey:
pushad
; test for system hotkeys
517,12 → 495,10
ret
 
ps2_set_lights:
stdcall disable_irq, 1
mov al, 0xED
call kb_write
mov al, [esp+8]
call kb_write
stdcall enable_irq, 1
ret 8
 
;// mike.dld ]
/kernel/branches/Kolibri-acpi/kernel.asm
66,8 → 66,6
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
format binary as "mnt"
 
include 'macros.inc'
include 'struct.inc'
 
133,19 → 131,13
org 0x0
jmp start_of_code
 
if lang eq sp
include "kernelsp.inc" ; spanish kernel messages
else
version db 'Kolibri OS version 0.7.7.0+ ',13,10,13,10,0
end if
 
include "boot/bootstr.inc" ; language-independent boot messages
include "boot/preboot.inc"
 
if lang eq ge
include "boot/bootge.inc" ; german system boot messages
else if lang eq sp
include "boot/bootsp.inc" ; spanish system boot messages
if lang eq en
include "boot/booteng.inc" ; english system boot messages
else if lang eq ru
include "boot/bootru.inc" ; russian system boot messages
include "boot/ru.inc" ; Russian font
153,7 → 145,7
include "boot/bootet.inc" ; estonian system boot messages
include "boot/et.inc" ; Estonian font
else
include "boot/booten.inc" ; english system boot messages
include "boot/bootge.inc" ; german system boot messages
end if
 
include "boot/bootcode.inc" ; 16 bit system boot code
169,6 → 161,8
 
; CR0 Flags - Protected mode and Paging
 
align 16
 
mov ecx, CR0_PE
 
; Enabling 32 bit protected mode
206,6 → 200,20
mov cr0, eax
jmp pword os_code:B32 ; jmp to enable 32 bit mode
 
include "boot/shutdown.inc" ; shutdown or restart
 
include "data16.inc"
 
align 4096
__ap_start_16:
cli
lgdt [cs:(tmp_gdt-__ap_start_16)] ; Load GDT
mov eax, cr0 ; protected mode
or eax, CR0_PE
and eax, 10011111b *65536*256 + 0xffffff ; caching enabled
mov cr0, eax
jmp pword os_code:__ap_start_32 ; jmp to enable 32 bit mode
 
align 8
tmp_gdt:
 
225,11 → 233,37
dw 11011111b *256 +10010010b
db 0x00
 
include "data16.inc"
 
use32
org $+0x10000
 
align 16
__ap_start_32:
mov ax, os_stack ; Selector for os
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
 
bt [cpu_caps-OS_BASE], CAPS_PSE
jnc .no_PSE
 
mov ebx, cr4
or ebx, CR4_PSE
mov eax, PG_LARGE+PG_SW
mov cr4, ebx
.no_PSE:
mov eax, sys_pgdir-OS_BASE
mov cr3, eax
 
mov eax, cr0
or eax, CR0_PG+CR0_WP
mov cr0, eax
 
lgdt [gdts]
jmp pword os_code:ap_entry
 
align 4
B32:
mov ax, os_stack ; Selector for os
291,11 → 325,6
bios32_entry dd ?
tmp_page_tabs dd ?
 
use16
org $-0x10000
include "boot/shutdown.inc" ; shutdown or restart
org $+0x10000
use32
 
__DEBUG__ fix 1
__DEBUG_LEVEL__ fix 1
305,6 → 334,37
 
include 'fdo.inc'
 
ap_entry:
bt [cpu_caps], CAPS_PGE
jnc @F
 
mov ebx, cr4
or ebx, CR4_PGE
mov cr4, ebx
@@:
mov esi, [LAPIC_BASE]
xor ebp, ebp
.1:
mov ebx, [esi+0x20] ;apic_id
shr ebx, 24
shl ebx, 6+2
add ebx, LFB_BASE
mov edx, 32
.2:
mov ecx, 32
mov edi, ebx
mov eax, [_display.width]
lea ebx, [ebx+eax*4]
mov eax, ebp
rep stosd
dec edx
jnz .2
dec ebp
jmp .1
 
hlt
jmp ap_entry
 
align 4
high_code:
mov ax, os_stack
327,12 → 387,12
or ebx, CR4_PGE
mov cr4, ebx
@@:
xor eax, eax
mov dword [sys_pgdir], eax
mov dword [sys_pgdir+4], eax
; xor eax, eax
; mov dword [sys_pgdir], eax
; mov dword [sys_pgdir+4], eax
 
mov eax, cr3
mov cr3, eax ; flush TLB
; mov eax, cr3
; mov cr3, eax ; flush TLB
 
mov ecx, pg_data.mutex
call mutex_init
614,52 → 674,6
mov [mem_BACKGROUND], 4
mov [img_background], static_background_data
 
; SET UP OS TASK
 
mov esi, boot_setostask
call boot_log
 
xor eax, eax
mov dword [SLOT_BASE+APPDATA.fpu_state], fpu_data
mov dword [SLOT_BASE+APPDATA.exc_handler], eax
mov dword [SLOT_BASE+APPDATA.except_mask], eax
 
; name for OS/IDLE process
 
mov dword [SLOT_BASE+256+APPDATA.app_name], dword 'OS/I'
mov dword [SLOT_BASE+256+APPDATA.app_name+4], dword 'DLE '
mov edi, [os_stack_seg]
mov dword [SLOT_BASE+256+APPDATA.pl0_stack], edi
add edi, 0x2000-512
mov dword [SLOT_BASE+256+APPDATA.fpu_state], edi
mov dword [SLOT_BASE+256+APPDATA.saved_esp0], edi; just for case
mov dword [SLOT_BASE+256+APPDATA.terminate_protection], 80000001h
 
mov esi, fpu_data
mov ecx, 512/4
cld
rep movsd
 
mov dword [SLOT_BASE+256+APPDATA.exc_handler], eax
mov dword [SLOT_BASE+256+APPDATA.except_mask], eax
 
mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET
mov dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
mov dword [SLOT_BASE+256+APPDATA.bk_obj], ebx
 
mov dword [SLOT_BASE+256+APPDATA.cur_dir], sysdir_path
mov dword [SLOT_BASE+256+APPDATA.tls_base], eax
 
; task list
mov dword [TASK_DATA+TASKDATA.mem_start], eax; process base address
inc eax
mov dword [CURRENT_TASK], eax
mov dword [TASK_COUNT], eax
mov [current_slot], SLOT_BASE+256
mov [TASK_BASE], dword TASK_DATA
mov byte[TASK_DATA+TASKDATA.wnd_number], al ; on screen number
mov dword [TASK_DATA+TASKDATA.pid], eax ; process id number
 
mov [SLOT_BASE + 256 + APPDATA.dir_table], sys_pgdir - OS_BASE
 
stdcall kernel_alloc, 0x10000/8
693,8 → 707,11
; Try to Initialize APIC
call APIC_init
 
mov esi, boot_enableirq
call boot_log
call LAPIC_init
 
; mov eax, 1
; call start_ap
 
; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15)
; they are used: when partitions are scanned, hd_read relies on timer
call unmask_timer
777,8 → 794,6
movzx ecx, word [boot_y]
if lang eq ru
or ecx, (10+30*6) shl 16
else if lang eq sp
or ecx, (10+33*6) shl 16
else
or ecx, (10+29*6) shl 16
end if
799,8 → 814,8
; call boot_log
 
mov [pci_access_enabled], 1
call pci_enum
 
 
; SET PRELIMINARY WINDOW STACK AND POSITIONS
 
mov esi, boot_windefs
820,6 → 835,52
call boot_log
call reserve_irqs_ports
 
; SET UP OS TASK
 
mov esi, boot_setostask
call boot_log
 
xor eax, eax
mov dword [SLOT_BASE+APPDATA.fpu_state], fpu_data
mov dword [SLOT_BASE+APPDATA.exc_handler], eax
mov dword [SLOT_BASE+APPDATA.except_mask], eax
 
; name for OS/IDLE process
 
mov dword [SLOT_BASE+256+APPDATA.app_name], dword 'OS/I'
mov dword [SLOT_BASE+256+APPDATA.app_name+4], dword 'DLE '
mov edi, [os_stack_seg]
mov dword [SLOT_BASE+256+APPDATA.pl0_stack], edi
add edi, 0x2000-512
mov dword [SLOT_BASE+256+APPDATA.fpu_state], edi
mov dword [SLOT_BASE+256+APPDATA.saved_esp0], edi; just for case
; [SLOT_BASE+256+APPDATA.io_map] was set earlier
 
mov esi, fpu_data
mov ecx, 512/4
cld
rep movsd
 
mov dword [SLOT_BASE+256+APPDATA.exc_handler], eax
mov dword [SLOT_BASE+256+APPDATA.except_mask], eax
 
mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET
mov dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
mov dword [SLOT_BASE+256+APPDATA.bk_obj], ebx
 
mov dword [SLOT_BASE+256+APPDATA.cur_dir], sysdir_path
mov dword [SLOT_BASE+256+APPDATA.tls_base], eax
 
; task list
mov dword [TASK_DATA+TASKDATA.mem_start], eax; process base address
inc eax
mov dword [CURRENT_TASK], eax
mov dword [TASK_COUNT], eax
mov [current_slot], SLOT_BASE+256
mov [TASK_BASE], dword TASK_DATA
mov byte[TASK_DATA+TASKDATA.wnd_number], al ; on screen number
mov dword [TASK_DATA+TASKDATA.pid], eax ; process id number
 
call init_display
mov eax, [def_cursor]
mov [SLOT_BASE+APPDATA.cursor], eax
837,11 → 898,17
rdtsc ;call _rdtsc
sti
sub eax, ecx
xor edx, edx
shld edx, eax, 2
shl eax, 2
mov dword [cpu_freq], eax
mov dword [cpu_freq+4], edx
mov [CPU_FREQ], eax ; save tsc / sec
; mov ebx, 1000000
; div ebx
; ¢®®¡é¥-â® ¯à®¨§¢®¤¨â¥«ì­®áâì ¢ ¤ ­­®¬ ª®­ªà¥â­®¬ ¬¥áâ¥
; ᮢ¥à襭­® ­¥ªà¨â¨ç­ , ­® çâ®¡ë § âª­ãâì «î¡¨â¥«¥©
; ®¯â¨¬¨§¨àãîé¨å ª®¬¯¨«ïâ®à®¢ Ÿ‚“...
mov edx, 2251799814
mul edx
shr edx, 19
mov [stall_mcs], edx
; PRINT CPU FREQUENCY
mov esi, boot_cpufreq
call boot_log
850,8 → 917,6
movzx ecx, word [boot_y]
if lang eq ru
add ecx, (10+19*6) shl 16 - 10 ; 'Determining amount of memory'
else if lang eq sp
add ecx, (10+25*6) shl 16 - 10 ; 'Determining amount of memory'
else
add ecx, (10+17*6) shl 16 - 10 ; 'Determining amount of memory'
end if
927,8 → 992,8
call fs_execute_from_sysdir
 
; cmp eax,2 ; continue if a process has been loaded
test eax, eax
jns first_app_found
sub eax, 2
jz first_app_found
 
mov esi, boot_failed
call boot_log
1034,8 → 1099,6
 
 
end if
mov eax, [version_inf.rev]
DEBUGF 1, "K : kernel SVN r%d\n", eax
 
mov eax, [cpu_count]
test eax, eax
1044,7 → 1107,7
@@:
DEBUGF 1, "K : %d CPU detected\n", eax
 
; call print_mem
call print_mem
 
; START MULTITASKING
 
1177,7 → 1240,7
 
mov [eax+16], ecx
mov [eax+16+4], dword 0
mov [eax+16+8], dword 0x2D
mov [eax+16+4], dword 0x2D
 
mov [eax+32], ecx
mov [eax+32+4], dword 0x30
1185,7 → 1248,7
 
mov [eax+48], ecx
mov [eax+48+4], dword 0x50
mov [eax+48+8], dword 0xDF
mov [eax+28+8], dword 0xDF
 
mov [eax+64], ecx
mov [eax+64+4], dword 0xE5
2036,6 → 2099,8
@@:
mov [redrawmouse_unconditional], 1
popfd
; call [draw_pointer]
call __sys_draw_pointer
ret
;------------------------------------------------------------------------------
iglobal
2108,12 → 2173,6
add ecx, CURRENT_TASK+TASKDATA.state
cmp byte [ecx], 9
jz noprocessterminate
push ecx edx
lea edx, [(ecx-(CURRENT_TASK and 1FFFFFFFh)-TASKDATA.state)*8+SLOT_BASE]
call request_terminate
pop edx ecx
test eax, eax
jz noprocessterminate
;--------------------------------------
cmp [_display.select_cursor], 0
je .restore_end
2201,18 → 2260,7
jb .nowindowactivate
cmp ecx, [TASK_COUNT]
ja .nowindowactivate
;-------------------------------------
@@:
; If the window is captured and moved by the user,
; then you can't change the position in window stack!!!
mov al, [mouse.active_sys_window.action]
and al, WINDOW_MOVE_AND_RESIZE_FLAGS
test al, al
jz @f
call change_task
jmp @b
@@:
;-------------------------------------
 
mov [window_minimize], 2; restore window if minimized
 
movzx esi, word [WIN_STACK + ecx*2]
2234,14 → 2282,10
ret
;------------------------------------------------------------------------------
sysfn_getcpuclock: ; 18.5 = GET TSC/SEC
mov eax, dword [cpu_freq]
mov eax, [CPU_FREQ]
mov [esp+32], eax
ret
;------------------------------------------------------------------------------
get_cpu_freq:
mov eax, dword [cpu_freq]
mov edx, dword [cpu_freq+4]
ret
; SAVE ramdisk to /hd/1/menuet.img
;!!!!!!!!!!!!!!!!!!!!!!!!
include 'blkdev/rdsave.inc'
2491,7 → 2535,7
version_inf:
db 0,7,7,0 ; version 0.7.7.0
db 0
.rev dd __REV__
dd __REV__
version_end:
endg
;------------------------------------------------------------------------------
3500,31 → 3544,15
mov edx, [shutdown_processes]
 
cmp [SYS_SHUTDOWN], dl
jne noshutdown
jne no_mark_system_shutdown
 
lea ecx, [edx-1]
mov edx, OS_BASE+0x3040
jecxz no_mark_system_shutdown
jecxz @f
;--------------------------------------
align 4
markz:
push ecx edx
cmp [edx+TASKDATA.state], 9
jz .nokill
lea edx, [(edx-(CURRENT_TASK and 1FFFFFFFh))*8+SLOT_BASE]
cmp [edx+APPDATA.dir_table], sys_pgdir - OS_BASE
jz .nokill
call request_terminate
jmp .common
.nokill:
dec byte [SYS_SHUTDOWN]
xor eax, eax
.common:
pop edx ecx
test eax, eax
jz @f
mov [edx+TASKDATA.state], byte 3
@@:
add edx, 0x20
loop markz
;--------------------------------------
3544,27 → 3572,11
newct:
mov cl, [ebx]
cmp cl, byte 3
jz .terminate
jz terminate
 
cmp cl, byte 4
jnz .noterminate
.terminate:
pushad
mov ecx, eax
shl ecx, 8
add ecx, SLOT_BASE
call restore_default_cursor_before_killing
popad
jz terminate
 
pushad
call terminate
popad
cmp byte [SYS_SHUTDOWN], 0
jz .noterminate
dec byte [SYS_SHUTDOWN]
je system_shutdown
 
.noterminate:
add ebx, 0x20
inc esi
dec eax
3774,15 → 3786,6
mov [esp+32], eax ; return old mask value
ret
;-----------------------------------------------------------------------------
 
; this is for syscall
proc delay_hs_unprotected
call unprotect_from_terminate
call delay_hs
call protect_from_terminate
ret
endp
 
align 4
delay_hs: ; delay in 1/100 secs
; ebx = delay time
4635,10 → 4638,9
popad
ret
 
msg_board_data_size = 65536 ; Must be power of two
 
uglobal
msg_board_data rb msg_board_data_size
msg_board_data:
times 4096 db 0
msg_board_count dd 0x0
endg
 
4671,7 → 4673,7
 
mov [msg_board_data+ecx], bl
inc ecx
and ecx, msg_board_data_size - 1
and ecx, 4095
mov [msg_board_count], ecx
mov [check_idle_semaphore], 5
ret
4764,8 → 4766,7
mov [eax], edx
mov [ecx], eax
mov [eax+12], ecx
test edx, edx
jz @f
jecxz @f
mov [edx+12], eax
@@:
and dword [esp+32], 0
4917,11 → 4918,7
add ebp, [eax-twdw+WDATA.box.top]
add bp, word[esi+APPDATA.wnd_clientbox.top]
pop esi
test ecx, 0x08000000 ; redirect the output to the user area
jnz @f
add ebx, ebp
align 4
@@:
mov eax, edi
test ecx, 0x08000000 ; redirect the output to the user area
jnz dtext
5701,6 → 5698,4
__REV__ = __REV
 
uglobals_size = $ - endofcode
if ~ lang eq sp
diff16 "end of kernel code",0,$
end if
/kernel/branches/Kolibri-acpi/const.inc
218,10 → 218,10
BTN_COUNT equ (OS_BASE+0x000F500)
BTN_BUFF equ (OS_BASE+0x000F501)
 
;CPU_FREQ equ (OS_BASE+0x000F600)
CPU_FREQ equ (OS_BASE+0x000F600)
 
;unused ? no active references
;MOUSE_PORT equ (OS_BASE+0x000F604)
MOUSE_PORT equ (OS_BASE+0x000F604)
 
;unused
PS2_CHUNK equ (OS_BASE+0x000FB00)
570,35 → 570,6
count dd ?
ends
 
struct PCIDEV
bk dd ?
fd dd ?
vendor_device_id dd ?
class dd ?
devfn db ?
bus db ?
ends
 
; The following macro assume that we are on uniprocessor machine.
; Serious work is needed for multiprocessor machines.
macro spin_lock_irqsave spinlock
{
pushf
cli
}
macro spin_unlock_irqrestore spinlock
{
popf
}
macro spin_lock_irq spinlock
{
cli
}
macro spin_unlock_irq spinlock
{
sti
}
 
struct MEM_STATE
mutex MUTEX
smallmap dd ?
/kernel/branches/Kolibri-acpi/bootloader/boot_fat12.asm
15,8 → 15,6
;
; Version 1.0
 
include "lang.inc"
 
lf equ 0ah
cr equ 0dh
 
264,11 → 262,7
retn
;------------------------------------------
 
if lang eq sp
loading db cr,lf,'Iniciando el sistema ',00h
else
loading db cr,lf,'Starting system ',00h
end if
error_message db 13,10
kernel_name db 'KERNEL MNT ?',cr,lf,00h
FirstRootDirSecNum dw ?
/kernel/branches/Kolibri-acpi/bus/pci/pci32.inc
155,12 → 155,12
align 4
 
pci_read_reg:
push ebx esi
cmp byte [BOOT_VAR+0x9020], 2;what mechanism will we use?
je pci_read_reg_2
 
; mechanism 1
mov esi, eax ; save register size into ESI
push esi ; save register size into ESI
mov esi, eax
and esi, 3
 
call pci_make_config_cmd
202,7 → 202,7
out dx, eax
 
pop eax
pop esi ebx
pop esi
ret
pci_read_reg_2:
 
209,7 → 209,8
test bh, 128 ;mech#2 only supports 16 devices per bus
jnz pci_read_reg_err
 
mov esi, eax ; save register size into ESI
push esi; save register size into ESI
mov esi, eax
and esi, 3
 
push eax
261,13 → 262,12
out dx, al
 
pop eax
pop esi ebx
pop esi
ret
 
pci_read_reg_err:
xor eax, eax
dec eax
pop esi ebx
ret
 
 
286,12 → 286,12
align 4
 
pci_write_reg:
push esi ebx
cmp byte [BOOT_VAR+0x9020], 2;what mechanism will we use?
je pci_write_reg_2
 
; mechanism 1
mov esi, eax ; save register size into ESI
push esi ; save register size into ESI
mov esi, eax
and esi, 3
 
call pci_make_config_cmd
335,7 → 335,7
out dx, eax
 
xor eax, eax
pop ebx esi
pop esi
 
ret
pci_write_reg_2:
344,7 → 344,8
jnz pci_write_reg_err
 
 
mov esi, eax ; save register size into ESI
push esi; save register size into ESI
mov esi, eax
and esi, 3
 
push eax
396,13 → 397,12
out dx, al
 
xor eax, eax
pop ebx esi
pop esi
ret
 
pci_write_reg_err:
xor eax, eax
dec eax
pop ebx esi
ret
 
if defined mmio_pci_addr ; must be set above
658,67 → 658,3
.return_a:
mov dword[esp + 32], eax
ret
 
proc pci_enum
push ebp
mov ebp, esp
push 0
virtual at ebp-4
.devfn db ?
.bus db ?
end virtual
.loop:
mov ah, [.bus]
mov al, 2
mov bh, [.devfn]
mov bl, 0
call pci_read_reg
cmp eax, 0xFFFFFFFF
jnz .has_device
test byte [.devfn], 7
jnz .next_func
jmp .no_device
.has_device:
push eax
push sizeof.PCIDEV
pop eax
call malloc
pop ecx
test eax, eax
jz .nomemory
mov edi, eax
mov [edi+PCIDEV.vendor_device_id], ecx
mov eax, pcidev_list
mov ecx, [eax+PCIDEV.bk]
mov [edi+PCIDEV.bk], ecx
mov [edi+PCIDEV.fd], eax
mov [ecx+PCIDEV.fd], edi
mov [eax+PCIDEV.bk], edi
mov eax, dword [.devfn]
mov word [edi+PCIDEV.devfn], ax
mov bh, al
mov al, 2
mov bl, 8
call pci_read_reg
shr eax, 8
mov [edi+PCIDEV.class], eax
test byte [.devfn], 7
jnz .next_func
mov ah, [.bus]
mov al, 0
mov bh, [.devfn]
mov bl, 0Eh
call pci_read_reg
test al, al
js .next_func
.no_device:
or byte [.devfn], 7
.next_func:
inc dword [.devfn]
mov ah, [.bus]
cmp ah, [BOOT_VAR+0x9021]
jbe .loop
.nomemory:
leave
ret
endp
/kernel/branches/Kolibri-acpi/kernel32.inc
137,7 → 137,7
ipc_size dd ?
event_mask dd ?
debugger_slot dd ?
terminate_protection dd ?
dd ?
keyboard_mode db ?
rb 3
dir_table dd ?