Subversion Repositories Kolibri OS

Rev

Rev 4478 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4478 Rev 6467
Line 1... Line 1...
1
; flat assembler core
1
; flat assembler core
2
; Copyright (c) 1999-2013, Tomasz Grysztar.
2
; Copyright (c) 1999-2016, Tomasz Grysztar.
3
; All rights reserved.
3
; All rights reserved.
Line 4... Line 4...
4
 
4
 
5
formatter:
5
formatter:
6
	mov	[current_offset],edi
6
	mov	[current_offset],edi
Line 452... Line 452...
452
	mov	[code_type],16
452
	mov	[code_type],16
453
	jmp	format_defined
453
	jmp	format_defined
454
mark_mz_relocation:
454
mark_mz_relocation:
455
	push	eax ebx
455
	push	eax ebx
456
	inc	[number_of_relocations]
456
	inc	word [number_of_relocations]
457
	mov	ebx,[free_additional_memory]
457
	jz	format_limitations_exceeded
-
 
458
	mov	ebx,[free_additional_memory]
458
	mov	eax,edi
459
	mov	eax,edi
459
	sub	eax,[code_start]
460
	sub	eax,[code_start]
460
	mov	[ebx],ax
461
	mov	[ebx],ax
461
	shr	eax,16
462
	shr	eax,16
462
	shl	ax,12
463
	shl	ax,12
Line 1609... Line 1610...
1609
	lea	eax,[ecx*5]
1610
	lea	eax,[ecx*5]
1610
	sub	esi,eax
1611
	sub	esi,eax
1611
	mov	[free_additional_memory],esi
1612
	mov	[free_additional_memory],esi
1612
	mov	edx,[last_fixup_base]
1613
	mov	edx,[last_fixup_base]
1613
	mov	ebp,edi
1614
	mov	ebx,[last_fixup_header]
-
 
1615
	mov	ebp,edi
1614
	jecxz	fixups_done
1616
	jecxz	fixups_done
1615
      make_fixup:
1617
      make_fixup:
1616
	cmp	[esi],edx
1618
	cmp	[esi],edx
1617
	jb	store_fixup
1619
	jb	store_fixup
1618
	mov	eax,edi
1620
	mov	eax,edi
Line 1643... Line 1645...
1643
	add	esi,5
1645
	add	esi,5
1644
	loop	make_fixup
1646
	loop	make_fixup
1645
      fixups_done:
1647
      fixups_done:
1646
	mov	[last_fixup_base],edx
1648
	mov	[last_fixup_base],edx
1647
	pop	esi
1649
	mov	[last_fixup_header],ebx
-
 
1650
	pop	esi
1648
	mov	eax,edi
1651
	mov	eax,edi
1649
	sub	eax,ebp
1652
	sub	eax,ebp
1650
	ret
1653
	ret
1651
make_pe_resource:
1654
make_pe_resource:
1652
	cmp	byte [esi],82h
1655
	cmp	byte [esi],82h
Line 3489... Line 3492...
3489
	mov	eax,[eax]
3492
	mov	eax,[eax]
3490
	shr	eax,8
3493
	shr	eax,8
3491
	stos	dword [edi]
3494
	stos	dword [edi]
3492
	xor	eax,eax
3495
	xor	eax,eax
3493
	stos	dword [edi]
3496
	push	edx
-
 
3497
	mov	edx,[esi+4]
-
 
3498
	add	edx,[image_base]
-
 
3499
	xchg	eax,[edx]
-
 
3500
	stos	dword [edi]
-
 
3501
	cmp	byte [esi],1
-
 
3502
	je	addend_64bit
-
 
3503
	pop	edx
-
 
3504
	sar	eax,31
-
 
3505
	stos	dword [edi]
3494
	stos	dword [edi]
3506
	jmp	relocation_entry_ok
-
 
3507
      addend_64bit:
-
 
3508
	xor	eax,eax
-
 
3509
	xchg	eax,[edx+4]
-
 
3510
	stos	dword [edi]
3495
      relocation_entry_ok:
3511
	pop	edx
-
 
3512
      relocation_entry_ok:
3496
	add	esi,0Ch
3513
	add	esi,0Ch
3497
	jmp	convert_relocations
3514
	jmp	convert_relocations
3498
      store_elf_machine_word:
3515
      store_elf_machine_word:
3499
	stos	dword [edi]
3516
	stos	dword [edi]
3500
	test	[format_flags],8
3517
	test	[format_flags],8