forked from KolibriOS/kolibrios
fixed wrong COFF size calculations in load_driver and load_library
git-svn-id: svn://kolibrios.org@206 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
3eda462807
commit
7c1c3a07a8
@ -403,6 +403,7 @@ struc COFF_SECTION
|
|||||||
.NumLinenum dw ?
|
.NumLinenum dw ?
|
||||||
.Characteristics dd ?
|
.Characteristics dd ?
|
||||||
}
|
}
|
||||||
|
COFF_SECTION_SIZE equ 40
|
||||||
|
|
||||||
struc COFF_RELOC
|
struc COFF_RELOC
|
||||||
{ .VirtualAddress dd ?
|
{ .VirtualAddress dd ?
|
||||||
|
@ -523,6 +523,8 @@ proc load_file stdcall, file_name:dword
|
|||||||
test eax, eax
|
test eax, eax
|
||||||
jnz .fail
|
jnz .fail
|
||||||
|
|
||||||
|
mov eax, [file_size]
|
||||||
|
|
||||||
stdcall kernel_alloc, [file_size]
|
stdcall kernel_alloc, [file_size]
|
||||||
mov [file], eax
|
mov [file], eax
|
||||||
|
|
||||||
@ -674,7 +676,7 @@ proc fix_coff_relocs stdcall, coff:dword, sec:dword, sym:dword
|
|||||||
dec ecx
|
dec ecx
|
||||||
jnz .next_reloc
|
jnz .next_reloc
|
||||||
.next:
|
.next:
|
||||||
add [sec], 40
|
add [sec], COFF_SECTION_SIZE
|
||||||
dec [n_sec]
|
dec [n_sec]
|
||||||
jnz .fix_sec
|
jnz .fix_sec
|
||||||
.exit:
|
.exit:
|
||||||
@ -709,7 +711,7 @@ proc load_driver stdcall, file_name:dword
|
|||||||
add ebx, [edx+CFS.SizeOfRawData]
|
add ebx, [edx+CFS.SizeOfRawData]
|
||||||
add ebx, 15
|
add ebx, 15
|
||||||
and ebx, not 15
|
and ebx, not 15
|
||||||
add edx, 18
|
add edx, COFF_SECTION_SIZE
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz @B
|
jnz @B
|
||||||
mov [img_size], ebx
|
mov [img_size], ebx
|
||||||
@ -747,7 +749,7 @@ proc load_driver stdcall, file_name:dword
|
|||||||
.next:
|
.next:
|
||||||
add edi, 15
|
add edi, 15
|
||||||
and edi, not 15
|
and edi, not 15
|
||||||
add eax, 40
|
add eax, COFF_SECTION_SIZE
|
||||||
dec ebx
|
dec ebx
|
||||||
jnz @B
|
jnz @B
|
||||||
|
|
||||||
@ -835,7 +837,7 @@ proc load_library stdcall, file_name:dword
|
|||||||
add ebx, [edx+CFS.SizeOfRawData]
|
add ebx, [edx+CFS.SizeOfRawData]
|
||||||
add ebx, 15
|
add ebx, 15
|
||||||
and ebx, not 15
|
and ebx, not 15
|
||||||
add edx, 18
|
add edx, COFF_SECTION_SIZE
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz @B
|
jnz @B
|
||||||
mov [img_size], ebx
|
mov [img_size], ebx
|
||||||
@ -867,7 +869,7 @@ proc load_library stdcall, file_name:dword
|
|||||||
.next:
|
.next:
|
||||||
add edi, 15-new_app_base
|
add edi, 15-new_app_base
|
||||||
and edi, not 15
|
and edi, not 15
|
||||||
add eax, 40
|
add eax, COFF_SECTION_SIZE
|
||||||
dec ebx
|
dec ebx
|
||||||
jnz @B
|
jnz @B
|
||||||
|
|
||||||
@ -894,7 +896,7 @@ proc load_library stdcall, file_name:dword
|
|||||||
lea eax, [edx+20]
|
lea eax, [edx+20]
|
||||||
@@:
|
@@:
|
||||||
add [eax+CFS.VirtualAddress], edi ;patch user space offset
|
add [eax+CFS.VirtualAddress], edi ;patch user space offset
|
||||||
add eax, 40
|
add eax, COFF_SECTION_SIZE
|
||||||
dec ebx
|
dec ebx
|
||||||
jnz @B
|
jnz @B
|
||||||
|
|
||||||
|
@ -257,8 +257,8 @@ proc alloc_kernel_space stdcall, size:dword
|
|||||||
cli
|
cli
|
||||||
|
|
||||||
mov eax, [size]
|
mov eax, [size]
|
||||||
add eax, 0xFFF
|
add eax, 4095
|
||||||
and eax, 0xFFFFF000;
|
and eax, not 4095
|
||||||
mov [size], eax
|
mov [size], eax
|
||||||
cmp eax, [heap_free]
|
cmp eax, [heap_free]
|
||||||
ja .error
|
ja .error
|
||||||
@ -499,8 +499,8 @@ proc kernel_alloc stdcall, size:dword
|
|||||||
endl
|
endl
|
||||||
|
|
||||||
mov eax, [size]
|
mov eax, [size]
|
||||||
add eax, 0xFFF
|
add eax, 4095
|
||||||
and eax, 0xFFFFF000;
|
and eax, not 4095;
|
||||||
mov [size], eax
|
mov [size], eax
|
||||||
and eax, eax
|
and eax, eax
|
||||||
jz .error
|
jz .error
|
||||||
|
Loading…
Reference in New Issue
Block a user