Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3186 → Rev 3187

/kernel/branches/net/core/dll.inc
810,15 → 810,7
jnz .ok
 
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
ret
.ok:
/kernel/branches/net/core/exports.inc
72,6 → 72,9
szLoadFile db 'LoadFile',0
szSendEvent db 'SendEvent',0
szSetMouseData db 'SetMouseData',0
szSetKeyboardData db 'SetKeyboardData',0
szRegKeyboard db 'RegKeyboard',0
szDelKeyboard db 'DelKeyboard',0
szSleep db 'Sleep',0
szGetTimerTicks db 'GetTimerTicks',0
 
161,6 → 164,9
dd szLoadFile , load_file ;retval eax, ebx
dd szSendEvent , send_event ;see EVENT.inc for specification
dd szSetMouseData , set_mouse_data ;stdcall
dd szSetKeyboardData , set_keyboard_data
dd szRegKeyboard , register_keyboard
dd szDelKeyboard , delete_keyboard
dd szSleep , delay_ms
dd szGetTimerTicks , get_timer_ticks
 
/kernel/branches/net/core/malloc.inc
341,10 → 341,9
; insert_chunk(p,psize);
 
mov eax, esi
pop esi
mov ecx, edi
pop edi
jmp insert_chunk
call insert_chunk
jmp .fail2
.unl_large:
 
; unlink_large_chunk((tchunkptr)next);
364,10 → 363,9
; insert_chunk(p,psize);
 
mov eax, esi
pop esi
mov ecx, edi
pop edi
jmp insert_chunk
call insert_chunk
jmp .fail2
.fix_next:
 
; (p+psize)->prev_foot = psize;
386,10 → 384,9
; insert_chunk(p,psize);
 
mov eax, esi
pop esi
mov ecx, edi
pop edi
jmp insert_chunk
call insert_chunk
jmp .fail2
 
; param
; ecx = chunk
418,15 → 415,11
mov [esi+8], edx ;P->fd = F
mov [esi+12], eax ;P->bk = B
pop esi
mov ecx, mst.mutex
call mutex_unlock
ret
.large:
mov ebx, eax
call insert_large_chunk
pop esi
mov ecx, mst.mutex
call mutex_unlock
ret
 
 
/kernel/branches/net/core/memory.inc
442,72 → 442,83
align 4
proc new_mem_resize stdcall, new_size:dword
 
mov ecx, pg_data.mutex
call mutex_lock
push ebx
push esi
push edi
 
mov edx, [current_slot]
cmp [edx+APPDATA.heap_base], 0
jne .exit
 
mov edi, [new_size]
add edi, 4095
and edi, not 4095
mov [new_size], edi
 
mov edx, [current_slot]
cmp [edx+APPDATA.heap_base], 0
jne .exit
 
mov esi, [edx+APPDATA.mem_size]
add esi, 4095
and esi, not 4095
 
cmp edi, esi
jae .expand
ja .expand
je .exit
 
mov ebx, edi
shr edi, 12
shr esi, 12
 
mov ecx, pg_data.mutex
call mutex_lock
@@:
mov eax, [app_page_tabs+edi*4]
test eax, 1
jz .next
mov dword [app_page_tabs+edi*4], 2
mov ebx, edi
shl ebx, 12
push eax
 
mov dword [app_page_tabs+edi*4], 0
invlpg [ebx]
pop eax
call free_page
 
.next:
add edi, 1
inc edi
add ebx, 0x1000
cmp edi, esi
jb @B
 
mov ecx, pg_data.mutex
call mutex_unlock
 
.update_size:
mov edx, [current_slot]
mov ebx, [new_size]
call update_mem_size
 
mov ecx, pg_data.mutex
call mutex_unlock
 
.exit:
pop edi
pop esi
pop ebx
xor eax, eax
ret
 
.expand:
 
push esi
push edi
mov ecx, pg_data.mutex
call mutex_lock
 
xchg esi, edi
 
push esi ;new size
push edi ;old size
 
add edi, 0x3FFFFF
and edi, not(0x3FFFFF)
add esi, 0x3FFFFF
and esi, not(0x3FFFFF)
 
cmp esi, edi
cmp edi, esi
jae .grow
 
xchg esi, edi
 
@@:
call alloc_page
test eax, eax
jz .exit_pop
jz .exit_fail
 
stdcall map_page_table, edi, eax
 
524,51 → 535,38
cmp edi, esi
jb @B
.grow:
;//-
pop edi
push edi
mov esi, [pg_data.pages_free]
sub esi, 1
shr edi, 12
cmp esi, edi
jle .out_of_memory
;//-
pop edi
pop esi
@@:
call alloc_page
test eax, eax
jz .exit
stdcall map_page, esi, eax, dword PG_UW
pop edi ;old size
pop ecx ;new size
 
push edi
mov edi, esi
xor eax, eax
mov ecx, 1024
cld
shr edi, 10
shr ecx, 10
sub ecx, edi
shr ecx, 2 ;pages count
mov eax, 2
 
add edi, app_page_tabs
rep stosd
pop edi
 
add esi, 0x1000
cmp esi, edi
jb @B
mov ecx, pg_data.mutex
call mutex_unlock
 
jmp .update_size
;//-
.exit_pop:
.out_of_memory:
;//-
pop edi
pop esi
.exit:
 
.exit_fail:
mov ecx, pg_data.mutex
call mutex_unlock
 
add esp, 8
pop edi
pop esi
pop ebx
xor eax, eax
inc eax
ret
endp
 
 
align 4
update_mem_size:
; in: edx = slot base
; ebx = new memory size
608,8 → 606,12
 
align 4
get_pg_addr:
sub eax, OS_BASE
cmp eax, 0x400000
jb @f
shr eax, 12
mov eax, [page_tabs+eax*4]
mov eax, [page_tabs+(eax+(OS_BASE shr 12))*4]
@@:
and eax, 0xFFFFF000
ret
 
1253,7 → 1255,7
cmp ecx, OS_BASE
jae .fail
 
cmp ebx, OS_BASE
cmp edx, OS_BASE
jae .fail
 
mov edi, edx
/kernel/branches/net/core/peload.inc
300,6 → 300,7
malloc, 'Kmalloc', \
free, 'Kfree', \
map_io_mem, 'MapIoMem', \ ; stdcall
map_page, 'MapPage', \ ; stdcall
get_pg_addr, 'GetPgAddr', \ ; eax
\
mutex_init, 'MutexInit', \ ; gcc fastcall
/kernel/branches/net/core/sys32.inc
431,6 → 431,17
add eax, 16
cmp eax, hotkey_list+256*16
jb .loop
; get process PID
mov eax, esi
shl eax, 5
mov eax, [eax+CURRENT_TASK+TASKDATA.pid]
; compare current lock input with process PID
cmp eax, [PID_lock_input]
jne @f
 
xor eax, eax
mov [PID_lock_input], eax
@@:
; remove hotkeys in buffer
mov eax, hotkey_buffer
.loop2:
683,24 → 694,22
ret
restore .slot
 
iglobal
if lang eq ru
boot_sched_1 db '‘®§¤ ­¨¥ GDT TSS 㪠§ â¥«ï',0
boot_sched_2 db '‘®§¤ ­¨¥ IDT â ¡«¨æë',0
else
boot_sched_1 db 'Building gdt tss pointer',0
boot_sched_2 db 'Building IDT table',0
end if
endg
;iglobal
;if lang eq ru
; boot_sched_1 db '‘®§¤ ­¨¥ GDT TSS 㪠§ â¥«ï',0
; boot_sched_2 db '‘®§¤ ­¨¥ IDT â ¡«¨æë',0
;else
; boot_sched_1 db 'Building gdt tss pointer',0
; boot_sched_2 db 'Building IDT table',0
;end if
;endg
 
 
build_scheduler:
 
mov esi, boot_sched_1
call boot_log
;build_scheduler:
; mov esi, boot_sched_1
; call boot_log
; call build_process_gdt_tss_pointer
 
; mov esi,boot_sched_2
; call boot_log
 
ret
; ret
/kernel/branches/net/core/taskman.inc
84,6 → 84,8
 
pushad
 
cmp [SCR_MODE], word 0x13
jbe @f
pushad
stdcall set_cursor, [def_cursor_clock]
mov [handle], eax
90,7 → 92,7
mov [redrawmouse_unconditional], 1
call __sys_draw_pointer
popad
 
@@:
mov [flags], edx
 
; [ebp] pointer to filename
185,7 → 187,7
jnz @F
lea esi, [filename]
@@:
mov ecx, 8; 8 chars for name
mov ecx, 11 ; 11 chars for name! 8 - is old value!
mov edi, [slot_base]
.copy_process_name_loop:
lodsb
261,11 → 263,14
mov [application_table_status], eax
mov eax, esi
.final:
cmp [SCR_MODE], word 0x13
jbe @f
pushad
stdcall set_cursor, [handle]
mov [redrawmouse_unconditional], 1
call __sys_draw_pointer
popad
@@:
ret
endp
 
/kernel/branches/net/core/test_malloc.asm
50,12 → 50,12
ret
 
run_test3:
; 1024000 times run random operation.
; 1024 times run random operation.
; Randomly select malloc(random size from 1 to 1023)
; or free(random of previously allocated areas)
mov edi, 0x12345678
xor esi, esi ; 0 areas allocated
mov ebx, 1024000
mov ebx, 1024
.loop:
imul edi, 1103515245
add edi, 12345
78,7 → 78,11
push eax
; mov ecx, [saved_state_num]
; mov [saved_state+ecx*8], eax
push edi
call malloc_with_test
pop ecx
cmp ecx, edi
jnz edi_destroyed
; mov ecx, [saved_state_num]
; mov [saved_state+ecx*8+4], eax
; inc [saved_state_num]
113,7 → 117,11
jnz memory_destroyed
pop eax edi
push ebx edx
push edi
call free
pop ecx
cmp ecx, edi
jnz edi_destroyed
pop edx ebx
dec esi
pop eax ecx
150,9 → 158,15
ret
 
; Stubs for kernel procedures used by heap code
wait_mutex:
inc dword [ebx]
mutex_init:
and dword [ecx], 0
ret
mutex_lock:
inc dword [ecx]
ret
mutex_unlock:
dec dword [ecx]
ret
 
kernel_alloc:
cmp dword [esp+4], bufsize
174,7 → 188,7
jmp error_with_code
 
check_mutex:
cmp [mst.mutex], 0
cmp dword [mst.mutex], 0
jnz @f
ret
@@:
195,6 → 209,10
mov eax, 5
jmp error_with_code
 
edi_destroyed:
mov eax, 6
jmp error_with_code
 
error_with_code:
mov edx, saved_state_num
; eax = error code
208,6 → 226,7
 
; Include main heap code
include '../proc32.inc'
include '../struct.inc'
include '../const.inc'
include 'malloc.inc'