yet another stdcall fix

git-svn-id: svn://kolibrios.org@662 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-10-20 21:02:38 +00:00
parent 0ceaac39cf
commit 39d4709d97
6 changed files with 71 additions and 18 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -29,7 +29,7 @@ endp
align 4
map_PE:
map_PE: ;stdcall base:dword, image:dword
cld
push ebp
push edi

View File

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