177,6 → 177,7 |
mov edx,eax ;read file block to current page |
mov eax,[esp+4] ;restore pointer to file name |
mov ecx,8 ;number of blocks read |
mov ebp,edx ;save buffer address for .endofimage |
push ebx |
mov edi,[esp+16] |
; cli |
184,17 → 185,33 |
;ebx=file size |
; sti |
pop ecx |
add ecx,8 |
test eax,eax |
jnz .endloop1 ;check io errors |
mov eax,[app_i_end] |
add eax,511 |
shr eax,9 |
cmp ecx,eax |
jg .endofimage ;we have loaded whole program |
add ebx,511 |
shr ebx,9 |
cmp ecx,ebx |
jg .endloop1 ;if end of file? |
mov ebx,ecx |
test eax,eax |
jnz .endloop1 ;check io errors |
pop edx |
add ebx,8 ;go to next page |
add edx,4 |
jmp .loop1 |
|
.endofimage: ;set to zero memory at end of page |
mov ecx,[app_i_end] |
and ecx,4096-1 |
jz .endloop1 |
lea edi,[ebp+ecx] |
neg ecx |
add ecx,4096 |
xor eax,eax |
cld |
rep stosb |
.endloop1: |
add esp,8+4 ;pop linear address of page table entry and pointer to file name |
call new_start_application_fl.add_app_parameters |
342,6 → 359,7 |
mov edx,eax ;read file block to current page |
mov eax,[esp+4] ;restore pointer to file name |
mov ecx,8 ;number of blocks read |
mov ebp,edx ;save buffer address for .endofimage |
push ebx |
cli |
call fileread |
348,17 → 366,33 |
;ebx=file size |
call safe_sti |
pop ecx |
add ecx,8 |
test eax,eax |
jnz .endloop1 ;check io errors |
mov eax,[app_i_end] |
add eax,511 |
shr eax,9 |
cmp ecx,eax |
jg .endofimage ;we have loaded whole program |
add ebx,511 |
shr ebx,9 |
cmp ecx,ebx |
jg .endloop1 ;if end of file? |
mov ebx,ecx |
test eax,eax |
jnz .endloop1 ;check io errors |
pop edx |
add ebx,8 ;go to next page |
add edx,4 |
jmp .loop1 |
|
.endofimage: ;set to zero memory at end of page |
mov ecx,[app_i_end] |
and ecx,4096-1 |
jz .endloop1 |
lea edi,[ebp+ecx] |
neg ecx |
add ecx,4096 |
xor eax,eax |
cld |
rep stosb |
.endloop1: |
add esp,8 ;pop linear address of page table entry and pointer to file name |
call .add_app_parameters |