Rev 6502 | Rev 9977 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6502 | Rev 9715 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2022. 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 | ||
8 | ; External kernel dependencies (libraries) loading. |
8 | ; External kernel dependencies (libraries) loading. |
Line 9... | Line 9... | ||
9 | ; The code currently does not work, requires correcting dll.inc. |
9 | ; The code currently does not work, requires correcting dll.inc. |
Line 10... | Line 10... | ||
10 | 10 | ||
11 | $Revision: 6502 $ |
11 | $Revision: 9715 $ |
12 | 12 | ||
13 | if 0 |
13 | if 0 |
Line 73... | Line 73... | ||
73 | stdcall load_file, [file_name] |
73 | stdcall load_file, [file_name] |
74 | test eax, eax |
74 | test eax, eax |
75 | jz .fail |
75 | jz .fail |
Line 76... | Line 76... | ||
76 | 76 | ||
77 | mov [coff], eax |
77 | mov [coff], eax |
78 | movzx ecx, [eax+CFH.nSections] |
78 | movzx ecx, [eax + CFH.nSections] |
Line 79... | Line 79... | ||
79 | xor ebx, ebx |
79 | xor ebx, ebx |
80 | 80 | ||
81 | lea edx, [eax+20] |
81 | lea edx, [eax+20] |
82 | @@: |
82 | @@: |
83 | add ebx, [edx+CFS.SizeOfRawData] |
83 | add ebx, [edx + CFS.SizeOfRawData] |
84 | add ebx, 15 |
84 | add ebx, 15 |
85 | and ebx, not 15 |
85 | and ebx, not 15 |
86 | add edx, COFF_SECTION_SIZE |
86 | add edx, COFF_SECTION_SIZE |
Line 93... | Line 93... | ||
93 | test eax, eax |
93 | test eax, eax |
94 | jz .fail |
94 | jz .fail |
95 | mov [img_base], eax |
95 | mov [img_base], eax |
Line 96... | Line 96... | ||
96 | 96 | ||
97 | mov edx, [coff] |
97 | mov edx, [coff] |
98 | movzx ebx, [edx+CFH.nSections] |
98 | movzx ebx, [edx + CFH.nSections] |
99 | mov edi, [img_base] |
99 | mov edi, [img_base] |
100 | lea eax, [edx+20] |
100 | lea eax, [edx+20] |
101 | @@: |
101 | @@: |
102 | mov [eax+CFS.VirtualAddress], edi |
102 | mov [eax + CFS.VirtualAddress], edi |
103 | mov esi, [eax+CFS.PtrRawData] |
103 | mov esi, [eax + CFS.PtrRawData] |
104 | test esi, esi |
104 | test esi, esi |
105 | jnz .copy |
105 | jnz .copy |
106 | add edi, [eax+CFS.SizeOfRawData] |
106 | add edi, [eax + CFS.SizeOfRawData] |
107 | jmp .next |
107 | jmp .next |
108 | .copy: |
108 | .copy: |
109 | add esi, edx |
109 | add esi, edx |
110 | mov ecx, [eax+CFS.SizeOfRawData] |
110 | mov ecx, [eax + CFS.SizeOfRawData] |
111 | cld |
111 | cld |
112 | rep movsb |
112 | rep movsb |
113 | .next: |
113 | .next: |
114 | add edi, 15 |
114 | add edi, 15 |
115 | and edi, not 15 |
115 | and edi, not 15 |
116 | add eax, COFF_SECTION_SIZE |
116 | add eax, COFF_SECTION_SIZE |
117 | dec ebx |
117 | dec ebx |
Line 118... | Line 118... | ||
118 | jnz @B |
118 | jnz @B |
119 | 119 | ||
120 | mov ebx, [edx+CFH.pSymTable] |
120 | mov ebx, [edx + CFH.pSymTable] |
121 | add ebx, edx |
121 | add ebx, edx |
122 | mov [sym], ebx |
122 | mov [sym], ebx |
123 | mov ecx, [edx+CFH.nSymbols] |
123 | mov ecx, [edx + CFH.nSymbols] |
124 | add ecx, ecx |
124 | add ecx, ecx |
125 | lea ecx, [ecx+ecx*8];ecx*=18 = nSymbols*CSYM_SIZE |
125 | lea ecx, [ecx + ecx*8];ecx*=18 = nSymbols*CSYM_SIZE |
Line 126... | Line 126... | ||
126 | add ecx, [sym] |
126 | add ecx, [sym] |
Line 127... | Line 127... | ||
127 | mov [strings], ecx |
127 | mov [strings], ecx |
128 | 128 | ||
129 | lea eax, [edx+20] |
129 | lea eax, [edx+20] |
130 | 130 | ||
Line 131... | Line 131... | ||
131 | stdcall fix_coff_symbols, eax, [sym], [edx+CFH.nSymbols], \ |
131 | stdcall fix_coff_symbols, eax, [sym], [edx + CFH.nSymbols], \ |
132 | [strings], dword 0 |
132 | [strings], dword 0 |
133 | test eax, eax |
133 | test eax, eax |
134 | jnz @F |
134 | jnz @F |
135 | 135 | ||
136 | @@: |
136 | @@: |
137 | mov edx, [coff] |
137 | mov edx, [coff] |
138 | movzx ebx, [edx+CFH.nSections] |
138 | movzx ebx, [edx + CFH.nSections] |
139 | mov edi, 0 |
139 | mov edi, 0 |
140 | lea eax, [edx+20] |
140 | lea eax, [edx+20] |
Line 141... | Line 141... | ||
141 | @@: |
141 | @@: |