Rev 886 | Rev 889 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 886 | Rev 887 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2008. 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: 886 $ |
8 | $Revision: 887 $ |
9 | 9 | ||
Line 556... | Line 556... | ||
556 | ; retval |
556 | ; retval |
557 | ; eax= file image in kernel memory |
557 | ; eax= file image in kernel memory |
558 | ; ebx= size of file |
558 | ; ebx= size of file |
559 | ; |
559 | ; |
560 | ; warging |
560 | ; warging |
561 | ; You mast call kernel_free() to delete each file |
561 | ; You mast call mem_free() to delete each file |
562 | ; loaded by the load_file() function |
562 | ; loaded by the load_file() function |
Line 563... | Line 563... | ||
563 | 563 | ||
564 | align 4 |
564 | align 4 |
565 | proc load_file stdcall, file_name:dword |
565 | proc load_file stdcall, file_name:dword |
Line 634... | Line 634... | ||
634 | pop eax |
634 | pop eax |
635 | pop edi |
635 | pop edi |
636 | pop esi |
636 | pop esi |
637 | ret |
637 | ret |
638 | .cleanup: |
638 | .cleanup: |
- | 639 | mov ecx, [file] |
|
639 | stdcall kernel_free, [file] |
640 | call @mem_free@4 |
640 | .fail: |
641 | .fail: |
641 | xor eax, eax |
642 | xor eax, eax |
642 | xor ebx, ebx |
643 | xor ebx, ebx |
643 | pop edi |
644 | pop edi |
644 | pop esi |
645 | pop esi |
Line 824... | Line 825... | ||
824 | loop @b |
825 | loop @b |
825 | @@: |
826 | @@: |
826 | mov dword [edi], '.obj' |
827 | mov dword [edi], '.obj' |
827 | mov byte [edi+4], 0 |
828 | mov byte [edi+4], 0 |
828 | stdcall load_file, edx |
829 | stdcall load_file, edx |
829 | - | ||
- | 830 | mov [coff], eax |
|
830 | test eax, eax |
831 | test eax, eax |
831 | jz .exit |
832 | jz .exit |
Line 832... | Line -... | ||
832 | - | ||
833 | mov [coff], eax |
- | |
834 | 833 | ||
835 | movzx ebx, [eax+CFH.nSections] |
834 | movzx ebx, [eax+CFH.nSections] |
836 | lea edx, [eax+20] |
835 | lea edx, [eax+20] |
837 | xor ecx, ecx |
836 | xor ecx, ecx |
838 | @@: |
837 | @@: |
Line 845... | Line 844... | ||
845 | 844 | ||
846 | mov [img_size], ecx |
845 | mov [img_size], ecx |
847 | mov edx, PG_SW |
846 | mov edx, PG_SW |
848 | call @mem_alloc@8 |
847 | call @mem_alloc@8 |
- | 848 | test eax, eax |
|
849 | test eax, eax |
849 | mov [img_base], eax |
Line 850... | Line 850... | ||
850 | jz .fail |
850 | jz .fail |
Line 851... | Line 851... | ||
851 | 851 | ||
Line 921... | Line 921... | ||
921 | 921 | ||
922 | mov ebx, [coff] |
922 | mov ebx, [coff] |
923 | stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],szSTART |
923 | stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],szSTART |
Line -... | Line 924... | ||
- | 924 | mov [start], eax |
|
924 | mov [start], eax |
925 | |
Line 925... | Line 926... | ||
925 | 926 | mov ecx, [coff] |
|
926 | stdcall kernel_free, [coff] |
927 | call @mem_free@4 |
927 | 928 | ||
928 | mov ebx, [start] |
929 | mov ebx, [start] |
Line 929... | Line 930... | ||
929 | stdcall ebx, DRV_ENTRY |
930 | stdcall ebx, DRV_ENTRY |
- | 931 | test eax, eax |
|
930 | test eax, eax |
932 | jnz .ok |
931 | jnz .ok |
933 | |
932 | 934 | mov ecx, [img_base] |
|
933 | stdcall kernel_free, [img_base] |
935 | call @mem_free@4 |
934 | xor eax, eax |
936 | xor eax, eax |
Line 959... | Line 961... | ||
959 | mov esi, [driver_name] |
961 | mov esi, [driver_name] |
960 | call sys_msg_board_str |
962 | call sys_msg_board_str |
961 | mov esi, msg_CR |
963 | mov esi, msg_CR |
962 | call sys_msg_board_str |
964 | call sys_msg_board_str |
963 | .cleanup: |
965 | .cleanup: |
964 | stdcall kernel_free,[img_base] |
966 | mov ecx, [img_base] |
- | 967 | call @mem_free@4 |
|
965 | .fail: |
968 | .fail: |
- | 969 | mov ecx, [coff] |
|
966 | stdcall kernel_free, [coff] |
970 | call @mem_free@4 |
967 | .exit: |
971 | .exit: |
968 | xor eax, eax |
972 | xor eax, eax |
969 | ret |
973 | ret |
970 | endp |
974 | endp |
Line 1063... | Line 1067... | ||
1063 | 1067 | ||
1064 | mov ebx, [coff] |
1068 | mov ebx, [coff] |
1065 | stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],szEXPORTS |
1069 | stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],szEXPORTS |
Line -... | Line 1070... | ||
- | 1070 | mov [exports], eax |
|
1066 | mov [exports], eax |
1071 | |
- | 1072 | mov ecx, [coff] |
|
1067 | 1073 | call @mem_free@4 |
|
1068 | stdcall kernel_free, [coff] |
1074 | |
1069 | mov eax, [exports] |
1075 | mov eax, [exports] |
1070 | ret |
1076 | ret |
1071 | .fail: |
1077 | .fail: |