Rev 8671 | Rev 8840 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8671 | Rev 8709 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License. ;; |
4 | ;; Distributed under terms of the GNU General Public License. ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line 7... | ||
7 | 7 | ||
Line 8... | Line 8... | ||
8 | $Revision: 8671 $ |
8 | $Revision: 8709 $ |
Line 9... | Line 9... | ||
9 | 9 | ||
Line 832... | Line 832... | ||
832 | common_app_entry: |
832 | common_app_entry: |
833 | mov ebp, [current_slot] |
833 | mov ebp, [current_slot] |
834 | mov ebp, [ebp+APPDATA.exec_params] |
834 | mov ebp, [ebp+APPDATA.exec_params] |
835 | test ebp, ebp |
835 | test ebp, ebp |
836 | jz .exit |
836 | jz .exit |
- | 837 | ; APPDATA.exec_params have first thread only, |
|
- | 838 | ; so second and next threads don't get here (they jump to .exit) |
|
837 | stdcall map_process_image, [ebp+APP_HDR._emem],\ |
839 | stdcall map_process_image, [ebp+APP_HDR._emem],\ |
838 | [ebp+APP_HDR.img_base], [ebp+APP_HDR.img_size] |
840 | [ebp+APP_HDR.img_base], [ebp+APP_HDR.img_size] |
839 | mov esi, [ebp+APP_HDR.path_string] |
841 | mov esi, [ebp+APP_HDR.path_string] |
840 | mov edi, [ebp+APP_HDR.path] |
842 | mov edi, [ebp+APP_HDR.path] |
841 | mov ecx, [ebp+APP_HDR.filename_size] |
843 | mov ecx, [ebp+APP_HDR.filename_size] |
Line 891... | Line 893... | ||
891 | mov [tls_data_l+4], al |
893 | mov [tls_data_l+4], al |
892 | mov [tls_data_l+7], ah |
894 | mov [tls_data_l+7], ah |
893 | mov dx, app_tls |
895 | mov dx, app_tls |
894 | mov fs, dx |
896 | mov fs, dx |
895 | ; { Patch by Coldy, For DLL autoload |
897 | ; { Patch by Coldy, For DLL autoload |
896 | ; if APP_HEADER.version = 2 => lib/load dll.obj & change eip to APP_START_THUNK) |
- | |
897 | .try_load_dll: |
898 | .try_load_dll: |
898 | ; TODO: It;s app, not thread? |
- | |
899 | - | ||
900 | ; Test app header version ( |
899 | ; Test app header version |
901 | mov ecx, dword[ebp+APP_HDR.img_base] |
900 | mov ecx, dword[ebp+APP_HDR.img_base] |
902 | ;DEBUGF 1, "K : ecx = %d\n", [ecx+8] |
- | |
903 | cmp dword[ecx+8], 2 |
901 | cmp dword[ecx+8], 2 |
904 | jne .cleanup |
902 | jne .cleanup |
- | 903 | ;if APP_HEADER.version = 2 => load lib/dll.obj & change eip to APP_STARTUP_THUNK |
|
905 | DEBUGF 1, 'K : App header version 2\n' |
904 | DEBUGF 1, 'K : App header version 2\n' |
906 | ;DEBUGF 1, "K : DLL.OBJ path: %s\n", dll_lib_path |
- | |
907 | stdcall load_library, dll_lib_path, 0 |
905 | stdcall load_library, dll_lib_path, 0 |
908 | ;DEBUGF 1, "K : DLL.OBJ exp ptr: %x\n", eax |
- | |
909 | - | ||
910 | ;test eax, eax |
- | |
911 | ;jnz @f |
- | |
912 | cmp eax, 0 |
906 | cmp eax, 0 |
913 | jne @f |
907 | jne @f |
914 | ; Something went wrong |
908 | ; Something went wrong (TODO: Next 2 line is code copy after .cleanup) |
915 | stdcall free_kernel_space, [ebp+APP_HDR.img_base] |
909 | stdcall free_kernel_space, [ebp+APP_HDR.img_base] |
916 | stdcall kernel_free, ebp |
910 | stdcall kernel_free, ebp |
917 | DEBUGF 1, 'K : DLL.OBJ not found! Terminate application!' |
911 | DEBUGF 1, 'K : DLL.OBJ not found! Terminate application!\n' |
918 | mov ebx, dll_error_msg |
912 | mov ebx, dll_error_msg |
919 | mov ebp, notifyapp |
913 | mov ebp, notifyapp |
920 | call fs_execute_from_sysdir_param |
914 | call fs_execute_from_sysdir_param |
921 | ; Terminate process |
915 | ; Terminate process (TODO: Need jump to .cleanup after sys_end ?) |
922 | call sys_end |
916 | call sys_end |
Line 923... | Line 917... | ||
923 | 917 | ||
924 | @@: |
918 | @@: |
925 | ; Find base of DLL.OBJ |
- | |
926 | ;mov ebx, eax |
- | |
927 | ;cdq |
- | |
928 | ;mov ecx, 0x00000400 |
- | |
929 | ;div ecx |
- | |
930 | ;sub ebx, edx |
919 | ; Find APP_STARTUP_THUNK in DLL.OBJ |
931 | sub eax, 4 |
920 | sub eax, 4 |
932 | mov eax, [eax] |
- | |
933 | ;DEBUGF 1, "K : DLL.OBJ base ptr: %x\n", eax |
- | |
934 | - | ||
935 | ; load_library don't map coff header, |
- | |
936 | ; so we may change entry point for app APP_START_THUNK |
- | |
Line 937... | Line 921... | ||
937 | ; to base of DLL.OBJ |
921 | mov eax, [eax] |
938 | 922 | ||
939 | ;.change_eip: |
923 | ;.change_eip: |
940 | mov ecx, [current_slot] |
- | |
941 | mov ecx, [ecx+APPDATA.pl0_stack] |
924 | mov ecx, [current_slot] |
Line 942... | Line 925... | ||
942 | ;DEBUGF 1, "K : EIP = %x\n", ebx |
925 | mov ecx, [ecx+APPDATA.pl0_stack] |
943 | mov [ecx+REG_EIP], eax |
926 | mov [ecx+REG_EIP], eax |
944 | 927 |