Rev 115 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 115 | Rev 130 | ||
---|---|---|---|
Line 175... | Line 175... | ||
175 | and eax,not (4096-1) |
175 | and eax,not (4096-1) |
176 | call MEM_Get_Linear_Address |
176 | call MEM_Get_Linear_Address |
177 | mov edx,eax ;read file block to current page |
177 | mov edx,eax ;read file block to current page |
178 | mov eax,[esp+4] ;restore pointer to file name |
178 | mov eax,[esp+4] ;restore pointer to file name |
179 | mov ecx,8 ;number of blocks read |
179 | mov ecx,8 ;number of blocks read |
- | 180 | mov ebp,edx ;save buffer address for .endofimage |
|
180 | push ebx |
181 | push ebx |
181 | mov edi,[esp+16] |
182 | mov edi,[esp+16] |
182 | ; cli |
183 | ; cli |
183 | call floppy_fileread |
184 | call floppy_fileread |
184 | ;ebx=file size |
185 | ;ebx=file size |
185 | ; sti |
186 | ; sti |
186 | pop ecx |
187 | pop ecx |
- | 188 | add ecx,8 |
|
- | 189 | test eax,eax |
|
- | 190 | jnz .endloop1 ;check io errors |
|
- | 191 | mov eax,[app_i_end] |
|
- | 192 | add eax,511 |
|
- | 193 | shr eax,9 |
|
- | 194 | cmp ecx,eax |
|
- | 195 | jg .endofimage ;we have loaded whole program |
|
- | 196 | add ebx,511 |
|
187 | shr ebx,9 |
197 | shr ebx,9 |
188 | cmp ecx,ebx |
198 | cmp ecx,ebx |
189 | jg .endloop1 ;if end of file? |
199 | jg .endloop1 ;if end of file? |
190 | mov ebx,ecx |
200 | mov ebx,ecx |
191 | test eax,eax |
- | |
192 | jnz .endloop1 ;check io errors |
- | |
193 | pop edx |
201 | pop edx |
194 | add ebx,8 ;go to next page |
- | |
195 | add edx,4 |
202 | add edx,4 |
196 | jmp .loop1 |
203 | jmp .loop1 |
Line -... | Line 204... | ||
- | 204 | ||
- | 205 | .endofimage: ;set to zero memory at end of page |
|
- | 206 | mov ecx,[app_i_end] |
|
- | 207 | and ecx,4096-1 |
|
- | 208 | jz .endloop1 |
|
- | 209 | lea edi,[ebp+ecx] |
|
- | 210 | neg ecx |
|
- | 211 | add ecx,4096 |
|
- | 212 | xor eax,eax |
|
- | 213 | cld |
|
197 | 214 | rep stosb |
|
198 | .endloop1: |
215 | .endloop1: |
199 | add esp,8+4 ;pop linear address of page table entry and pointer to file name |
216 | add esp,8+4 ;pop linear address of page table entry and pointer to file name |
200 | call new_start_application_fl.add_app_parameters |
217 | call new_start_application_fl.add_app_parameters |
201 | mov [esp+28],eax |
218 | mov [esp+28],eax |
Line 340... | Line 357... | ||
340 | and eax,not (4096-1) |
357 | and eax,not (4096-1) |
341 | call MEM_Get_Linear_Address |
358 | call MEM_Get_Linear_Address |
342 | mov edx,eax ;read file block to current page |
359 | mov edx,eax ;read file block to current page |
343 | mov eax,[esp+4] ;restore pointer to file name |
360 | mov eax,[esp+4] ;restore pointer to file name |
344 | mov ecx,8 ;number of blocks read |
361 | mov ecx,8 ;number of blocks read |
- | 362 | mov ebp,edx ;save buffer address for .endofimage |
|
345 | push ebx |
363 | push ebx |
346 | cli |
364 | cli |
347 | call fileread |
365 | call fileread |
348 | ;ebx=file size |
366 | ;ebx=file size |
349 | call safe_sti |
367 | call safe_sti |
350 | pop ecx |
368 | pop ecx |
- | 369 | add ecx,8 |
|
- | 370 | test eax,eax |
|
- | 371 | jnz .endloop1 ;check io errors |
|
- | 372 | mov eax,[app_i_end] |
|
- | 373 | add eax,511 |
|
- | 374 | shr eax,9 |
|
- | 375 | cmp ecx,eax |
|
- | 376 | jg .endofimage ;we have loaded whole program |
|
- | 377 | add ebx,511 |
|
351 | shr ebx,9 |
378 | shr ebx,9 |
352 | cmp ecx,ebx |
379 | cmp ecx,ebx |
353 | jg .endloop1 ;if end of file? |
380 | jg .endloop1 ;if end of file? |
354 | mov ebx,ecx |
381 | mov ebx,ecx |
355 | test eax,eax |
- | |
356 | jnz .endloop1 ;check io errors |
- | |
357 | pop edx |
382 | pop edx |
358 | add ebx,8 ;go to next page |
- | |
359 | add edx,4 |
383 | add edx,4 |
360 | jmp .loop1 |
384 | jmp .loop1 |
Line -... | Line 385... | ||
- | 385 | ||
- | 386 | .endofimage: ;set to zero memory at end of page |
|
- | 387 | mov ecx,[app_i_end] |
|
- | 388 | and ecx,4096-1 |
|
- | 389 | jz .endloop1 |
|
- | 390 | lea edi,[ebp+ecx] |
|
- | 391 | neg ecx |
|
- | 392 | add ecx,4096 |
|
- | 393 | xor eax,eax |
|
- | 394 | cld |
|
361 | 395 | rep stosb |
|
362 | .endloop1: |
396 | .endloop1: |
363 | add esp,8 ;pop linear address of page table entry and pointer to file name |
397 | add esp,8 ;pop linear address of page table entry and pointer to file name |
364 | call .add_app_parameters |
398 | call .add_app_parameters |
365 | mov [esp+28],eax |
399 | mov [esp+28],eax |