Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 8700 → Rev 8709

/kernel/trunk/core/taskman.inc
834,6 → 834,8
mov ebp, [ebp+APPDATA.exec_params]
test ebp, ebp
jz .exit
; APPDATA.exec_params have first thread only,
; so second and next threads don't get here (they jump to .exit)
stdcall map_process_image, [ebp+APP_HDR._emem],\
[ebp+APP_HDR.img_base], [ebp+APP_HDR.img_size]
mov esi, [ebp+APP_HDR.path_string]
893,53 → 895,34
mov dx, app_tls
mov fs, dx
; { Patch by Coldy, For DLL autoload
; if APP_HEADER.version = 2 => lib/load dll.obj & change eip to APP_START_THUNK)
.try_load_dll:
; TODO: It;s app, not thread?
; Test app header version (
; Test app header version
mov ecx, dword[ebp+APP_HDR.img_base]
;DEBUGF 1, "K : ecx = %d\n", [ecx+8]
cmp dword[ecx+8], 2
jne .cleanup
;if APP_HEADER.version = 2 => load lib/dll.obj & change eip to APP_STARTUP_THUNK
DEBUGF 1, 'K : App header version 2\n'
;DEBUGF 1, "K : DLL.OBJ path: %s\n", dll_lib_path
stdcall load_library, dll_lib_path, 0
;DEBUGF 1, "K : DLL.OBJ exp ptr: %x\n", eax
;test eax, eax
;jnz @f
cmp eax, 0
jne @f
; Something went wrong
; Something went wrong (TODO: Next 2 line is code copy after .cleanup)
stdcall free_kernel_space, [ebp+APP_HDR.img_base]
stdcall kernel_free, ebp
DEBUGF 1, 'K : DLL.OBJ not found! Terminate application!'
DEBUGF 1, 'K : DLL.OBJ not found! Terminate application!\n'
mov ebx, dll_error_msg
mov ebp, notifyapp
call fs_execute_from_sysdir_param
; Terminate process
; Terminate process (TODO: Need jump to .cleanup after sys_end ?)
call sys_end
@@:
; Find base of DLL.OBJ
;mov ebx, eax
;cdq
;mov ecx, 0x00000400
;div ecx
;sub ebx, edx
; Find APP_STARTUP_THUNK in DLL.OBJ
sub eax, 4
mov eax, [eax]
;DEBUGF 1, "K : DLL.OBJ base ptr: %x\n", eax
; load_library don't map coff header,
; so we may change entry point for app APP_START_THUNK
; to base of DLL.OBJ
;.change_eip:
mov ecx, [current_slot]
mov ecx, [ecx+APPDATA.pl0_stack]
;DEBUGF 1, "K : EIP = %x\n", ebx
mov [ecx+REG_EIP], eax
; } End patch by Coldy, For DLL autoload