forked from KolibriOS/kolibrios
kolibri-acpi: update
git-svn-id: svn://kolibrios.org@3232 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
6e6fb52d02
commit
5690f9671b
@ -459,7 +459,9 @@ disk_dereference:
|
|||||||
stdcall disk_call_driver
|
stdcall disk_call_driver
|
||||||
; 3b. Free the structure.
|
; 3b. Free the structure.
|
||||||
xchg eax, esi
|
xchg eax, esi
|
||||||
|
push ebx
|
||||||
call free
|
call free
|
||||||
|
pop ebx
|
||||||
; 4. Return.
|
; 4. Return.
|
||||||
.nothing:
|
.nothing:
|
||||||
ret
|
ret
|
||||||
@ -626,8 +628,8 @@ disk_default_flush:
|
|||||||
|
|
||||||
; The default implementation of DISKFUNC.adjust_cache_size.
|
; The default implementation of DISKFUNC.adjust_cache_size.
|
||||||
disk_default_adjust_cache_size:
|
disk_default_adjust_cache_size:
|
||||||
mov eax, [esp+4]
|
mov eax, [esp+8]
|
||||||
ret 4
|
ret 8
|
||||||
|
|
||||||
; This is an internal function called from 'disk_media_changed' when a new media
|
; This is an internal function called from 'disk_media_changed' when a new media
|
||||||
; is detected. It creates the list of partitions for the media.
|
; is detected. It creates the list of partitions for the media.
|
||||||
|
@ -135,7 +135,7 @@ end virtual
|
|||||||
push esp
|
push esp
|
||||||
push edx
|
push edx
|
||||||
push [.sector_lo+12]
|
push [.sector_lo+12]
|
||||||
mov ecx, [.cache]
|
mov ecx, [.cache+16]
|
||||||
mov eax, edi
|
mov eax, edi
|
||||||
shl eax, 9
|
shl eax, 9
|
||||||
add eax, [ecx+DISKCACHE.data]
|
add eax, [ecx+DISKCACHE.data]
|
||||||
@ -317,7 +317,7 @@ end virtual
|
|||||||
|
|
||||||
.yes_in_cache_write:
|
.yes_in_cache_write:
|
||||||
|
|
||||||
mov dword [esi+4], 2 ; write - differs from hd
|
mov dword [esi+8], 2 ; write - differs from hd
|
||||||
|
|
||||||
shl edi, 9
|
shl edi, 9
|
||||||
mov ecx, [.cache]
|
mov ecx, [.cache]
|
||||||
@ -373,11 +373,12 @@ find_empty_slot64:
|
|||||||
; This function is intended to replace the old 'write_cache' function.
|
; This function is intended to replace the old 'write_cache' function.
|
||||||
proc write_cache64 uses ecx edx esi edi, disk:dword
|
proc write_cache64 uses ecx edx esi edi, disk:dword
|
||||||
locals
|
locals
|
||||||
cache_chain_started dd ?
|
cache_chain_started dd 0
|
||||||
cache_chain_size dd ?
|
cache_chain_size dd ?
|
||||||
cache_chain_pos dd ?
|
cache_chain_pos dd ?
|
||||||
cache_chain_ptr dd ?
|
cache_chain_ptr dd ?
|
||||||
endl
|
endl
|
||||||
|
saved_esi_pos = 16+12 ; size of local variables + size of registers before esi
|
||||||
; If there is no cache for this disk, nothing to do.
|
; If there is no cache for this disk, nothing to do.
|
||||||
cmp [esi+DISKCACHE.pointer], 0
|
cmp [esi+DISKCACHE.pointer], 0
|
||||||
jz .flush
|
jz .flush
|
||||||
@ -465,7 +466,7 @@ endl
|
|||||||
.write_cache_chain:
|
.write_cache_chain:
|
||||||
pusha
|
pusha
|
||||||
mov edi, [cache_chain_pos]
|
mov edi, [cache_chain_pos]
|
||||||
mov ecx, [ebp-12]
|
mov ecx, [ebp-saved_esi_pos]
|
||||||
shl edi, 9
|
shl edi, 9
|
||||||
add edi, [ecx+DISKCACHE.data]
|
add edi, [ecx+DISKCACHE.data]
|
||||||
mov ecx, [cache_chain_size]
|
mov ecx, [cache_chain_size]
|
||||||
@ -549,7 +550,7 @@ disk_init_cache:
|
|||||||
|
|
||||||
mov eax, [esi+DISK.SysCache.data_size]
|
mov eax, [esi+DISK.SysCache.data_size]
|
||||||
push ebx
|
push ebx
|
||||||
call calculate_for_hd
|
call calculate_for_hd64
|
||||||
pop ebx
|
pop ebx
|
||||||
add eax, [esi+DISK.SysCache.pointer]
|
add eax, [esi+DISK.SysCache.pointer]
|
||||||
mov [esi+DISK.SysCache.data], eax
|
mov [esi+DISK.SysCache.data], eax
|
||||||
@ -564,7 +565,7 @@ disk_init_cache:
|
|||||||
|
|
||||||
mov eax, [esi+DISK.AppCache.data_size]
|
mov eax, [esi+DISK.AppCache.data_size]
|
||||||
push ebx
|
push ebx
|
||||||
call calculate_for_hd
|
call calculate_for_hd64
|
||||||
pop ebx
|
pop ebx
|
||||||
add eax, [esi+DISK.AppCache.pointer]
|
add eax, [esi+DISK.AppCache.pointer]
|
||||||
mov [esi+DISK.AppCache.data], eax
|
mov [esi+DISK.AppCache.data], eax
|
||||||
@ -590,6 +591,22 @@ disk_init_cache:
|
|||||||
mov al, 1
|
mov al, 1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
calculate_for_hd64:
|
||||||
|
push eax
|
||||||
|
mov ebx, eax
|
||||||
|
shr eax, 9
|
||||||
|
lea eax, [eax*3]
|
||||||
|
shl eax, 2
|
||||||
|
sub ebx, eax
|
||||||
|
shr ebx, 9
|
||||||
|
mov ecx, ebx
|
||||||
|
shl ebx, 9
|
||||||
|
pop eax
|
||||||
|
sub eax, ebx
|
||||||
|
dec ecx
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
; This internal function is called from disk_media_dereference to free the
|
; This internal function is called from disk_media_dereference to free the
|
||||||
; allocated cache, if there is one.
|
; allocated cache, if there is one.
|
||||||
; esi = pointer to DISK structure
|
; esi = pointer to DISK structure
|
||||||
|
@ -217,7 +217,7 @@ calc_vmodes_table:
|
|||||||
test [es:mi.ModeAttributes], 10000000b ;LFB ?
|
test [es:mi.ModeAttributes], 10000000b ;LFB ?
|
||||||
jz @f
|
jz @f
|
||||||
|
|
||||||
cmp [es:mi.BitsPerPixel], 24 ;It show only videomodes to have support 24 and 32 bpp
|
cmp [es:mi.BitsPerPixel], 32 ;It show only videomodes to have support 24 and 32 bpp
|
||||||
jb @f
|
jb @f
|
||||||
|
|
||||||
; cmp [es:mi.BitsPerPixel],16
|
; cmp [es:mi.BitsPerPixel],16
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
cls
|
cls
|
||||||
set languages=en ru ge et
|
set languages=en ru ge et
|
||||||
set drivers=com_mouse emu10k1x fm801 infinity sis sound viasound vt823x
|
set drivers=com_mouse emu10k1x fm801 infinity sis sound viasound vt823x
|
||||||
set targets=all kernel drivers skins clean
|
set targets=all kernel drivers clean
|
||||||
|
|
||||||
call :Check_Target %1
|
call :Check_Target %1
|
||||||
for %%a in (all kernel) do if %%a==%target% call :Check_Lang %2
|
for %%a in (all kernel) do if %%a==%target% call :Check_Lang %2
|
||||||
@ -59,7 +59,6 @@ goto :eof
|
|||||||
:Target_all
|
:Target_all
|
||||||
call :Target_kernel
|
call :Target_kernel
|
||||||
call :Target_drivers
|
call :Target_drivers
|
||||||
call :Target_skins
|
|
||||||
goto :eof
|
goto :eof
|
||||||
|
|
||||||
|
|
||||||
@ -102,16 +101,6 @@ if "%res%"=="y" (
|
|||||||
goto :eof
|
goto :eof
|
||||||
|
|
||||||
|
|
||||||
:Target_skins
|
|
||||||
echo *** building skins ...
|
|
||||||
|
|
||||||
if not exist bin\skins mkdir bin\skins
|
|
||||||
cd skin
|
|
||||||
fasm -m 65536 default.asm ..\bin\skins\default.skn
|
|
||||||
if not %errorlevel%==0 goto :Error_FasmFailed
|
|
||||||
cd ..
|
|
||||||
goto :eof
|
|
||||||
|
|
||||||
:Target_clean
|
:Target_clean
|
||||||
echo *** cleaning ...
|
echo *** cleaning ...
|
||||||
rmdir /S /Q bin
|
rmdir /S /Q bin
|
||||||
|
@ -810,15 +810,7 @@ proc load_driver stdcall, driver_name:dword
|
|||||||
jnz .ok
|
jnz .ok
|
||||||
|
|
||||||
stdcall kernel_free, [img_base]
|
stdcall kernel_free, [img_base]
|
||||||
cmp dword [file_name+13], 'SOUN'
|
|
||||||
jnz @f
|
|
||||||
cmp dword [file_name+17], 'D.ob'
|
|
||||||
jnz @f
|
|
||||||
cmp word [file_name+21], 'j'
|
|
||||||
jnz @f
|
|
||||||
mov esi, aHDA
|
|
||||||
jmp .redo
|
|
||||||
@@:
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
.ok:
|
.ok:
|
||||||
|
@ -341,10 +341,9 @@ free:
|
|||||||
; insert_chunk(p,psize);
|
; insert_chunk(p,psize);
|
||||||
|
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
pop esi
|
|
||||||
mov ecx, edi
|
mov ecx, edi
|
||||||
pop edi
|
call insert_chunk
|
||||||
jmp insert_chunk
|
jmp .fail2
|
||||||
.unl_large:
|
.unl_large:
|
||||||
|
|
||||||
; unlink_large_chunk((tchunkptr)next);
|
; unlink_large_chunk((tchunkptr)next);
|
||||||
@ -364,10 +363,9 @@ free:
|
|||||||
; insert_chunk(p,psize);
|
; insert_chunk(p,psize);
|
||||||
|
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
pop esi
|
|
||||||
mov ecx, edi
|
mov ecx, edi
|
||||||
pop edi
|
call insert_chunk
|
||||||
jmp insert_chunk
|
jmp .fail2
|
||||||
.fix_next:
|
.fix_next:
|
||||||
|
|
||||||
; (p+psize)->prev_foot = psize;
|
; (p+psize)->prev_foot = psize;
|
||||||
@ -386,10 +384,9 @@ free:
|
|||||||
; insert_chunk(p,psize);
|
; insert_chunk(p,psize);
|
||||||
|
|
||||||
mov eax, esi
|
mov eax, esi
|
||||||
pop esi
|
|
||||||
mov ecx, edi
|
mov ecx, edi
|
||||||
pop edi
|
call insert_chunk
|
||||||
jmp insert_chunk
|
jmp .fail2
|
||||||
|
|
||||||
; param
|
; param
|
||||||
; ecx = chunk
|
; ecx = chunk
|
||||||
@ -418,15 +415,11 @@ insert_chunk:
|
|||||||
mov [esi+8], edx ;P->fd = F
|
mov [esi+8], edx ;P->fd = F
|
||||||
mov [esi+12], eax ;P->bk = B
|
mov [esi+12], eax ;P->bk = B
|
||||||
pop esi
|
pop esi
|
||||||
mov ecx, mst.mutex
|
|
||||||
call mutex_unlock
|
|
||||||
ret
|
ret
|
||||||
.large:
|
.large:
|
||||||
mov ebx, eax
|
mov ebx, eax
|
||||||
call insert_large_chunk
|
call insert_large_chunk
|
||||||
pop esi
|
pop esi
|
||||||
mov ecx, mst.mutex
|
|
||||||
call mutex_unlock
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
@ -606,8 +606,12 @@ update_mem_size:
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
get_pg_addr:
|
get_pg_addr:
|
||||||
|
sub eax, OS_BASE
|
||||||
|
cmp eax, 0x400000
|
||||||
|
jb @f
|
||||||
shr eax, 12
|
shr eax, 12
|
||||||
mov eax, [page_tabs+eax*4]
|
mov eax, [page_tabs+(eax+(OS_BASE shr 12))*4]
|
||||||
|
@@:
|
||||||
and eax, 0xFFFFF000
|
and eax, 0xFFFFF000
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -300,6 +300,7 @@ __exports:
|
|||||||
malloc, 'Kmalloc', \
|
malloc, 'Kmalloc', \
|
||||||
free, 'Kfree', \
|
free, 'Kfree', \
|
||||||
map_io_mem, 'MapIoMem', \ ; stdcall
|
map_io_mem, 'MapIoMem', \ ; stdcall
|
||||||
|
map_page, 'MapPage', \ ; stdcall
|
||||||
get_pg_addr, 'GetPgAddr', \ ; eax
|
get_pg_addr, 'GetPgAddr', \ ; eax
|
||||||
\
|
\
|
||||||
mutex_init, 'MutexInit', \ ; gcc fastcall
|
mutex_init, 'MutexInit', \ ; gcc fastcall
|
||||||
|
@ -50,12 +50,12 @@ run_test2:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
run_test3:
|
run_test3:
|
||||||
; 1024000 times run random operation.
|
; 1024 times run random operation.
|
||||||
; Randomly select malloc(random size from 1 to 1023)
|
; Randomly select malloc(random size from 1 to 1023)
|
||||||
; or free(random of previously allocated areas)
|
; or free(random of previously allocated areas)
|
||||||
mov edi, 0x12345678
|
mov edi, 0x12345678
|
||||||
xor esi, esi ; 0 areas allocated
|
xor esi, esi ; 0 areas allocated
|
||||||
mov ebx, 1024000
|
mov ebx, 1024
|
||||||
.loop:
|
.loop:
|
||||||
imul edi, 1103515245
|
imul edi, 1103515245
|
||||||
add edi, 12345
|
add edi, 12345
|
||||||
@ -78,7 +78,11 @@ run_test3:
|
|||||||
push eax
|
push eax
|
||||||
; mov ecx, [saved_state_num]
|
; mov ecx, [saved_state_num]
|
||||||
; mov [saved_state+ecx*8], eax
|
; mov [saved_state+ecx*8], eax
|
||||||
|
push edi
|
||||||
call malloc_with_test
|
call malloc_with_test
|
||||||
|
pop ecx
|
||||||
|
cmp ecx, edi
|
||||||
|
jnz edi_destroyed
|
||||||
; mov ecx, [saved_state_num]
|
; mov ecx, [saved_state_num]
|
||||||
; mov [saved_state+ecx*8+4], eax
|
; mov [saved_state+ecx*8+4], eax
|
||||||
; inc [saved_state_num]
|
; inc [saved_state_num]
|
||||||
@ -113,7 +117,11 @@ run_test3:
|
|||||||
jnz memory_destroyed
|
jnz memory_destroyed
|
||||||
pop eax edi
|
pop eax edi
|
||||||
push ebx edx
|
push ebx edx
|
||||||
|
push edi
|
||||||
call free
|
call free
|
||||||
|
pop ecx
|
||||||
|
cmp ecx, edi
|
||||||
|
jnz edi_destroyed
|
||||||
pop edx ebx
|
pop edx ebx
|
||||||
dec esi
|
dec esi
|
||||||
pop eax ecx
|
pop eax ecx
|
||||||
@ -150,9 +158,15 @@ malloc_with_test:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
; Stubs for kernel procedures used by heap code
|
; Stubs for kernel procedures used by heap code
|
||||||
wait_mutex:
|
mutex_init:
|
||||||
inc dword [ebx]
|
and dword [ecx], 0
|
||||||
|
ret
|
||||||
|
mutex_lock:
|
||||||
|
inc dword [ecx]
|
||||||
ret
|
ret
|
||||||
|
mutex_unlock:
|
||||||
|
dec dword [ecx]
|
||||||
|
ret
|
||||||
|
|
||||||
kernel_alloc:
|
kernel_alloc:
|
||||||
cmp dword [esp+4], bufsize
|
cmp dword [esp+4], bufsize
|
||||||
@ -174,7 +188,7 @@ generic_malloc_fail:
|
|||||||
jmp error_with_code
|
jmp error_with_code
|
||||||
|
|
||||||
check_mutex:
|
check_mutex:
|
||||||
cmp [mst.mutex], 0
|
cmp dword [mst.mutex], 0
|
||||||
jnz @f
|
jnz @f
|
||||||
ret
|
ret
|
||||||
@@:
|
@@:
|
||||||
@ -195,6 +209,10 @@ memory_destroyed:
|
|||||||
mov eax, 5
|
mov eax, 5
|
||||||
jmp error_with_code
|
jmp error_with_code
|
||||||
|
|
||||||
|
edi_destroyed:
|
||||||
|
mov eax, 6
|
||||||
|
jmp error_with_code
|
||||||
|
|
||||||
error_with_code:
|
error_with_code:
|
||||||
mov edx, saved_state_num
|
mov edx, saved_state_num
|
||||||
; eax = error code
|
; eax = error code
|
||||||
@ -208,6 +226,7 @@ error_with_code:
|
|||||||
|
|
||||||
; Include main heap code
|
; Include main heap code
|
||||||
include '../proc32.inc'
|
include '../proc32.inc'
|
||||||
|
include '../struct.inc'
|
||||||
include '../const.inc'
|
include '../const.inc'
|
||||||
include 'malloc.inc'
|
include 'malloc.inc'
|
||||||
|
|
||||||
|
@ -134,13 +134,10 @@ msg_module db 'in module ',0
|
|||||||
msg_version db 'incompatible driver version',13,10,0
|
msg_version db 'incompatible driver version',13,10,0
|
||||||
msg_www db 'please visit www.kolibrios.org',13,10,0
|
msg_www db 'please visit www.kolibrios.org',13,10,0
|
||||||
msg_CR db 13,10,0
|
msg_CR db 13,10,0
|
||||||
aHDA db 'INTEL_HDA',0
|
|
||||||
|
|
||||||
intel_str db "GenuineIntel",0
|
intel_str db "GenuineIntel",0
|
||||||
AMD_str db "AuthenticAMD",0
|
AMD_str db "AuthenticAMD",0
|
||||||
|
|
||||||
;szSound db 'SOUND',0
|
|
||||||
;szInfinity db 'INFINITY',0
|
|
||||||
szHwMouse db 'ATI2D',0
|
szHwMouse db 'ATI2D',0
|
||||||
szPS2MDriver db 'PS2MOUSE',0
|
szPS2MDriver db 'PS2MOUSE',0
|
||||||
;szCOM_MDriver db 'COM_MOUSE',0
|
;szCOM_MDriver db 'COM_MOUSE',0
|
||||||
|
@ -4592,7 +4592,6 @@ Remarks:
|
|||||||
* This function terminates the current thread. Other thread can be
|
* This function terminates the current thread. Other thread can be
|
||||||
killed by call to subfunction 2 of function 18.
|
killed by call to subfunction 2 of function 18.
|
||||||
|
|
||||||
|
|
||||||
======================================================================
|
======================================================================
|
||||||
=========================== List of events ===========================
|
=========================== List of events ===========================
|
||||||
======================================================================
|
======================================================================
|
||||||
|
@ -875,8 +875,8 @@ endp
|
|||||||
|
|
||||||
|
|
||||||
; flags reserved
|
; flags reserved
|
||||||
; RESET_INPUT equ 1 ;reserved reset and clear input buffer
|
; RESET_INPUT equ 1 ;reset and clear input buffer
|
||||||
; RESET_OUTPUT equ 2 ;reserved reset and clear output buffer
|
; RESET_OUTPUT equ 2 ;reset and clear output buffer
|
||||||
; RESET_ALL equ 3
|
; RESET_ALL equ 3
|
||||||
|
|
||||||
|
|
||||||
@ -913,6 +913,33 @@ proc ResetBuffer stdcall, str:dword, flags:dword
|
|||||||
mov [edx+STREAM.out_wp], ebx
|
mov [edx+STREAM.out_wp], ebx
|
||||||
mov [edx+STREAM.out_rp], ebx
|
mov [edx+STREAM.out_rp], ebx
|
||||||
mov [edx+STREAM.out_count], eax
|
mov [edx+STREAM.out_count], eax
|
||||||
|
|
||||||
|
mov dword [edx+STREAM.time_base], eax
|
||||||
|
mov dword [edx+STREAM.time_base+4], eax
|
||||||
|
|
||||||
|
mov dword [edx+STREAM.time_stamp], eax
|
||||||
|
mov dword [edx+STREAM.time_stamp+4], eax
|
||||||
|
mov dword [edx+STREAM.last_ts], eax
|
||||||
|
|
||||||
|
|
||||||
|
mov eax, [edx+STREAM.r_silence]
|
||||||
|
test [flags], 1
|
||||||
|
jz @F
|
||||||
|
|
||||||
|
mov ecx, [edx+STREAM.in_top]
|
||||||
|
mov edi, [edx+STREAM.in_base]
|
||||||
|
sub ecx, edi
|
||||||
|
shr ecx, 2
|
||||||
|
cld
|
||||||
|
rep stosd
|
||||||
|
@@:
|
||||||
|
test [flags], 2
|
||||||
|
jz @F
|
||||||
|
|
||||||
|
mov edi, [edx+STREAM.out_base]
|
||||||
|
mov ecx, (64*1024)/4
|
||||||
|
rep stosd
|
||||||
|
@@:
|
||||||
ret
|
ret
|
||||||
.fail:
|
.fail:
|
||||||
or eax, -1
|
or eax, -1
|
||||||
@ -1153,8 +1180,6 @@ proc stop_buffer stdcall, str:dword
|
|||||||
|
|
||||||
mov [edx+STREAM.flags], SND_STOP
|
mov [edx+STREAM.flags], SND_STOP
|
||||||
|
|
||||||
; stdcall [ServiceHandler], [hSound], dword DEV_STOP, 0
|
|
||||||
|
|
||||||
mov eax, [edx+STREAM.notify_event]
|
mov eax, [edx+STREAM.notify_event]
|
||||||
mov ebx, [edx+STREAM.notify_id]
|
mov ebx, [edx+STREAM.notify_id]
|
||||||
call ClearEvent ;eax ebx
|
call ClearEvent ;eax ebx
|
||||||
|
1507
kernel/branches/Kolibri-acpi/drivers/intelac97.asm
Normal file
1507
kernel/branches/Kolibri-acpi/drivers/intelac97.asm
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
295
kernel/branches/Kolibri-acpi/drivers/tmpdisk.asm
Normal file
295
kernel/branches/Kolibri-acpi/drivers/tmpdisk.asm
Normal file
@ -0,0 +1,295 @@
|
|||||||
|
; Disk driver to create FAT16/FAT32 memory-based temporary disk aka RAM disk.
|
||||||
|
; (c) CleverMouse
|
||||||
|
|
||||||
|
; Note: in the ideal world, a disk driver should not care about a file system
|
||||||
|
; on it. In the current world, however, there is no way to format a disk in
|
||||||
|
; FAT, so this part of file-system-specific operations is included in the
|
||||||
|
; driver.
|
||||||
|
|
||||||
|
; When this driver is loading, it registers itself in the system and does
|
||||||
|
; nothing more. When loaded, this driver controls pseudo-disk devices
|
||||||
|
; named /tmp#/, where # is a digit from 0 to 9. The driver does not create
|
||||||
|
; any device by itself, waiting for instructions from an application.
|
||||||
|
; The driver responds to the following IOCTLs from a control application:
|
||||||
|
SRV_GETVERSION equ 0 ; input ignored,
|
||||||
|
; output = dword API_VERSION
|
||||||
|
DEV_ADD_DISK equ 1 ; input = structure add_disk_struc,
|
||||||
|
; no output
|
||||||
|
DEV_DEL_DISK equ 2 ; input = structure del_disk_struc,
|
||||||
|
; no output
|
||||||
|
; For all IOCTLs the driver returns one of the following error codes:
|
||||||
|
NO_ERROR equ 0
|
||||||
|
ERROR_INVALID_IOCTL equ 1 ; unknown IOCTL code, wrong input/output size...
|
||||||
|
ERROR_INVALID_ID equ 2 ; .DiskId must be from 0 to 9
|
||||||
|
ERROR_SIZE_TOO_LARGE equ 3 ; .DiskSize is too large
|
||||||
|
ERROR_SIZE_TOO_SMALL equ 4 ; .DiskSize is too small
|
||||||
|
ERROR_NO_MEMORY equ 5 ; memory allocation failed
|
||||||
|
|
||||||
|
|
||||||
|
API_VERSION equ 1
|
||||||
|
; Input structures:
|
||||||
|
struc add_disk_struc
|
||||||
|
{
|
||||||
|
.DiskSize dd ? ; disk size in sectors, 1 sector = 512 bytes
|
||||||
|
; Note: .DiskSize is the full size, including FAT service data.
|
||||||
|
; Size for useful data is slightly less than this number.
|
||||||
|
.DiskId db ? ; from 0 to 9
|
||||||
|
.sizeof:
|
||||||
|
}
|
||||||
|
virtual at 0
|
||||||
|
add_disk_struc add_disk_struc
|
||||||
|
end virtual
|
||||||
|
struc del_disk_struc
|
||||||
|
{
|
||||||
|
.DiskId db ? ; from 0 to 9
|
||||||
|
.sizeof:
|
||||||
|
}
|
||||||
|
virtual at 0
|
||||||
|
del_disk_struc del_disk_struc
|
||||||
|
end virtual
|
||||||
|
|
||||||
|
max_num_disks equ 10
|
||||||
|
|
||||||
|
; standard driver stuff
|
||||||
|
format MS COFF
|
||||||
|
|
||||||
|
DEBUG equ 0
|
||||||
|
include 'proc32.inc'
|
||||||
|
include 'imports.inc'
|
||||||
|
|
||||||
|
public START
|
||||||
|
public version
|
||||||
|
|
||||||
|
struc IOCTL
|
||||||
|
{
|
||||||
|
.handle dd ?
|
||||||
|
.io_code dd ?
|
||||||
|
.input dd ?
|
||||||
|
.inp_size dd ?
|
||||||
|
.output dd ?
|
||||||
|
.out_size dd ?
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual at 0
|
||||||
|
IOCTL IOCTL
|
||||||
|
end virtual
|
||||||
|
|
||||||
|
section '.flat' code readable align 16
|
||||||
|
; the start procedure (see the description above)
|
||||||
|
proc START
|
||||||
|
; This procedure is called in two situations:
|
||||||
|
; when the driver is loading and when the system is shutting down.
|
||||||
|
; 1. Check that the driver is loading; do nothing unless so.
|
||||||
|
xor eax, eax ; set return value in case we will do nothing
|
||||||
|
cmp dword [esp+4], 1
|
||||||
|
jne .nothing
|
||||||
|
; 2. Register the driver in the system.
|
||||||
|
stdcall RegService, my_service, service_proc
|
||||||
|
; 3. Return the value returned by RegService back to the system.
|
||||||
|
.nothing:
|
||||||
|
retn 4
|
||||||
|
endp
|
||||||
|
|
||||||
|
; Service procedure for the driver - handle all IOCTL requests for the driver.
|
||||||
|
; The description of handled IOCTLs is located in the start of this file.
|
||||||
|
proc service_proc
|
||||||
|
; 1. Save used registers to be stdcall.
|
||||||
|
; Note: this shifts esp, so the first parameter [esp+4] becomes [esp+16].
|
||||||
|
; Note: edi is used not by this procedure itself, but by worker procedures.
|
||||||
|
push ebx esi edi
|
||||||
|
; 2. Get parameter from the stack: [esp+16] is the first parameter,
|
||||||
|
; pointer to IOCTL structure.
|
||||||
|
mov edx, [esp+16] ; edx -> IOCTL
|
||||||
|
; 3. Set the return value to 'invalid IOCTL'.
|
||||||
|
; Now, if one of conditions for IOCTL does not met, the code
|
||||||
|
; can simply return the value already loaded.
|
||||||
|
mov al, ERROR_INVALID_IOCTL
|
||||||
|
; 4. Get request code and select a handler for the code.
|
||||||
|
mov ecx, [edx+IOCTL.io_code]
|
||||||
|
test ecx, ecx ; check for SRV_GETVERSION
|
||||||
|
jnz .no.srv_getversion
|
||||||
|
; 4. This is SRV_GETVERSION request, no input, 4 bytes output, API_VERSION.
|
||||||
|
; 4a. Output size must be at least 4 bytes.
|
||||||
|
cmp [edx+IOCTL.out_size], 4
|
||||||
|
jl .return
|
||||||
|
; 4b. Write result to the output buffer.
|
||||||
|
mov eax, [edx+IOCTL.output]
|
||||||
|
mov dword [eax], API_VERSION
|
||||||
|
; 4c. Return success.
|
||||||
|
xor eax, eax
|
||||||
|
jmp .return
|
||||||
|
.no.srv_getversion:
|
||||||
|
dec ecx ; check for DEV_ADD_DISK
|
||||||
|
jnz .no.dev_add_disk
|
||||||
|
; 5. This is DEV_ADD_DISK request, input is add_disk_struc, output is 1 byte
|
||||||
|
; 5a. Input size must be exactly add_disk_struc.sizeof bytes.
|
||||||
|
cmp [edx+IOCTL.inp_size], add_disk_struc.sizeof
|
||||||
|
jnz .return
|
||||||
|
; 5b. Load input parameters and call the worker procedure.
|
||||||
|
mov eax, [edx+IOCTL.input]
|
||||||
|
movzx ebx, [eax+add_disk_struc.DiskId]
|
||||||
|
mov esi, [eax+add_disk_struc.DiskSize]
|
||||||
|
call add_disk
|
||||||
|
; 5c. Return back to the caller the value from the worker procedure.
|
||||||
|
jmp .return
|
||||||
|
.no.dev_add_disk:
|
||||||
|
dec ecx ; check for DEV_DEL_DISK
|
||||||
|
jnz .return
|
||||||
|
; 6. This is DEV_DEL_DISK request, input is del_disk_struc
|
||||||
|
; 6a. Input size must be exactly del_disk_struc.sizeof bytes.
|
||||||
|
cmp [edx+IOCTL.inp_size], del_disk_struc.sizeof
|
||||||
|
jnz .return
|
||||||
|
; 6b. Load input parameters and call the worker procedure.
|
||||||
|
mov eax, [edx+IOCTL.input]
|
||||||
|
movzx ebx, [eax+del_disk_struc.DiskId]
|
||||||
|
call del_disk
|
||||||
|
; 6c. Return back to the caller the value from the worker procedure.
|
||||||
|
.return:
|
||||||
|
; 7. Exit.
|
||||||
|
; 7a. The code above returns a value in al for efficiency,
|
||||||
|
; propagate it to eax.
|
||||||
|
movzx eax, al
|
||||||
|
; 7b. Restore used registers to be stdcall.
|
||||||
|
pop edi esi ebx
|
||||||
|
; 7c. Return, popping one argument.
|
||||||
|
retn 4
|
||||||
|
endp
|
||||||
|
|
||||||
|
; The worker procedure for DEV_ADD_DISK request.
|
||||||
|
; Creates a memory-based disk of given size and formats it in FAT16/32.
|
||||||
|
; Called with ebx = disk id, esi = disk size,
|
||||||
|
; returns error code in al.
|
||||||
|
proc add_disk
|
||||||
|
; 1. Check that disk id is correct and free.
|
||||||
|
; Otherwise, return the corresponding error code.
|
||||||
|
mov al, ERROR_INVALID_ID
|
||||||
|
cmp ebx, max_num_disks
|
||||||
|
jae .return
|
||||||
|
cmp [disk_pointers+ebx*4], 0
|
||||||
|
jnz .return
|
||||||
|
; 2. Check that the size is reasonable.
|
||||||
|
; Otherwise, return the corresponding error code.
|
||||||
|
mov al, ERROR_SIZE_TOO_LARGE
|
||||||
|
cmp esi, MAX_SIZE
|
||||||
|
ja .return
|
||||||
|
mov al, ERROR_SIZE_TOO_SMALL
|
||||||
|
cmp esi, MIN_FAT16_SIZE
|
||||||
|
jb .return
|
||||||
|
; 3. Allocate memory for the disk, store the pointer in edi.
|
||||||
|
; If failed, return the corresponding error code.
|
||||||
|
mov eax, esi
|
||||||
|
shl eax, 9
|
||||||
|
stdcall KernelAlloc, eax
|
||||||
|
mov edi, eax
|
||||||
|
test eax, eax
|
||||||
|
mov al, ERROR_NO_MEMORY
|
||||||
|
jz .return
|
||||||
|
; 4. Store the pointer and the size in the global variables.
|
||||||
|
; It is possible, though very unlikely, that two threads
|
||||||
|
; have called this function in parallel with the same id,
|
||||||
|
; so [disk_pointers+ebx*4] could be filled by another thread.
|
||||||
|
; Play extra safe and store new value only if old value is zero.
|
||||||
|
xor eax, eax
|
||||||
|
lock cmpxchg [disk_pointers+ebx*4], edi
|
||||||
|
jz @f
|
||||||
|
; Otherwise, free the allocated memory and return the corresponding error code.
|
||||||
|
stdcall KernelFree, edi
|
||||||
|
mov al, ERROR_INVALID_ID
|
||||||
|
jmp .return
|
||||||
|
@@:
|
||||||
|
mov [disk_sizes+ebx*4], esi
|
||||||
|
; 5. Call the worker procedure for formatting this disk.
|
||||||
|
; It should not fail.
|
||||||
|
call format_disk
|
||||||
|
; 6. Register the disk in the system.
|
||||||
|
; 6a. Generate name as /tmp#, where # = ebx + '0'. Use two dwords in the stack.
|
||||||
|
push 0
|
||||||
|
push 'tmp'
|
||||||
|
mov eax, esp ; eax points to 'tmp' + zero byte + zero dword
|
||||||
|
lea ecx, [ebx+'0'] ; ecx = digit
|
||||||
|
mov [eax+3], cl ; eax points to 'tmp#' + zero dword
|
||||||
|
; 6b. Call the kernel API. Use disk id as 'userdata' parameter for callbacks.
|
||||||
|
stdcall DiskAdd, disk_functions, eax, ebx, 0
|
||||||
|
; 6c. Restore the stack after 6a.
|
||||||
|
pop ecx ecx
|
||||||
|
; 6c. Check the result. If DiskAdd has failed, cleanup and return
|
||||||
|
; ERROR_NO_MEMORY, this is the most probable or even the only reason to fail.
|
||||||
|
test eax, eax
|
||||||
|
jnz @f
|
||||||
|
mov [disk_sizes+ebx*4], 0
|
||||||
|
mov [disk_pointers+ebx*4], 0
|
||||||
|
stdcall KernelFree, edi
|
||||||
|
mov al, ERROR_NO_MEMORY
|
||||||
|
jmp .return
|
||||||
|
@@:
|
||||||
|
push eax
|
||||||
|
; 6d. Notify the kernel that media is inserted.
|
||||||
|
stdcall DiskMediaChanged, eax, 1
|
||||||
|
; 6e. Disk is fully configured; store its handle in the global variable
|
||||||
|
; and return success.
|
||||||
|
pop [disk_handles+ebx*4]
|
||||||
|
xor eax, eax
|
||||||
|
; 7. Return.
|
||||||
|
.return:
|
||||||
|
retn
|
||||||
|
endp
|
||||||
|
|
||||||
|
; The worker procedure for DEV_DEL_DISK request.
|
||||||
|
; Deletes a previously created memory-based disk.
|
||||||
|
; Called with ebx = disk id,
|
||||||
|
; returns error code in al.
|
||||||
|
proc del_disk
|
||||||
|
; 1. Check that disk id is correct.
|
||||||
|
; Otherwise, return the corresponding error code.
|
||||||
|
mov al, ERROR_INVALID_ID
|
||||||
|
cmp ebx, max_num_disks
|
||||||
|
jae .return
|
||||||
|
; 2. Get the disk handle, simultaneously clearing the global variable.
|
||||||
|
xor edx, edx
|
||||||
|
xchg edx, [disk_handles+ebx*4]
|
||||||
|
; 3. Check that the handle is non-zero.
|
||||||
|
; Otherwise, return the corresponding error code.
|
||||||
|
test edx, edx
|
||||||
|
jz .return
|
||||||
|
; 4. Delete the disk from the system.
|
||||||
|
stdcall DiskDel, edx
|
||||||
|
; 5. Return success.
|
||||||
|
; Note that we can't free memory yet; it will be done in tmpdisk_close.
|
||||||
|
xor eax, eax
|
||||||
|
.return:
|
||||||
|
retn
|
||||||
|
endp
|
||||||
|
|
||||||
|
; Include implementation of tmpdisk_* callbacks.
|
||||||
|
include 'tmpdisk_work.inc'
|
||||||
|
; Include FAT-specific code.
|
||||||
|
include 'tmpdisk_fat.inc'
|
||||||
|
|
||||||
|
; initialized data
|
||||||
|
align 4
|
||||||
|
disk_functions:
|
||||||
|
dd disk_functions_end - disk_functions
|
||||||
|
dd tmpdisk_close
|
||||||
|
dd 0 ; no need in .closemedia
|
||||||
|
dd tmpdisk_querymedia
|
||||||
|
dd tmpdisk_read
|
||||||
|
dd tmpdisk_write
|
||||||
|
dd 0 ; no need in .flush
|
||||||
|
dd tmpdisk_adjust_cache_size
|
||||||
|
disk_functions_end:
|
||||||
|
; disk_handles = array of values for Disk* kernel functions
|
||||||
|
label disk_handles dword
|
||||||
|
times max_num_disks dd 0
|
||||||
|
; disk_pointers = array of pointers to disk data
|
||||||
|
label disk_pointers dword
|
||||||
|
times max_num_disks dd 0
|
||||||
|
; disk_sizes = array of disk sizes
|
||||||
|
label disk_sizes dword
|
||||||
|
times max_num_disks dd 0
|
||||||
|
|
||||||
|
version dd 0x00060006
|
||||||
|
my_service db 'tmpdisk',0
|
||||||
|
|
||||||
|
; uninitialized data
|
||||||
|
; actually, not used here
|
||||||
|
;section '.data' data readable writable align 16 ; standard driver stuff
|
327
kernel/branches/Kolibri-acpi/drivers/tmpdisk_fat.inc
Normal file
327
kernel/branches/Kolibri-acpi/drivers/tmpdisk_fat.inc
Normal file
@ -0,0 +1,327 @@
|
|||||||
|
; FAT-specific code for tmpdisk.asm.
|
||||||
|
; Formats a disk to FAT16 or FAT32, depending on size.
|
||||||
|
; Note: formatting is adjusted for memory-based disks. Although the resulting
|
||||||
|
; image is a valid FAT32 volume, it has no "spare" sectors, e.g. second copy
|
||||||
|
; of FAT or place for second sector of MS FAT32 bootloader.
|
||||||
|
|
||||||
|
; Some constants
|
||||||
|
FAT16_ROOTDIR_SECTORS = 16 ; can be changed, but why not?
|
||||||
|
; FAT16:
|
||||||
|
; 1 bootsector,
|
||||||
|
; min 0xFF5 sectors for data,
|
||||||
|
; min (0xFF5*2/512) = 16 sectors per FAT, we use only one copy,
|
||||||
|
; FAT16_ROOTDIR_SECTORS for root directory
|
||||||
|
MIN_FAT16_SIZE = 1 + 16 + FAT16_ROOTDIR_SECTORS + 0xFF5
|
||||||
|
; FAT32:
|
||||||
|
; 1 bootsector,
|
||||||
|
; 1 sector for fsinfo,
|
||||||
|
; min 0xFFF5 sectors for data,
|
||||||
|
; min (0xFFF5*4/512) = 512 sectors per FAT, we use only one copy
|
||||||
|
MIN_FAT32_SIZE = 1 + 1 + 512 + 0xFFF5
|
||||||
|
MAX_SIZE = 1 shl (30 - 9) ; 1G in 512-byte sectors
|
||||||
|
|
||||||
|
; Initializes FATxx structures on the disk.
|
||||||
|
; Called with edi = pointer to disk data, esi = size of disk.
|
||||||
|
proc format_disk
|
||||||
|
; Determine FAT type and jump to the corresponding handler.
|
||||||
|
cmp esi, MIN_FAT32_SIZE
|
||||||
|
jae format_disk_fat32
|
||||||
|
; Fall through to format_disk_fat16.
|
||||||
|
endp
|
||||||
|
|
||||||
|
; Structure of FAT16 bootsector. Field names are from MS spec.
|
||||||
|
struc FAT16BOOT
|
||||||
|
{
|
||||||
|
.BS_jmpBoot rb 3
|
||||||
|
.BS_OEMName rb 8
|
||||||
|
.BPB_BytsPerSec dw ?
|
||||||
|
.BPB_SecsPerClus db ?
|
||||||
|
.BPB_RsvdSecCnt dw ?
|
||||||
|
.BPB_NumFATs db ?
|
||||||
|
.BPB_RootEntCnt dw ?
|
||||||
|
.BPB_TotSec16 dw ?
|
||||||
|
.BPB_Media db ?
|
||||||
|
.BPB_FATSz16 dw ?
|
||||||
|
.BPB_SecPerTrk dw ?
|
||||||
|
.BPB_NumHeads dw ?
|
||||||
|
.BPB_HiddSec dd ?
|
||||||
|
.BPB_TotSec32 dd ?
|
||||||
|
.BS_DrvNum db ?
|
||||||
|
.BS_Reserved1 db ?
|
||||||
|
.BS_BootSig db ?
|
||||||
|
.BS_VolID dd ?
|
||||||
|
.BS_VolLab rb 11
|
||||||
|
.BS_FilSysType rb 8
|
||||||
|
}
|
||||||
|
virtual at 0
|
||||||
|
FAT16BOOT FAT16BOOT
|
||||||
|
end virtual
|
||||||
|
|
||||||
|
; Initializes FAT16 structures on the disk.
|
||||||
|
; Called with edi = pointer to disk data, esi = size of disk.
|
||||||
|
format_disk_fat16:
|
||||||
|
; 1. Calculate number of clusters.
|
||||||
|
; 1a. There are fixed-sized areas and there are data+FAT;
|
||||||
|
; every cluster uses 512 bytes in data area and 2 bytes in FAT area.
|
||||||
|
lea eax, [esi-1-FAT16_ROOTDIR_SECTORS]
|
||||||
|
; two following lines are equivalent to edx = floor(eax*512/514)
|
||||||
|
mov ecx, 0xFF00FF01
|
||||||
|
mul ecx ; edx = number of clusters
|
||||||
|
; 1b. Force the number be less than 0xfff5.
|
||||||
|
mov eax, 0xFFF4
|
||||||
|
cmp edx, eax
|
||||||
|
jb @f
|
||||||
|
mov edx, eax
|
||||||
|
@@:
|
||||||
|
; 2. Zero all system areas on the disk.
|
||||||
|
lea ecx, [256*(1+FAT16_ROOTDIR_SECTORS)/2+edx+255]
|
||||||
|
and ecx, not 255
|
||||||
|
shr ecx, 1
|
||||||
|
xor eax, eax
|
||||||
|
push edi
|
||||||
|
rep stosd
|
||||||
|
pop edi
|
||||||
|
; 3. Generate the bootsector.
|
||||||
|
; 3a. Copy static stub.
|
||||||
|
push esi edi
|
||||||
|
mov esi, fat16bootsector_stub
|
||||||
|
mov ecx, fat16bootsector_stub_size
|
||||||
|
rep movsb
|
||||||
|
pop edi esi
|
||||||
|
mov word [edi+510], 0xAA55
|
||||||
|
; 3b. Set fields which depend on size.
|
||||||
|
cmp esi, 0x10000
|
||||||
|
jae .size_is_32bit
|
||||||
|
mov [edi+FAT16BOOT.BPB_TotSec16], si
|
||||||
|
jmp .size_written
|
||||||
|
.size_is_32bit:
|
||||||
|
mov [edi+FAT16BOOT.BPB_TotSec32], esi
|
||||||
|
.size_written:
|
||||||
|
lea eax, [edx+255]
|
||||||
|
shr eax, 8
|
||||||
|
mov [edi+FAT16BOOT.BPB_FATSz16], ax
|
||||||
|
; 3c. Generate volume ID.
|
||||||
|
call generate_volume_id
|
||||||
|
mov [edi+FAT16BOOT.BS_VolID], eax
|
||||||
|
; 4. Initialize FAT.
|
||||||
|
mov dword [edi+512], 0xFFFFFFF8
|
||||||
|
; 5. Return.
|
||||||
|
ret
|
||||||
|
|
||||||
|
; Structure of FAT32 bootsector. Field names are from MS spec.
|
||||||
|
struc FAT32BOOT
|
||||||
|
{
|
||||||
|
.BS_jmpBoot rb 3
|
||||||
|
.BS_OEMName rb 8
|
||||||
|
.BPB_BytsPerSec dw ?
|
||||||
|
.BPB_SecsPerClus db ?
|
||||||
|
.BPB_RsvdSecCnt dw ?
|
||||||
|
.BPB_NumFATs db ?
|
||||||
|
.BPB_RootEntCnt dw ?
|
||||||
|
.BPB_TotSec16 dw ?
|
||||||
|
.BPB_Media db ?
|
||||||
|
.BPB_FATSz16 dw ?
|
||||||
|
.BPB_SecPerTrk dw ?
|
||||||
|
.BPB_NumHeads dw ?
|
||||||
|
.BPB_HiddSec dd ?
|
||||||
|
.BPB_TotSec32 dd ?
|
||||||
|
.BPB_FATSz32 dd ?
|
||||||
|
.BPB_ExtFlags dw ?
|
||||||
|
.BPB_FSVer dw ?
|
||||||
|
.BPB_RootClus dd ?
|
||||||
|
.BPB_FSInfo dw ?
|
||||||
|
.BPB_BkBootSec dw ?
|
||||||
|
.BPB_Reserved rb 12
|
||||||
|
.BS_DrvNum db ?
|
||||||
|
.BS_Reserved1 db ?
|
||||||
|
.BS_BootSig db ?
|
||||||
|
.BS_VolID dd ?
|
||||||
|
.BS_VolLab rb 11
|
||||||
|
.BS_FilSysType rb 8
|
||||||
|
}
|
||||||
|
virtual at 0
|
||||||
|
FAT32BOOT FAT32BOOT
|
||||||
|
end virtual
|
||||||
|
|
||||||
|
; Initializes FAT32 structures on the disk.
|
||||||
|
; Called with edi = pointer to disk data, esi = size of disk.
|
||||||
|
format_disk_fat32:
|
||||||
|
; 1. Calculate number of clusters.
|
||||||
|
; 1a. There is fixed-sized area and there are data+FAT;
|
||||||
|
; every cluster uses 512 bytes in data area and 4 bytes in FAT area.
|
||||||
|
lea eax, [esi-1-1]
|
||||||
|
; two following lines are equivalent to edx=floor(eax*512/516) if eax<10000000h
|
||||||
|
mov ecx, 0xFE03F810
|
||||||
|
mul ecx ; edx = number of clusters
|
||||||
|
; 2. Zero all system areas on the disk and first cluster of data,
|
||||||
|
; used for root directory.
|
||||||
|
lea ecx, [128*(1+1+1)+edx+127]
|
||||||
|
and ecx, not 127
|
||||||
|
xor eax, eax
|
||||||
|
push edi
|
||||||
|
rep stosd
|
||||||
|
pop edi
|
||||||
|
; 3. Generate the bootsector.
|
||||||
|
; 3a. Copy static stub.
|
||||||
|
push esi edi
|
||||||
|
mov esi, fat32bootsector_stub
|
||||||
|
mov ecx, fat32bootsector_stub_size
|
||||||
|
rep movsb
|
||||||
|
pop edi esi
|
||||||
|
mov word [edi+510], 0xAA55
|
||||||
|
; 3b. Set fields which depend on size.
|
||||||
|
mov [edi+FAT32BOOT.BPB_TotSec32], esi
|
||||||
|
lea eax, [edx+127]
|
||||||
|
shr eax, 7
|
||||||
|
mov [edi+FAT32BOOT.BPB_FATSz32], eax
|
||||||
|
; 3c. Generate volume ID.
|
||||||
|
call generate_volume_id
|
||||||
|
mov [edi+FAT32BOOT.BS_VolID], eax
|
||||||
|
; 4. Initialize fsinfo sector.
|
||||||
|
mov dword [edi+512], 'RRaA'
|
||||||
|
mov dword [edi+512+484], 'rrAa'
|
||||||
|
dec edx ; one cluster is occupied by root dir
|
||||||
|
mov dword [edi+512+488], edx ; free count
|
||||||
|
mov byte [edi+512+492], 3 ; first free cluster
|
||||||
|
mov word [edi+512+510], 0xAA55
|
||||||
|
; 5. Initialize FAT.
|
||||||
|
mov dword [edi+512*2], 0x0FFFFFF8
|
||||||
|
mov dword [edi+512*2+4], 0x0FFFFFFF
|
||||||
|
mov dword [edi+512*2+8], 0x0FFFFFFF
|
||||||
|
; 6. Return.
|
||||||
|
ret
|
||||||
|
|
||||||
|
; Generate volume serial number, which should try to be unique for each volume.
|
||||||
|
; Use CMOS date+time, copy-pasted from fat32.inc.
|
||||||
|
generate_volume_id:
|
||||||
|
call get_time_for_file
|
||||||
|
mov cx, ax
|
||||||
|
call get_date_for_file
|
||||||
|
shl eax, 16
|
||||||
|
mov ax, cx
|
||||||
|
ret
|
||||||
|
|
||||||
|
; Three following procedures are copy-pasted from fat32.inc.
|
||||||
|
bcd2bin:
|
||||||
|
;----------------------------------
|
||||||
|
; input : AL=BCD number (eg. 0x11)
|
||||||
|
; output : AH=0
|
||||||
|
; AL=decimal number (eg. 11)
|
||||||
|
;----------------------------------
|
||||||
|
xor ah, ah
|
||||||
|
shl ax, 4
|
||||||
|
shr al, 4
|
||||||
|
aad
|
||||||
|
ret
|
||||||
|
|
||||||
|
get_date_for_file:
|
||||||
|
;-----------------------------------------------------
|
||||||
|
; Get date from CMOS and pack day,month,year in AX
|
||||||
|
; DATE bits 0..4 : day of month 0..31
|
||||||
|
; 5..8 : month of year 1..12
|
||||||
|
; 9..15 : count of years from 1980
|
||||||
|
;-----------------------------------------------------
|
||||||
|
mov al, 0x7 ;day
|
||||||
|
out 0x70, al
|
||||||
|
in al, 0x71
|
||||||
|
call bcd2bin
|
||||||
|
ror eax, 5
|
||||||
|
|
||||||
|
mov al, 0x8 ;month
|
||||||
|
out 0x70, al
|
||||||
|
in al, 0x71
|
||||||
|
call bcd2bin
|
||||||
|
ror eax, 4
|
||||||
|
|
||||||
|
mov al, 0x9 ;year
|
||||||
|
out 0x70, al
|
||||||
|
in al, 0x71
|
||||||
|
call bcd2bin
|
||||||
|
add ax, 20 ;because CMOS return only the two last
|
||||||
|
;digit (eg. 2000 -> 00 , 2001 -> 01) and we
|
||||||
|
rol eax, 9 ;need the difference with 1980 (eg. 2001-1980)
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
get_time_for_file:
|
||||||
|
;-----------------------------------------------------
|
||||||
|
; Get time from CMOS and pack hour,minute,second in AX
|
||||||
|
; TIME bits 0..4 : second (the low bit is lost)
|
||||||
|
; 5..10 : minute 0..59
|
||||||
|
; 11..15 : hour 0..23
|
||||||
|
;-----------------------------------------------------
|
||||||
|
mov al, 0x0 ;second
|
||||||
|
out 0x70, al
|
||||||
|
in al, 0x71
|
||||||
|
call bcd2bin
|
||||||
|
ror eax, 6
|
||||||
|
|
||||||
|
mov al, 0x2 ;minute
|
||||||
|
out 0x70, al
|
||||||
|
in al, 0x71
|
||||||
|
call bcd2bin
|
||||||
|
ror eax, 6
|
||||||
|
|
||||||
|
mov al, 0x4 ;hour
|
||||||
|
out 0x70, al
|
||||||
|
in al, 0x71
|
||||||
|
call bcd2bin
|
||||||
|
rol eax, 11
|
||||||
|
ret
|
||||||
|
|
||||||
|
; some data
|
||||||
|
fat16bootsector_stub:
|
||||||
|
db 0EBh, 3Ch, 90h ; BS_jmpBoot
|
||||||
|
db 'KOLIBRI ' ; BS_OEMName
|
||||||
|
dw 512 ; BPB_BytsPerSec
|
||||||
|
db 1 ; BPB_SecsPerClus
|
||||||
|
dw 1 ; BPB_RsvdSecCnt
|
||||||
|
db 1 ; BPB_NumFATs
|
||||||
|
dw FAT16_ROOTDIR_SECTORS*16 ; BPB_RootEntCnt
|
||||||
|
dw 0 ; BPB_TotSec16, filled in format_disk_fat16
|
||||||
|
db 0F8h ; BPB_Media
|
||||||
|
dw 0 ; BPB_FATSz16, filled in format_disk_fat16
|
||||||
|
dw 32 ; BPB_SecPerTrk
|
||||||
|
dw 128 ; BPB_NumHeads
|
||||||
|
dd 0 ; BPB_HiddSec
|
||||||
|
dd 0 ; BPB_TotSec32, filled in format_disk_fat16
|
||||||
|
db 80h ; BS_DrvNum
|
||||||
|
db 0 ; BS_Reserved1
|
||||||
|
db 29h ; BS_BootSig
|
||||||
|
dd 0 ; BS_VolID, filled in format_disk_fat16
|
||||||
|
db 'NO NAME ' ; BS_VolLab
|
||||||
|
db 'FAT16 ' ; BS_FilSysType
|
||||||
|
; just in case add some meaningful bytes if someone tries to boot
|
||||||
|
db 0CDh, 19h, 0EBh, 0FEh ; int 19h, jmp $
|
||||||
|
fat16bootsector_stub_size = $ - fat16bootsector_stub
|
||||||
|
fat32bootsector_stub:
|
||||||
|
db 0EBh, 58h, 90h ; BS_jmpBoot
|
||||||
|
db 'KOLIBRI ' ; BS_OEMName
|
||||||
|
dw 512 ; BPB_BytsPerSec
|
||||||
|
db 1 ; BPB_SecsPerClus
|
||||||
|
dw 1 ; BPB_RsvdSecCnt
|
||||||
|
db 1 ; BPB_NumFATs
|
||||||
|
dw 0 ; BPB_RootEntCnt
|
||||||
|
dw 0 ; BPB_TotSec16
|
||||||
|
db 0F8h ; BPB_Media
|
||||||
|
dw 0 ; BPB_FATSz16
|
||||||
|
dw 32 ; BPB_SecPerTrk
|
||||||
|
dw 128 ; BPB_NumHeads
|
||||||
|
dd 0 ; BPB_HiddSec
|
||||||
|
dd 0 ; BPB_TotSec32, filled in format_disk_fat32
|
||||||
|
dd 0 ; BPB_FATSz32, filled in format_disk_fat32
|
||||||
|
dw 0 ; BPB_ExtFlags
|
||||||
|
dw 0 ; BPB_FSVer
|
||||||
|
dd 2 ; BPB_RootClus
|
||||||
|
dw 1 ; BPB_FSInfo
|
||||||
|
dw 0 ; BPB_BkBootSec
|
||||||
|
rb 12 ; BPB_Reserved
|
||||||
|
db 80h ; BS_DrvNum
|
||||||
|
db 0 ; BS_Reserved1
|
||||||
|
db 29h ; BS_BootSig
|
||||||
|
dd 0 ; BS_VolID, filled in format_disk_fat32
|
||||||
|
db 'NO NAME ' ; BS_VolLab
|
||||||
|
db 'FAT32 ' ; BS_FilSysType
|
||||||
|
; same bytes as in fat16bootsector_stub
|
||||||
|
db 0CDh, 19h, 0EBh, 0FEh ; int 19h, jmp $
|
||||||
|
fat32bootsector_stub_size = $ - fat32bootsector_stub
|
144
kernel/branches/Kolibri-acpi/drivers/tmpdisk_work.inc
Normal file
144
kernel/branches/Kolibri-acpi/drivers/tmpdisk_work.inc
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
; Callbacks which implement tmpdisk-specific disk functions for tmpdisk.asm.
|
||||||
|
|
||||||
|
; The first argument of every callback is .userdata = userdata arg of AddDisk.
|
||||||
|
; For tmpdisk, .userdata is the disk id, one of 0,...,max_num_disks-1.
|
||||||
|
|
||||||
|
DISK_STATUS_OK = 0 ; success
|
||||||
|
DISK_STATUS_GENERAL_ERROR = -1; if no other code is suitable
|
||||||
|
DISK_STATUS_INVALID_CALL = 1 ; invalid input parameters
|
||||||
|
DISK_STATUS_NO_MEDIA = 2 ; no media present
|
||||||
|
DISK_STATUS_END_OF_MEDIA = 3 ; end of media while reading/writing data
|
||||||
|
|
||||||
|
; 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'.
|
||||||
|
proc tmpdisk_close
|
||||||
|
virtual at esp+4
|
||||||
|
.userdata dd ?
|
||||||
|
end virtual
|
||||||
|
; Free the memory for disk and zero global variables.
|
||||||
|
mov edx, [.userdata]
|
||||||
|
mov [disk_sizes+edx*4], 0
|
||||||
|
xor eax, eax
|
||||||
|
xchg eax, [disk_pointers+edx*4]
|
||||||
|
stdcall KernelFree, eax
|
||||||
|
retn 4
|
||||||
|
endp
|
||||||
|
|
||||||
|
struc DISKMEDIAINFO
|
||||||
|
{
|
||||||
|
.flags dd ?
|
||||||
|
DISK_MEDIA_READONLY = 1
|
||||||
|
.sectorsize dd ?
|
||||||
|
.capacity dq ?
|
||||||
|
}
|
||||||
|
virtual at 0
|
||||||
|
DISKMEDIAINFO DISKMEDIAINFO
|
||||||
|
end virtual
|
||||||
|
|
||||||
|
; Returns information about disk media.
|
||||||
|
proc tmpdisk_querymedia
|
||||||
|
virtual at esp+4
|
||||||
|
.userdata dd ?
|
||||||
|
.info dd ?
|
||||||
|
end virtual
|
||||||
|
; Media is always present, sector size is always 512 bytes,
|
||||||
|
; the size of disk in sectors is stored in a global variable.
|
||||||
|
mov edx, [.userdata]
|
||||||
|
mov ecx, [.info]
|
||||||
|
mov [ecx+DISKMEDIAINFO.flags], 0
|
||||||
|
mov [ecx+DISKMEDIAINFO.sectorsize], 512
|
||||||
|
mov eax, [disk_sizes+edx*4]
|
||||||
|
mov dword [ecx+DISKMEDIAINFO.capacity], eax
|
||||||
|
mov dword [ecx+DISKMEDIAINFO.capacity+4], 0
|
||||||
|
; Return zero as an indicator of success.
|
||||||
|
xor eax, eax
|
||||||
|
retn 8
|
||||||
|
endp
|
||||||
|
|
||||||
|
; Reads one or more sectors from the device.
|
||||||
|
tmpdisk_read:
|
||||||
|
xor edx, edx ; 0 = reading
|
||||||
|
jmp tmpdisk_readwrite
|
||||||
|
|
||||||
|
; Writes one or more sectors to the device.
|
||||||
|
tmpdisk_write:
|
||||||
|
mov dl, 1 ; 1 = writing
|
||||||
|
; Fall through to tmpdisk_readwrite.
|
||||||
|
|
||||||
|
; Common procedure for reading and writing.
|
||||||
|
; dl = 0 for reading, dl = 1 for writing.
|
||||||
|
; Arguments of tmpdisk_read and tmpdisk_write are the same,
|
||||||
|
; they continue to be stack arguments of this procedure.
|
||||||
|
proc tmpdisk_readwrite \
|
||||||
|
userdata:dword, \
|
||||||
|
buffer:dword, \
|
||||||
|
start_sector:qword, \
|
||||||
|
numsectors_ptr:dword
|
||||||
|
; 1. Save used registers to be stdcall.
|
||||||
|
push esi edi
|
||||||
|
mov esi, [userdata]
|
||||||
|
mov edi, [numsectors_ptr]
|
||||||
|
; 1. Determine number of sectors to be transferred.
|
||||||
|
; This is either the requested number of sectors or number of sectors
|
||||||
|
; up to the disk boundary, depending of what is less.
|
||||||
|
xor ecx, ecx
|
||||||
|
; 1a. Test whether [start_sector] is less than [disk_sizes] for selected disk.
|
||||||
|
; If so, calculate number of sectors between [start_sector] and [disk_sizes].
|
||||||
|
; Otherwise, the actual number of sectors is zero.
|
||||||
|
cmp dword [start_sector+4], ecx
|
||||||
|
jnz .got_number
|
||||||
|
mov eax, [disk_sizes+esi*4]
|
||||||
|
sub eax, dword [start_sector]
|
||||||
|
jbe .got_number
|
||||||
|
; 1b. Get the requested number of sectors.
|
||||||
|
mov ecx, [edi]
|
||||||
|
; 1c. If it is greater than number of sectors calculated in 1a, use the value
|
||||||
|
; from 1a.
|
||||||
|
cmp ecx, eax
|
||||||
|
jb .got_number
|
||||||
|
mov ecx, eax
|
||||||
|
.got_number:
|
||||||
|
; 2. Compare the actual number of sectors with requested. If they are
|
||||||
|
; equal, set eax (it will be the returned value) to zero. Otherwise,
|
||||||
|
; use DISK_STATUS_END_OF_MEDIA.
|
||||||
|
xor eax, eax
|
||||||
|
cmp ecx, [edi]
|
||||||
|
jz @f
|
||||||
|
mov al, DISK_STATUS_END_OF_MEDIA
|
||||||
|
@@:
|
||||||
|
; 3. Store the actual number of sectors.
|
||||||
|
mov [edi], ecx
|
||||||
|
; 4. Calculate source and destination addresses.
|
||||||
|
mov edi, dword [start_sector]
|
||||||
|
shl edi, 9
|
||||||
|
add edi, [disk_pointers+esi*4]
|
||||||
|
mov esi, [buffer]
|
||||||
|
; 5. Calculate number of dwords to be transferred.
|
||||||
|
shl ecx, 9-2
|
||||||
|
; 6. Now esi = [buffer], edi = pointer inside disk.
|
||||||
|
; This is normal for write operations;
|
||||||
|
; exchange esi and edi for read operations.
|
||||||
|
test dl, dl
|
||||||
|
jnz @f
|
||||||
|
xchg esi, edi
|
||||||
|
@@:
|
||||||
|
; 7. Copy data.
|
||||||
|
rep movsd
|
||||||
|
; 8. Restore used registers to be stdcall and return.
|
||||||
|
; The value in eax was calculated in step 2.
|
||||||
|
pop edi esi
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
|
; The kernel calls this function when initializing cache subsystem for
|
||||||
|
; the media. This call allows the driver to adjust the cache size.
|
||||||
|
proc tmpdisk_adjust_cache_size
|
||||||
|
virtual at esp+4
|
||||||
|
.userdata dd ?
|
||||||
|
.suggested_size dd ?
|
||||||
|
end virtual
|
||||||
|
; Since tmpdisk does not need cache, just return 0.
|
||||||
|
xor eax, eax
|
||||||
|
retn 8
|
||||||
|
endp
|
@ -2845,6 +2845,10 @@ fat_Delete:
|
|||||||
mov eax, esi
|
mov eax, esi
|
||||||
call get_FAT
|
call get_FAT
|
||||||
jc .err1
|
jc .err1
|
||||||
|
cmp eax, 2
|
||||||
|
jb .error_fat
|
||||||
|
cmp eax, [ebp+FAT.fatRESERVED]
|
||||||
|
jae .empty
|
||||||
mov esi, eax
|
mov esi, eax
|
||||||
xor ecx, ecx
|
xor ecx, ecx
|
||||||
@@:
|
@@:
|
||||||
@ -2865,6 +2869,13 @@ fat_Delete:
|
|||||||
push ERROR_DEVICE
|
push ERROR_DEVICE
|
||||||
pop eax
|
pop eax
|
||||||
ret
|
ret
|
||||||
|
.error_fat:
|
||||||
|
popad
|
||||||
|
pop edi
|
||||||
|
call fat_unlock
|
||||||
|
push ERROR_FAT_TABLE
|
||||||
|
pop eax
|
||||||
|
ret
|
||||||
.notempty:
|
.notempty:
|
||||||
popad
|
popad
|
||||||
.access_denied2:
|
.access_denied2:
|
||||||
|
BIN
kernel/branches/Kolibri-acpi/gui/char.mt
Normal file
BIN
kernel/branches/Kolibri-acpi/gui/char.mt
Normal file
Binary file not shown.
BIN
kernel/branches/Kolibri-acpi/gui/char2.mt
Normal file
BIN
kernel/branches/Kolibri-acpi/gui/char2.mt
Normal file
Binary file not shown.
@ -124,6 +124,18 @@ save_draw_mouse:
|
|||||||
cmp esi, [current_cursor]
|
cmp esi, [current_cursor]
|
||||||
je .draw
|
je .draw
|
||||||
|
|
||||||
|
mov eax, [TASK_COUNT]
|
||||||
|
movzx eax, word [WIN_POS+eax*2]
|
||||||
|
shl eax, 8
|
||||||
|
|
||||||
|
cmp eax, edx
|
||||||
|
je @F
|
||||||
|
|
||||||
|
mov esi, [def_cursor]
|
||||||
|
cmp esi, [current_cursor]
|
||||||
|
je .draw
|
||||||
|
|
||||||
|
@@:
|
||||||
push esi
|
push esi
|
||||||
call [_display.select_cursor]
|
call [_display.select_cursor]
|
||||||
mov [current_cursor], esi
|
mov [current_cursor], esi
|
||||||
|
@ -311,8 +311,6 @@ B32:
|
|||||||
|
|
||||||
; ENABLE PAGING
|
; ENABLE PAGING
|
||||||
|
|
||||||
xchg bx, bx
|
|
||||||
|
|
||||||
mov eax, sys_pgdir-OS_BASE
|
mov eax, sys_pgdir-OS_BASE
|
||||||
mov cr3, eax
|
mov cr3, eax
|
||||||
|
|
||||||
@ -482,7 +480,7 @@ high_code:
|
|||||||
|
|
||||||
call calculate_fast_getting_offset_for_WinMapAddress
|
call calculate_fast_getting_offset_for_WinMapAddress
|
||||||
; for Qemu or non standart video cards
|
; for Qemu or non standart video cards
|
||||||
; Unfortunately [BytesPerScanLine] does not always
|
; Unfortunately [BytesPerScanLine] does not always
|
||||||
; equal to [_display.width] * [ScreenBPP] / 8
|
; equal to [_display.width] * [ScreenBPP] / 8
|
||||||
call calculate_fast_getting_offset_for_LFB
|
call calculate_fast_getting_offset_for_LFB
|
||||||
|
|
||||||
@ -711,8 +709,8 @@ no_mode_0x12:
|
|||||||
|
|
||||||
call LAPIC_init
|
call LAPIC_init
|
||||||
|
|
||||||
mov eax, 1
|
; mov eax, 1
|
||||||
call start_ap
|
; call start_ap
|
||||||
|
|
||||||
; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15)
|
; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15)
|
||||||
; they are used: when partitions are scanned, hd_read relies on timer
|
; they are used: when partitions are scanned, hd_read relies on timer
|
||||||
|
BIN
kernel/branches/Kolibri-acpi/video/arrow_clock.cur
Normal file
BIN
kernel/branches/Kolibri-acpi/video/arrow_clock.cur
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
@ -202,12 +202,16 @@ purge .dy1
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
blit_32:
|
blit_32:
|
||||||
xchg bx, bx
|
|
||||||
|
.x_y equ 72
|
||||||
|
.tmp_x_y equ 76
|
||||||
|
|
||||||
|
|
||||||
push ebp
|
push ebp
|
||||||
push edi
|
push edi
|
||||||
push esi
|
push esi
|
||||||
push ebx
|
push ebx
|
||||||
sub esp, 72
|
sub esp, 80
|
||||||
|
|
||||||
mov eax, [TASK_BASE]
|
mov eax, [TASK_BASE]
|
||||||
mov ebx, [eax-twdw + WDATA.box.width]
|
mov ebx, [eax-twdw + WDATA.box.width]
|
||||||
@ -254,7 +258,7 @@ blit_32:
|
|||||||
mov ecx, esp
|
mov ecx, esp
|
||||||
call blit_clip
|
call blit_clip
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jne .L57
|
jne .done
|
||||||
|
|
||||||
mov eax, [TASK_BASE]
|
mov eax, [TASK_BASE]
|
||||||
|
|
||||||
@ -264,16 +268,13 @@ blit_32:
|
|||||||
add ebp, [eax-twdw + WDATA.box.top]
|
add ebp, [eax-twdw + WDATA.box.top]
|
||||||
|
|
||||||
mov ecx, ebx
|
mov ecx, ebx
|
||||||
add ecx, [esp+BLITTER.w]
|
|
||||||
shl ecx, 16
|
shl ecx, 16
|
||||||
mov cx, bp
|
mov cx, bp
|
||||||
add ecx, [esp+BLITTER.h]
|
mov [esp+.x_y], ecx
|
||||||
|
|
||||||
mov edi, ebp
|
mov edi, ebp
|
||||||
|
|
||||||
; imul edi, [_display.pitch]
|
|
||||||
mov edi, [BPSLine_calc_area+edi*4]
|
mov edi, [BPSLine_calc_area+edi*4]
|
||||||
; imul ebp, [_display.width]
|
|
||||||
mov ebp, [d_width_calc_area+ebp*4]
|
mov ebp, [d_width_calc_area+ebp*4]
|
||||||
|
|
||||||
add ebp, ebx
|
add ebp, ebx
|
||||||
@ -285,38 +286,56 @@ blit_32:
|
|||||||
lea esi, [eax+esi*4]
|
lea esi, [eax+esi*4]
|
||||||
add esi, [esp+BLITTER.bitmap]
|
add esi, [esp+BLITTER.bitmap]
|
||||||
|
|
||||||
mov eax, ecx
|
|
||||||
mov ecx, [esp+BLITTER.h]
|
mov ecx, [esp+BLITTER.h]
|
||||||
mov edx, [esp+BLITTER.w]
|
mov edx, [esp+BLITTER.w]
|
||||||
|
|
||||||
test ecx, ecx ;FIXME check clipping
|
test ecx, ecx ;FIXME check clipping
|
||||||
jz .L57
|
jz .done
|
||||||
|
|
||||||
test edx, edx
|
test edx, edx
|
||||||
jz .L57
|
jz .done
|
||||||
|
|
||||||
cmp [_display.bpp], 32
|
|
||||||
jne .core_24
|
|
||||||
|
|
||||||
lea edi, [edi+ebx*4]
|
lea edi, [edi+ebx*4]
|
||||||
|
|
||||||
mov ebx, 1
|
; xchg bx, bx
|
||||||
test [esp+72], dword 0x10
|
|
||||||
jnz @F
|
|
||||||
|
|
||||||
mov ebx, [CURRENT_TASK]
|
mov ebx, [CURRENT_TASK]
|
||||||
@@:
|
mov ecx, [esp+80]
|
||||||
|
shr ecx, 4
|
||||||
|
and ecx, 3
|
||||||
|
|
||||||
|
jmp dword [.tbl_32+ecx*4]
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
.outer32:
|
.tbl_32 dd blit_copy_32
|
||||||
xor ecx, ecx
|
dd blit_copy_32_bgr
|
||||||
|
dd blit_trans_32
|
||||||
|
dd blit_trans_32_bgr
|
||||||
|
|
||||||
|
.done:
|
||||||
|
add esp, 80
|
||||||
|
pop ebx
|
||||||
|
pop esi
|
||||||
|
pop edi
|
||||||
|
pop ebp
|
||||||
|
ret
|
||||||
|
|
||||||
|
align 4
|
||||||
|
blit_copy_32_bgr:
|
||||||
|
mov ebx, 1
|
||||||
|
|
||||||
|
align 4
|
||||||
|
blit_copy_32:
|
||||||
|
|
||||||
|
.outer32:
|
||||||
|
mov eax, [esp+.x_y]
|
||||||
|
mov [esp+.tmp_x_y], eax
|
||||||
|
xor ecx, ecx
|
||||||
align 4
|
align 4
|
||||||
.inner32:
|
.inner32:
|
||||||
cmp [ebp+ecx], bl
|
cmp [ebp+ecx], bl
|
||||||
jne .skip
|
jne .skip
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
push eax
|
|
||||||
mov eax, [esi+ecx*4]
|
mov eax, [esi+ecx*4]
|
||||||
|
|
||||||
; check for hardware cursor
|
; check for hardware cursor
|
||||||
@ -328,12 +347,70 @@ align 4
|
|||||||
align 4
|
align 4
|
||||||
@@:
|
@@:
|
||||||
push ecx
|
push ecx
|
||||||
|
mov ecx, [esp+4+.tmp_x_y]
|
||||||
|
|
||||||
mov ecx, [esp+4]
|
; check mouse area for putpixel
|
||||||
ror ecx, 16
|
call [_display.check_mouse]
|
||||||
sub ecx, edx
|
pop ecx
|
||||||
rol ecx, 16
|
|
||||||
sub ecx, [esp+BLITTER.h + 8]
|
;--------------------------------------
|
||||||
|
align 4
|
||||||
|
.no_mouseunder:
|
||||||
|
; store to real LFB
|
||||||
|
mov [LFB_BASE+edi+ecx*4], eax
|
||||||
|
;--------------------------------------
|
||||||
|
align 4
|
||||||
|
.skip:
|
||||||
|
add [esp+.tmp_x_y], dword 0x10000
|
||||||
|
inc ecx
|
||||||
|
dec edx
|
||||||
|
jnz .inner32
|
||||||
|
|
||||||
|
add esi, [esp+BLITTER.stride]
|
||||||
|
add edi, [_display.pitch]
|
||||||
|
add ebp, [_display.width]
|
||||||
|
inc dword [esp+.x_y]
|
||||||
|
|
||||||
|
mov edx, [esp+BLITTER.w]
|
||||||
|
dec [esp+BLITTER.h]
|
||||||
|
jnz .outer32
|
||||||
|
|
||||||
|
jmp blit_32.done
|
||||||
|
|
||||||
|
|
||||||
|
align 4
|
||||||
|
blit_trans_32_bgr:
|
||||||
|
mov ebx, 1
|
||||||
|
|
||||||
|
align 4
|
||||||
|
blit_trans_32:
|
||||||
|
|
||||||
|
.outer32:
|
||||||
|
mov eax, [esp+.x_y]
|
||||||
|
mov [esp+.tmp_x_y], eax
|
||||||
|
xor ecx, ecx
|
||||||
|
|
||||||
|
align 4
|
||||||
|
.inner32:
|
||||||
|
|
||||||
|
cmp [ebp+ecx], bl
|
||||||
|
jne .skip
|
||||||
|
;--------------------------------------
|
||||||
|
mov eax, [esi+ecx*4]
|
||||||
|
test eax, 0xFF000000
|
||||||
|
jz .skip
|
||||||
|
|
||||||
|
; check for hardware cursor
|
||||||
|
cmp [_display.select_cursor], select_cursor
|
||||||
|
je @f
|
||||||
|
cmp [_display.select_cursor], 0
|
||||||
|
jne .no_mouseunder
|
||||||
|
;--------------------------------------
|
||||||
|
align 4
|
||||||
|
@@:
|
||||||
|
push ecx
|
||||||
|
|
||||||
|
mov ecx, [esp+4+.tmp_x_y]
|
||||||
|
|
||||||
; check mouse area for putpixel
|
; check mouse area for putpixel
|
||||||
call [_display.check_mouse]
|
call [_display.check_mouse]
|
||||||
@ -343,10 +420,10 @@ align 4
|
|||||||
.no_mouseunder:
|
.no_mouseunder:
|
||||||
; store to real LFB
|
; store to real LFB
|
||||||
mov [LFB_BASE+edi+ecx*4], eax
|
mov [LFB_BASE+edi+ecx*4], eax
|
||||||
pop eax
|
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
align 4
|
align 4
|
||||||
.skip:
|
.skip:
|
||||||
|
add [esp+.tmp_x_y], dword 0x10000
|
||||||
inc ecx
|
inc ecx
|
||||||
dec edx
|
dec edx
|
||||||
jnz .inner32
|
jnz .inner32
|
||||||
@ -354,88 +431,10 @@ align 4
|
|||||||
add esi, [esp+BLITTER.stride]
|
add esi, [esp+BLITTER.stride]
|
||||||
add edi, [_display.pitch]
|
add edi, [_display.pitch]
|
||||||
add ebp, [_display.width]
|
add ebp, [_display.width]
|
||||||
|
inc dword [esp+.x_y]
|
||||||
|
|
||||||
mov edx, [esp+BLITTER.w]
|
mov edx, [esp+BLITTER.w]
|
||||||
dec [esp+BLITTER.h]
|
dec [esp+BLITTER.h]
|
||||||
jnz .outer32
|
jnz .outer32
|
||||||
|
|
||||||
.done:
|
jmp blit_32.done
|
||||||
; call [draw_pointer]
|
|
||||||
; call __sys_draw_pointer
|
|
||||||
.L57:
|
|
||||||
add esp, 72
|
|
||||||
pop ebx
|
|
||||||
pop esi
|
|
||||||
pop edi
|
|
||||||
pop ebp
|
|
||||||
ret
|
|
||||||
|
|
||||||
.core_24:
|
|
||||||
lea ebx, [ebx+ebx*2]
|
|
||||||
lea edi, [LFB_BASE+edi+ebx]
|
|
||||||
mov ebx, 1
|
|
||||||
test [esp+72], dword 0x10
|
|
||||||
jnz @F
|
|
||||||
|
|
||||||
mov ebx, [CURRENT_TASK]
|
|
||||||
@@:
|
|
||||||
|
|
||||||
align 4
|
|
||||||
.outer24:
|
|
||||||
mov [esp+64], edi
|
|
||||||
xor ecx, ecx
|
|
||||||
|
|
||||||
align 4
|
|
||||||
.inner24:
|
|
||||||
cmp [ebp+ecx], bl
|
|
||||||
jne .skip_1
|
|
||||||
;--------------------------------------
|
|
||||||
push eax
|
|
||||||
mov eax, [esi+ecx*4]
|
|
||||||
|
|
||||||
lea edi, [edi+ecx*2]
|
|
||||||
|
|
||||||
; check for hardware cursor
|
|
||||||
cmp [_display.select_cursor], select_cursor
|
|
||||||
je @f
|
|
||||||
cmp [_display.select_cursor], 0
|
|
||||||
jne .no_mouseunder_1
|
|
||||||
;--------------------------------------
|
|
||||||
align 4
|
|
||||||
@@:
|
|
||||||
push ecx
|
|
||||||
|
|
||||||
mov ecx, [esp+4]
|
|
||||||
ror ecx, 16
|
|
||||||
sub ecx, edx
|
|
||||||
rol ecx, 16
|
|
||||||
sub ecx, [esp+BLITTER.h + 8]
|
|
||||||
|
|
||||||
; check mouse area for putpixel
|
|
||||||
call [_display.check_mouse]
|
|
||||||
pop ecx
|
|
||||||
;--------------------------------------
|
|
||||||
align 4
|
|
||||||
.no_mouseunder_1:
|
|
||||||
mov [edi+ecx], ax
|
|
||||||
shr eax, 16
|
|
||||||
mov [edi+ecx+2], al
|
|
||||||
|
|
||||||
pop eax
|
|
||||||
;--------------------------------------
|
|
||||||
align 4
|
|
||||||
.skip_1:
|
|
||||||
mov edi, [esp+64]
|
|
||||||
inc ecx
|
|
||||||
dec edx
|
|
||||||
jnz .inner24
|
|
||||||
|
|
||||||
add esi, [esp+BLITTER.stride]
|
|
||||||
add edi, [_display.pitch]
|
|
||||||
add ebp, [_display.width]
|
|
||||||
|
|
||||||
mov edx, [esp+BLITTER.w]
|
|
||||||
dec [esp+BLITTER.h]
|
|
||||||
jnz .outer24
|
|
||||||
|
|
||||||
jmp .done
|
|
||||||
|
@ -447,16 +447,11 @@ endp
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
align 4
|
||||||
proc delete_cursor stdcall, hcursor:dword
|
proc delete_cursor stdcall, hcursor:dword
|
||||||
locals
|
|
||||||
hsrv dd ?
|
; DEBUGF 1,'K : delete_cursor %x\n', [hcursor]
|
||||||
io_code dd ?
|
|
||||||
input dd ?
|
|
||||||
inp_size dd ?
|
|
||||||
output dd ?
|
|
||||||
out_size dd ?
|
|
||||||
endl
|
|
||||||
|
|
||||||
mov esi, [hcursor]
|
mov esi, [hcursor]
|
||||||
|
|
||||||
cmp [esi+CURSOR.magic], 'CURS'
|
cmp [esi+CURSOR.magic], 'CURS'
|
||||||
jne .fail
|
jne .fail
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user