diff --git a/kernel/trunk/core/dll.inc b/kernel/trunk/core/dll.inc index 2ed9b1225..aa2dd63f8 100644 --- a/kernel/trunk/core/dll.inc +++ b/kernel/trunk/core/dll.inc @@ -431,9 +431,7 @@ proc get_fileinfo stdcall, file_name:dword, info:dword xor eax, eax mov ebx, [file_name] - ; sub ebx, new_app_base mov ecx, [info] - ; sub ecx, new_app_base mov [cmd], 5 mov [offset], eax @@ -445,7 +443,6 @@ proc get_fileinfo stdcall, file_name:dword, info:dword mov eax, 70 lea ebx, [cmd] - ; sub ebx, new_app_base int 0x40 ret endp @@ -517,6 +514,10 @@ proc load_file stdcall, file_name:dword file2 dd ? endl + push ebx + push esi + push edi + lea eax, [attr] stdcall get_fileinfo, [file_name], eax test eax, eax @@ -561,12 +562,18 @@ proc load_file stdcall, file_name:dword @@: mov ebx, [file_size] pop eax + pop edi + pop esi + pop ebx ret .cleanup: stdcall kernel_free, [file] .fail: xor eax, eax xor ebx, ebx + pop edi + pop esi + pop ebx ret endp diff --git a/kernel/trunk/core/exports.inc b/kernel/trunk/core/exports.inc index 43061b19d..6698bf130 100644 --- a/kernel/trunk/core/exports.inc +++ b/kernel/trunk/core/exports.inc @@ -104,10 +104,10 @@ kernel_export: dd szAllocKernelSpace, alloc_kernel_space ;stdcall dd szFreeKernelSpace , free_kernel_space ;stdcall - dd szKernelAlloc , kernel_alloc - dd szKernelFree , kernel_free - dd szUserAlloc , user_alloc - dd szUserFree , user_free + dd szKernelAlloc , kernel_alloc ;stdcall + dd szKernelFree , kernel_free ;stdcall + dd szUserAlloc , user_alloc ;stdcall + dd szUserFree , user_free ;stdcall dd szKmalloc , malloc dd szKfree , free dd szCreateRingBuffer, create_ring_buffer @@ -121,17 +121,18 @@ kernel_export: dd szDestroyEvent , destroy_event dd szClearEvent , clear_event - dd szLoadCursor , load_cursor - dd szSelectHwCursor , select_hw_cursor ;indirect - dd szSetHwCursor , set_hw_cursor ;indirect - dd szHwCursorRestore , hw_restore ;indirect - dd szHwCursorCreate , create_cursor + dd szLoadCursor , load_cursor ;stdcall + + dd szSelectHwCursor , select_hw_cursor ;import + dd szSetHwCursor , set_hw_cursor ;import + dd szHwCursorRestore , hw_restore ;import + dd szHwCursorCreate , create_cursor ;import dd szSysMsgBoardStr , sys_msg_board_str dd szGetCurrentTask , get_curr_task - dd szLoadFile , load_file + dd szLoadFile , load_file ;stdcall dd szSendEvent , send_event - dd szSetMouseData , set_mouse_data + dd szSetMouseData , set_mouse_data ;stdcall dd szSleep , delay_ms dd szGetTimerTicks , get_timer_ticks diff --git a/kernel/trunk/core/heap.inc b/kernel/trunk/core/heap.inc index 58126fb17..dbc91e131 100644 --- a/kernel/trunk/core/heap.inc +++ b/kernel/trunk/core/heap.inc @@ -537,6 +537,9 @@ proc kernel_alloc stdcall, size:dword pages_count dd ? endl + push ebx + push edi + mov eax, [size] add eax, 4095 and eax, not 4095; @@ -591,9 +594,13 @@ proc kernel_alloc stdcall, size:dword jnz @B .end: mov eax, [lin_addr] + pop edi + pop ebx ret .err: xor eax, eax + pop edi + pop ebx ret endp @@ -665,7 +672,6 @@ proc init_heap mov [ebx+APPDATA.heap_top], eax sub eax, esi - ; add esi, new_app_base shr esi, 10 mov ecx, eax sub eax, 4096 @@ -677,6 +683,10 @@ endp align 4 proc user_alloc stdcall, alloc_size:dword + push ebx + push esi + push edi + mov ecx, [alloc_size] add ecx, (4095+4096) and ecx, not 4095 @@ -725,6 +735,10 @@ l_0: call update_mem_size lea eax, [esi+4096] + + pop edi + pop esi + pop ebx ret test_used: test al, USED_BLOCK @@ -736,16 +750,23 @@ m_next: jmp l_0 m_exit: xor eax, eax + pop edi + pop esi + pop ebx ret endp align 4 proc user_free stdcall, base:dword + push esi + mov esi, [base] test esi, esi jz .exit + push ebx + xor ebx, ebx shr esi, 12 mov eax, [page_tabs+(esi-1)*4] @@ -776,6 +797,8 @@ proc user_free stdcall, base:dword dec ecx jnz .release .released: + push edi + mov edx, [current_slot] mov esi, dword [edx+APPDATA.heap_base] mov edi, dword [edx+APPDATA.heap_top] @@ -783,13 +806,20 @@ proc user_free stdcall, base:dword neg ebx call update_mem_size call user_normalize + pop edi + pop ebx + pop esi ret .exit: xor eax, eax inc eax + pop esi ret .cantfree: xor eax, eax + pop edi + pop ebx + pop esi ret endp diff --git a/kernel/trunk/core/memory.inc b/kernel/trunk/core/memory.inc index eb49c49b0..0a746c9a7 100644 --- a/kernel/trunk/core/memory.inc +++ b/kernel/trunk/core/memory.inc @@ -1134,6 +1134,8 @@ proc create_ring_buffer stdcall, size:dword, flags:dword test eax, eax jz .fail + push ebx + mov [buf_ptr], eax mov ebx, [size] @@ -1146,6 +1148,8 @@ proc create_ring_buffer stdcall, size:dword, flags:dword test eax, eax jz .mm_fail + push edi + or eax, [flags] mov edi, [buf_ptr] mov ebx, [buf_ptr] @@ -1164,10 +1168,13 @@ proc create_ring_buffer stdcall, size:dword, flags:dword jnz @B mov eax, [buf_ptr] + pop edi + pop ebx ret .mm_fail: stdcall free_kernel_space, [buf_ptr] xor eax, eax + pop ebx .fail: ret endp diff --git a/kernel/trunk/core/peload.inc b/kernel/trunk/core/peload.inc index ee9f37939..c02e06b29 100644 --- a/kernel/trunk/core/peload.inc +++ b/kernel/trunk/core/peload.inc @@ -29,7 +29,7 @@ endp align 4 -map_PE: +map_PE: ;stdcall base:dword, image:dword cld push ebp push edi diff --git a/kernel/trunk/video/cursors.inc b/kernel/trunk/video/cursors.inc index ada2774df..468abb720 100644 --- a/kernel/trunk/video/cursors.inc +++ b/kernel/trunk/video/cursors.inc @@ -362,9 +362,13 @@ proc load_cursor stdcall, src:dword, flags:dword stdcall load_file, [src] test eax, eax - jz .exit + jz .fail mov [src], eax @@: + push ebx + push esi + push edi + mov eax, [CURRENT_TASK] shl eax, 5 mov eax, [CURRENT_TASK+eax+4] @@ -372,11 +376,15 @@ proc load_cursor stdcall, src:dword, flags:dword mov ecx, [flags] call [create_cursor] ;eax, ebx, ecx mov [handle], eax -.fail: + cmp word [flags], LOAD_FROM_FILE jne .exit stdcall kernel_free, [src] .exit: + pop edi + pop esi + pop ebx +.fail: mov eax, [handle] ret endp