Subversion Repositories Kolibri OS

Rev

Rev 2664 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2664 Rev 2665
Line 33... Line 33...
33
	cmp	eax,[structures_buffer]
33
	cmp	eax,[structures_buffer]
34
	jae	out_of_memory
34
	jae	out_of_memory
35
	cmp	[file_extension],0
35
	cmp	[file_extension],0
36
	jne	extension_specified
36
	jne	extension_specified
37
	cmp	[output_format],2
37
	mov	al,[output_format]
38
	je	exe_extension
38
	cmp	al,2
-
 
39
	je	exe_extension
39
	jb	bin_extension
40
	jb	bin_extension
40
	cmp	[output_format],4
41
	cmp	al,4
41
	je	obj_extension
42
	je	obj_extension
42
	cmp	[output_format],5
43
	cmp	al,5
43
	je	o_extension
44
	je	o_extension
44
	cmp	[output_format],3
45
	cmp	al,3
45
	jne	no_extension
46
	jne	no_extension
46
	cmp	[subsystem],1
47
	cmp	[subsystem],1
47
	je	sys_extension
48
	je	sys_extension
48
	cmp	[subsystem],10
49
	cmp	[subsystem],10
49
	jae	efi_extension
50
	jae	efi_extension
50
	bt	[format_flags],8
51
	bt	[format_flags],8
Line 162... Line 163...
162
      calculate_code_size:
163
      calculate_code_size:
163
	mov	[current_offset],edi
164
	mov	[current_offset],edi
164
	sub	edi,[code_start]
165
	sub	edi,[code_start]
165
	mov	[code_size],edi
166
	mov	[code_size],edi
166
	mov	[written_size],0
167
	and	[written_size],0
167
	mov	edx,[output_file]
168
	mov	edx,[output_file]
168
	call	create
169
	call	create
169
	jc	write_failed
170
	jc	write_failed
170
	cmp	[output_format],3
171
	cmp	[output_format],3
171
	jne	stub_written
172
	jne	stub_written
172
	mov	edx,[code_start]
173
	mov	edx,[code_start]
Line 322... Line 323...
322
	lods	dword [esi]
323
	lods	dword [esi]
323
	cmp	eax,0Fh
324
	cmp	eax,0Fh
324
	jb	invalid_use_of_symbol
325
	jb	invalid_use_of_symbol
325
	je	reserved_word_used_as_symbol
326
	je	reserved_word_used_as_symbol
326
	mov	dx,[current_pass]
327
	inc	esi
-
 
328
	mov	dx,[current_pass]
327
	mov	[eax+18],dx
329
	mov	[eax+18],dx
328
	or	byte [eax+8],8
330
	or	byte [eax+8],8
329
	inc	esi
331
	cmp	[symbols_file],0
-
 
332
	je	public_reference_ok
-
 
333
	cmp	[next_pass_needed],0
-
 
334
	jne	public_reference_ok
-
 
335
	mov	ebx,eax
-
 
336
	call	store_label_reference
-
 
337
	mov	eax,ebx
330
	mov	ebx,[free_additional_memory]
338
      public_reference_ok:
-
 
339
	mov	ebx,[free_additional_memory]
331
	lea	edx,[ebx+10h]
340
	lea	edx,[ebx+10h]
332
	cmp	edx,[structures_buffer]
341
	cmp	edx,[structures_buffer]
333
	jae	out_of_memory
342
	jae	out_of_memory
334
	mov	[free_additional_memory],edx
343
	mov	[free_additional_memory],edx
335
	mov	[ebx+8],eax
344
	mov	[ebx+8],eax
Line 393... Line 402...
393
	cmp	al,11h
402
	cmp	al,11h
394
	jne	invalid_argument
403
	jne	invalid_argument
395
      extrn_size_ok:
404
      extrn_size_ok:
396
	mov	[address_symbol],edx
405
	mov	[address_symbol],edx
397
	movzx	ecx,ah
406
	mov	[label_size],ah
-
 
407
	movzx	ecx,ah
398
	mov	[edx+8],ecx
408
	mov	[edx+8],ecx
399
	xor	eax,eax
409
	xor	eax,eax
400
	xor	edx,edx
410
	xor	edx,edx
401
	xor	ebp,ebp
411
	xor	ebp,ebp
402
	mov	ch,2
412
	mov	ch,2
Line 483... Line 493...
483
	xor	eax,eax
493
	xor	eax,eax
484
	rep	stos byte [edi]
494
	rep	stos byte [edi]
485
	mov	dword [org_origin],edi
495
	mov	dword [org_origin],edi
486
	mov	dword [org_origin+4],eax
496
	mov	dword [org_origin+4],eax
487
	mov	[org_registers],eax
497
	mov	[org_origin_sign],al
-
 
498
	mov	[org_registers],eax
488
	mov	[org_start],edi
499
	mov	[org_start],edi
489
	mov	eax,edx
500
	mov	eax,edx
490
	call	undefined_data
501
	call	undefined_data
491
	mov	eax,edi
502
	mov	eax,edi
492
	sub	eax,[code_start]
503
	sub	eax,[code_start]
Line 501... Line 512...
501
	lods	byte [esi]
512
	lods	byte [esi]
502
      segment_type_ok:
513
      segment_type_ok:
503
	mov	[code_type],al
514
	mov	[code_type],al
504
	mov	eax,edx
515
	mov	eax,edx
505
	mov	cx,0100h
516
	mov	ch,1
506
	xor	edx,edx
517
	mov	[label_size],0
-
 
518
	xor	edx,edx
507
	xor	ebp,ebp
519
	xor	ebp,ebp
508
	mov	[address_symbol],edx
520
	mov	[address_symbol],edx
509
	jmp	make_free_label
521
	jmp	make_free_label
510
mz_entry:
522
mz_entry:
511
	lods	byte [esi]
523
	lods	byte [esi]
Line 513... Line 525...
513
	jne	invalid_argument
525
	jne	invalid_argument
514
	call	get_word_value
526
	call	get_word_value
515
	cmp	[value_type],1
527
	cmp	[value_type],1
516
	je	initial_cs_ok
528
	je	initial_cs_ok
517
	cmp	[error_line],0
529
	call	recoverable_invalid_address
518
	jne	initial_cs_ok
-
 
519
	mov	eax,[current_line]
-
 
520
	mov	[error_line],eax
-
 
521
	mov	[error],invalid_address
-
 
522
      initial_cs_ok:
530
      initial_cs_ok:
523
	mov	edx,[additional_memory]
531
	mov	edx,[additional_memory]
524
	mov	[edx+16h],ax
532
	mov	[edx+16h],ax
525
	lods	byte [esi]
533
	lods	byte [esi]
526
	cmp	al,':'
534
	cmp	al,':'
527
	jne	invalid_argument
535
	jne	invalid_argument
Line 534... Line 542...
534
	jne	invalid_use_of_symbol
542
	jne	invalid_use_of_symbol
535
	mov	edx,[additional_memory]
543
	mov	edx,[additional_memory]
536
	mov	[edx+14h],ax
544
	mov	[edx+14h],ax
537
	jmp	instruction_assembled
545
	jmp	instruction_assembled
538
mz_stack:
546
      recoverable_invalid_address:
-
 
547
	cmp	[error_line],0
-
 
548
	jne	ignore_invalid_address
-
 
549
	push	[current_line]
-
 
550
	pop	[error_line]
-
 
551
	mov	[error],invalid_address
-
 
552
      ignore_invalid_address:
-
 
553
	ret
-
 
554
mz_stack:
539
	lods	byte [esi]
555
	lods	byte [esi]
540
	cmp	al,'('
556
	cmp	al,'('
541
	jne	invalid_argument
557
	jne	invalid_argument
542
	call	get_word_value
558
	call	get_word_value
543
	cmp	byte [esi],':'
559
	cmp	byte [esi],':'
Line 551... Line 567...
551
	jmp	instruction_assembled
567
	jmp	instruction_assembled
552
      stack_pointer:
568
      stack_pointer:
553
	cmp	[value_type],1
569
	cmp	[value_type],1
554
	je	initial_ss_ok
570
	je	initial_ss_ok
555
	cmp	[error_line],0
571
	call	recoverable_invalid_address
556
	jne	initial_ss_ok
-
 
557
	mov	eax,[current_line]
-
 
558
	mov	[error_line],eax
-
 
559
	mov	[error],invalid_address
-
 
560
      initial_ss_ok:
572
      initial_ss_ok:
561
	mov	edx,[additional_memory]
573
	mov	edx,[additional_memory]
562
	mov	[edx+0Eh],ax
574
	mov	[edx+0Eh],ax
563
	lods	byte [esi]
575
	lods	byte [esi]
564
	cmp	al,':'
576
	cmp	al,':'
565
	jne	invalid_argument
577
	jne	invalid_argument
Line 832... Line 844...
832
	mov	[machine],14Ch
844
	mov	[machine],14Ch
833
	mov	[subsystem],3
845
	mov	[subsystem],3
834
	mov	[subsystem_version],3 + 10 shl 16
846
	mov	[subsystem_version],3 + 10 shl 16
835
	mov	[image_base],400000h
847
	mov	[image_base],400000h
836
	mov	[image_base_high],0
848
	and	[image_base_high],0
837
	test	[format_flags],8
849
	test	[format_flags],8
838
	jz	pe_settings
850
	jz	pe_settings
839
	mov	[machine],8664h
851
	mov	[machine],8664h
840
	mov	[subsystem_version],5 + 0 shl 16
852
	mov	[subsystem_version],5 + 0 shl 16
841
      pe_settings:
853
      pe_settings:
842
	cmp	byte [esi],84h
854
	cmp	byte [esi],84h
Line 1059... Line 1071...
1059
	bt	[format_flags],8
1071
	bt	[format_flags],8
1060
	jc	pe_entry_init_ok
1072
	jc	pe_entry_init_ok
1061
	mov	[edx+28h],eax		; entry point rva
1073
	mov	[edx+28h],eax		; entry point rva
1062
      pe_entry_init_ok:
1074
      pe_entry_init_ok:
1063
	mov	[number_of_sections],0
1075
	and	[number_of_sections],0
1064
	movzx	ebx,word [edx+14h]
1076
	movzx	ebx,word [edx+14h]
1065
	lea	ebx,[edx+18h+ebx]
1077
	lea	ebx,[edx+18h+ebx]
1066
	mov	[current_section],ebx
1078
	mov	[current_section],ebx
1067
	mov	dword [ebx],'.fla'
1079
	mov	dword [ebx],'.fla'
1068
	mov	dword [ebx+4],'t'
1080
	mov	dword [ebx+4],'t'
1069
	mov	[ebx+14h],edi
1081
	mov	[ebx+14h],edi
1070
	mov	[ebx+0Ch],eax
1082
	mov	[ebx+0Ch],eax
1071
	mov	dword [ebx+24h],0E0000060h
1083
	mov	dword [ebx+24h],0E0000060h
1072
	xor	ecx,ecx
1084
	xor	ecx,ecx
1073
	not	eax
1085
	xor	bl,bl
-
 
1086
	not	eax
1074
	not	ecx
1087
	not	ecx
1075
	add	eax,1
1088
	not	bl
-
 
1089
	add	eax,1
1076
	adc	ecx,0
1090
	adc	ecx,0
1077
	add	eax,edi
1091
	adc	bl,0
-
 
1092
	add	eax,edi
1078
	adc	ecx,0
1093
	adc	ecx,0
1079
	test	[format_flags],4
1094
	adc	bl,0
-
 
1095
	test	[format_flags],4
1080
	jnz	peplus_org
1096
	jnz	peplus_org
1081
	sub	eax,[edx+34h]
1097
	sub	eax,[edx+34h]
1082
	sbb	ecx,0
1098
	sbb	ecx,0
1083
	jmp	pe_org_ok
1099
	sbb	bl,0
-
 
1100
	jmp	pe_org_ok
1084
      peplus_org:
1101
      peplus_org:
1085
	sub	eax,[edx+30h]
1102
	sub	eax,[edx+30h]
1086
	sbb	ecx,[edx+34h]
1103
	sbb	ecx,[edx+34h]
1087
      pe_org_ok:
1104
	sbb	bl,0
-
 
1105
      pe_org_ok:
1088
	test	[format_flags],8
1106
	test	[format_flags],8
1089
	jnz	pe64_code
1107
	jnz	pe64_code
1090
	mov	bl,2
1108
	mov	bh,2
1091
	mov	[code_type],32
1109
	mov	[code_type],32
1092
	jmp	pe_code_type_ok
1110
	jmp	pe_code_type_ok
1093
      pe64_code:
1111
      pe64_code:
1094
	mov	bl,4
1112
	mov	bh,4
1095
	mov	[code_type],64
1113
	mov	[code_type],64
1096
      pe_code_type_ok:
1114
      pe_code_type_ok:
1097
	bt	[resolver_flags],0
1115
	bt	[resolver_flags],0
1098
	jc	pe_labels_type_ok
1116
	jc	pe_labels_type_ok
1099
	xor	bl,bl
1117
	xor	bh,bh
1100
      pe_labels_type_ok:
1118
      pe_labels_type_ok:
1101
	mov	[labels_type],bl
1119
	mov	[labels_type],bh
1102
	mov	dword [org_origin],eax
1120
	mov	dword [org_origin],eax
1103
	mov	dword [org_origin+4],ecx
1121
	mov	dword [org_origin+4],ecx
1104
	mov	[org_registers],0
1122
	mov	[org_origin_sign],bl
-
 
1123
	and	[org_registers],0
1105
	mov	[org_start],edi
1124
	mov	[org_start],edi
1106
	bt	[format_flags],8
1125
	bt	[format_flags],8
1107
	jnc	dll_flag_ok
1126
	jnc	dll_flag_ok
1108
	or	byte [edx+16h+1],20h
1127
	or	byte [edx+16h+1],20h
1109
      dll_flag_ok:
1128
      dll_flag_ok:
1110
	bt	[format_flags],9
1129
	bt	[format_flags],9
Line 1153... Line 1172...
1153
	mov	edi,ebx
1172
	mov	edi,ebx
1154
	mov	esi,edx
1173
	mov	esi,edx
1155
	rep	movs byte [edi],[esi]
1174
	rep	movs byte [edi],[esi]
1156
	pop	edi esi
1175
	pop	edi esi
1157
	mov	dword [ebx+24h],0
1176
	and	dword [ebx+24h],0
1158
	mov	[ebx+14h],edi
1177
	mov	[ebx+14h],edi
1159
	mov	edx,[code_start]
1178
	mov	edx,[code_start]
1160
	mov	eax,edi
1179
	mov	eax,edi
1161
	xor	ecx,ecx
1180
	xor	ecx,ecx
1162
	sub	eax,[ebx+0Ch]
1181
	mov	[org_origin_sign],0
-
 
1182
	sub	eax,[ebx+0Ch]
1163
	sbb	ecx,0
1183
	sbb	ecx,0
1164
	mov	[labels_type],2
1184
	sbb	[org_origin_sign],0
-
 
1185
	mov	[labels_type],2
1165
	mov	[code_type],32
1186
	mov	[code_type],32
1166
	test	[format_flags],8
1187
	test	[format_flags],8
1167
	jz	pe_section_code_type_ok
1188
	jz	pe_section_code_type_ok
1168
	mov	[labels_type],4
1189
	mov	[labels_type],4
1169
	mov	[code_type],64
1190
	mov	[code_type],64
Line 1171... Line 1192...
1171
	test	[format_flags],4
1192
	test	[format_flags],4
1172
	jnz	peplus_section_org
1193
	jnz	peplus_section_org
1173
	sub	eax,[edx+34h]
1194
	sub	eax,[edx+34h]
1174
	sbb	ecx,0
1195
	sbb	ecx,0
1175
	bt	[resolver_flags],0
1196
	sbb	[org_origin_sign],0
-
 
1197
	bt	[resolver_flags],0
1176
	jc	pe_section_org_ok
1198
	jc	pe_section_org_ok
1177
	mov	[labels_type],0
1199
	mov	[labels_type],0
1178
	jmp	pe_section_org_ok
1200
	jmp	pe_section_org_ok
1179
      peplus_section_org:
1201
      peplus_section_org:
1180
	sub	eax,[edx+30h]
1202
	sub	eax,[edx+30h]
1181
	sbb	ecx,[edx+34h]
1203
	sbb	ecx,[edx+34h]
1182
	bt	[resolver_flags],0
1204
	sbb	[org_origin_sign],0
-
 
1205
	bt	[resolver_flags],0
1183
	jc	pe_section_org_ok
1206
	jc	pe_section_org_ok
1184
	mov	[labels_type],0
1207
	mov	[labels_type],0
1185
      pe_section_org_ok:
1208
      pe_section_org_ok:
1186
	mov	dword [org_origin],eax
1209
	mov	dword [org_origin],eax
1187
	mov	dword [org_origin+4],ecx
1210
	mov	dword [org_origin+4],ecx
1188
	mov	[org_registers],0
1211
	and	[org_registers],0
1189
	mov	[org_start],edi
1212
	mov	[org_start],edi
1190
      get_section_flags:
1213
      get_section_flags:
1191
	lods	byte [esi]
1214
	lods	byte [esi]
1192
	cmp	al,1Ah
1215
	cmp	al,1Ah
1193
	je	set_directory
1216
	je	set_directory
1194
	cmp	al,19h
1217
	cmp	al,19h
Line 1244... Line 1267...
1244
	cmp	dword [edx+38h],1000h
1267
	cmp	dword [edx+38h],1000h
1245
	jb	align_section
1268
	jb	align_section
1246
	mov	edi,[undefined_data_start]
1269
	mov	edi,[undefined_data_start]
1247
      align_section:
1270
      align_section:
1248
	mov	[undefined_data_end],0
1271
	and	[undefined_data_end],0
1249
	mov	ebp,edi
1272
	mov	ebp,edi
1250
	sub	ebp,[ebx+14h]
1273
	sub	ebp,[ebx+14h]
1251
	mov	ecx,[edx+3Ch]
1274
	mov	ecx,[edx+3Ch]
1252
	dec	ecx
1275
	dec	ecx
1253
	lea	eax,[ebp+ecx]
1276
	lea	eax,[ebp+ecx]
1254
	not	ecx
1277
	not	ecx
Line 1371... Line 1394...
1371
	xor	bl,bl
1394
	xor	bl,bl
1372
      check_pe_entry_label_type:
1395
      check_pe_entry_label_type:
1373
	cmp	[value_type],bl
1396
	cmp	[value_type],bl
1374
	je	pe_entry_ok
1397
	je	pe_entry_ok
1375
	cmp	[error_line],0
1398
	call	recoverable_invalid_address
1376
	jne	pe_entry_ok
-
 
1377
	mov	edx,[current_line]
-
 
1378
	mov	[error_line],edx
-
 
1379
	mov	[error],invalid_address
-
 
1380
      pe_entry_ok:
1399
      pe_entry_ok:
1381
      cdq
1400
      cdq
1382
	test	[format_flags],4
1401
	test	[format_flags],4
1383
	jnz	pe64_entry_type_ok
1402
	jnz	pe64_entry_type_ok
1384
	mov	edx,[code_start]
1403
	mov	edx,[code_start]
1385
	sub	eax,[edx+34h]
1404
	sub	eax,[edx+34h]
Line 1393... Line 1412...
1393
	xor	bl,bl
1412
	xor	bl,bl
1394
      check_pe64_entry_label_type:
1413
      check_pe64_entry_label_type:
1395
	cmp	[value_type],bl
1414
	cmp	[value_type],bl
1396
	je	pe64_entry_type_ok
1415
	je	pe64_entry_type_ok
1397
	cmp	[error_line],0
1416
	call	recoverable_invalid_address
1398
	jne	pe64_entry_type_ok
-
 
1399
	mov	edx,[current_line]
-
 
1400
	mov	[error_line],edx
-
 
1401
	mov	[error],invalid_address
-
 
1402
      pe64_entry_type_ok:
1417
      pe64_entry_type_ok:
1403
	mov	ecx,[code_start]
1418
	mov	ecx,[code_start]
1404
	sub	eax,[ecx+30h]
1419
	sub	eax,[ecx+30h]
1405
	sbb	edx,[ecx+34h]
1420
	sbb	edx,[ecx+34h]
1406
	jz	pe64_entry_range_ok
1421
	jz	pe64_entry_range_ok
1407
	mov	edx,[current_line]
1422
	call	recoverable_overflow
1408
	mov	[error_line],edx
-
 
1409
	mov	[error],value_out_of_range
-
 
1410
      pe64_entry_range_ok:
1423
      pe64_entry_range_ok:
1411
	mov	[ecx+28h],eax
1424
	mov	[ecx+28h],eax
1412
	jmp	instruction_assembled
1425
	jmp	instruction_assembled
1413
pe_stack:
1426
pe_stack:
1414
	lods	byte [esi]
1427
	lods	byte [esi]
1415
	cmp	al,'('
1428
	cmp	al,'('
Line 1538... Line 1551...
1538
	je	pe_relocation_type_ok
1551
	je	pe_relocation_type_ok
1539
      check_standard_pe_relocation_type:
1552
      check_standard_pe_relocation_type:
1540
	cmp	[value_type],2
1553
	cmp	[value_type],2
1541
	je	pe_relocation_type_ok
1554
	je	pe_relocation_type_ok
1542
	cmp	[error_line],0
1555
	call	recoverable_misuse
1543
	jne	pe_relocation_type_ok
1556
      pe_relocation_type_ok:
1544
	mov	eax,[current_line]
-
 
1545
	mov	[error_line],eax
-
 
1546
	mov	[error],invalid_use_of_symbol
-
 
1547
      pe_relocation_type_ok:
-
 
1548
	mov	ebx,[current_section]
1557
	mov	ebx,[current_section]
1549
	mov	eax,edi
1558
	mov	eax,edi
1550
	sub	eax,[ebx+14h]
1559
	sub	eax,[ebx+14h]
1551
	add	eax,[ebx+0Ch]
1560
	add	eax,[ebx+0Ch]
1552
	mov	ebx,[free_additional_memory]
1561
	mov	ebx,[free_additional_memory]
Line 1578... Line 1587...
1578
	bts	[resolver_flags],0
1587
	bts	[resolver_flags],0
1579
	jc	fixups_ready
1588
	jc	fixups_ready
1580
	or	[next_pass_needed],-1
1589
	or	[next_pass_needed],-1
1581
      fixups_ready:
1590
      fixups_ready:
1582
	mov	[last_fixup_base],0
1591
	and	[last_fixup_base],0
1583
	call	make_fixups
1592
	call	make_fixups
1584
	xchg	eax,[actual_fixups_size]
1593
	xchg	eax,[actual_fixups_size]
1585
	sub	eax,[actual_fixups_size]
1594
	sub	eax,[actual_fixups_size]
1586
	ja	reserve_forward_fixups
1595
	ja	reserve_forward_fixups
1587
	xor	eax,eax
1596
	xor	eax,eax
1588
      reserve_forward_fixups:
1597
      reserve_forward_fixups:
Line 1650... Line 1659...
1650
	cmp	[next_pass_needed],0
1659
	cmp	[next_pass_needed],0
1651
	je	resource_from_file
1660
	je	resource_from_file
1652
	cmp	[current_pass],0
1661
	cmp	[current_pass],0
1653
	jne	reserve_space_for_resource
1662
	jne	reserve_space_for_resource
1654
	mov	[resource_size],0
1663
	and	[resource_size],0
1655
      reserve_space_for_resource:
1664
      reserve_space_for_resource:
1656
	add	edi,[resource_size]
1665
	add	edi,[resource_size]
1657
	cmp	edi,[display_buffer]
1666
	cmp	edi,[display_buffer]
1658
	ja	out_of_memory
1667
	ja	out_of_memory
1659
	jmp	resource_done
1668
	jmp	resource_done
1660
      resource_from_file:
1669
      resource_from_file:
Line 2308... Line 2317...
2308
	mov	dword [ebx+14h],eax
2317
	mov	dword [ebx+14h],eax
2309
	mov	[current_section],ebx
2318
	mov	[current_section],ebx
2310
	xor	eax,eax
2319
	xor	eax,eax
2311
	mov	[number_of_sections],eax
2320
	mov	[number_of_sections],eax
2312
	mov	dword [org_origin],edi
2321
	call	setup_coff_section_org
-
 
2322
	mov	[code_type],32
-
 
2323
	test	[format_flags],8
-
 
2324
	jz	format_defined
-
 
2325
	mov	[code_type],64
-
 
2326
	jmp	format_defined
-
 
2327
      setup_coff_section_org:
-
 
2328
	xor	eax,eax
-
 
2329
	mov	dword [org_origin],edi
2313
	mov	dword [org_origin+4],eax
2330
	mov	dword [org_origin+4],eax
2314
	mov	[org_registers],eax
2331
	mov	[org_origin_sign],al
-
 
2332
	mov	[org_registers],eax
2315
	mov	[org_start],edi
2333
	mov	[org_start],edi
2316
	mov	[org_symbol],ebx
2334
	mov	[org_symbol],ebx
2317
	mov	[labels_type],2
2335
	test	[format_flags],8
2318
	mov	[code_type],32
-
 
2319
	test	[format_flags],8
-
 
2320
	jz	format_defined
2336
	jnz	coff_64bit_labels
2321
	mov	[labels_type],4
2337
	mov	[labels_type],2
-
 
2338
	ret
-
 
2339
      coff_64bit_labels:
-
 
2340
	mov	[labels_type],4
2322
	mov	[code_type],64
2341
	ret
2323
	jmp	format_defined
-
 
2324
coff_section:
2342
 
-
 
2343
coff_section:
2325
	call	close_coff_section
2344
	call	close_coff_section
2326
	mov	ebx,[free_additional_memory]
2345
	mov	ebx,[free_additional_memory]
2327
	lea	eax,[ebx+20h]
2346
	lea	eax,[ebx+20h]
2328
	cmp	eax,[structures_buffer]
2347
	cmp	eax,[structures_buffer]
2329
	jae	out_of_memory
2348
	jae	out_of_memory
Line 2332... Line 2351...
2332
	inc	[number_of_sections]
2351
	inc	[number_of_sections]
2333
	xor	eax,eax
2352
	xor	eax,eax
2334
	mov	[ebx],al
2353
	mov	[ebx],al
2335
	mov	[ebx+8],edi
2354
	mov	[ebx+8],edi
2336
	mov	dword [org_origin],edi
2355
	mov	[ebx+10h],eax
2337
	mov	dword [org_origin+4],eax
-
 
2338
	mov	[org_registers],eax
-
 
2339
	mov	[org_start],edi
-
 
2340
	mov	[org_symbol],ebx
-
 
2341
	mov	[labels_type],2
-
 
2342
	test	[format_flags],8
-
 
2343
	jz	coff_labels_type_ok
-
 
2344
	mov	[labels_type],4
-
 
2345
      coff_labels_type_ok:
-
 
2346
	mov	[ebx+10h],eax
-
 
2347
	mov	[ebx+14h],eax
2356
	mov	[ebx+14h],eax
2348
	lods	word [esi]
2357
	call	setup_coff_section_org
-
 
2358
	lods	word [esi]
2349
	cmp	ax,'('
2359
	cmp	ax,'('
2350
	jne	invalid_argument
2360
	jne	invalid_argument
2351
	mov	[ebx+4],esi
2361
	mov	[ebx+4],esi
2352
	mov	ecx,[esi]
2362
	mov	ecx,[esi]
2353
	lea	esi,[esi+4+ecx+1]
2363
	lea	esi,[esi+4+ecx+1]
Line 2550... Line 2560...
2550
	mov	[esi],edx
2560
	mov	[esi],edx
2551
	mov	edx,[esi+8]
2561
	mov	edx,[esi+8]
2552
	add	esi,10h
2562
	add	esi,10h
2553
	inc	eax
2563
	inc	eax
2554
	cmp	byte [edx+11],2
2564
	cmp	byte [edx+11],0
2555
	jne	enumerate_symbols
2565
	je	enumerate_symbols
2556
	mov	edx,[edx+20]
2566
	mov	edx,[edx+20]
2557
	cmp	byte [edx],0C0h
2567
	cmp	byte [edx],0C0h
2558
	jae	enumerate_symbols
2568
	jae	enumerate_symbols
2559
	cmp	byte [edx],80h
2569
	cmp	byte [edx],80h
2560
	jb	enumerate_symbols
2570
	jb	enumerate_symbols
2561
	inc	eax
2571
	inc	eax
Line 2801... Line 2811...
2801
	jne	invalid_use_of_symbol
2811
	jne	invalid_use_of_symbol
2802
	mov	cx,[ecx+1Eh]
2812
	mov	cx,[ecx+1Eh]
2803
	mov	[ebx+0Ch],cx
2813
	mov	[ebx+0Ch],cx
2804
      public_symbol_section_ok:
2814
      public_symbol_section_ok:
2805
	cmp	dword [eax+4],0
2815
	movzx	ecx,byte [eax+9]
2806
	je	store_public_symbol
2816
	shr	cl,1
2807
	cmp	dword [eax+4],-1
2817
	and	cl,1
-
 
2818
	neg	ecx
-
 
2819
	cmp	ecx,[eax+4]
2808
	jne	value_out_of_range
2820
	jne	value_out_of_range
2809
	bt	dword [eax],31
2821
	xor	ecx,[eax]
2810
	jnc	value_out_of_range
2822
	js	value_out_of_range
2811
      store_public_symbol:
2823
	mov	eax,[eax]
2812
	mov	eax,[eax]
-
 
2813
	mov	[ebx+8],eax
2824
	mov	[ebx+8],eax
2814
	mov	al,2
2825
	mov	al,2
2815
	cmp	byte [esi],0C0h
2826
	cmp	byte [esi],0C0h
2816
	je	store_symbol_class
2827
	je	store_symbol_class
2817
	inc	al
2828
	inc	al
Line 2848... Line 2859...
2848
	sub	eax,edx
2859
	sub	eax,edx
2849
	mov	[edx],eax
2860
	mov	[edx],eax
2850
	sub	edi,[code_start]
2861
	sub	edi,[code_start]
2851
	mov	[code_size],edi
2862
	mov	[code_size],edi
2852
	mov	[written_size],0
2863
	and	[written_size],0
2853
	mov	edx,[output_file]
2864
	mov	edx,[output_file]
2854
	call	create
2865
	call	create
2855
	jc	write_failed
2866
	jc	write_failed
2856
	mov	edx,[free_additional_memory]
2867
	mov	edx,[free_additional_memory]
2857
	pop	ecx
2868
	pop	ecx
2858
	add	[written_size],ecx
2869
	add	[written_size],ecx
Line 2908... Line 2919...
2908
	mov	byte [edx+2Eh],28h
2919
	mov	byte [edx+2Eh],28h
2909
	mov	[code_type],32
2920
	mov	[code_type],32
2910
	cmp	word [esi],1D19h
2921
	cmp	word [esi],1D19h
2911
	je	format_elf_exe
2922
	je	format_elf_exe
2912
	mov	[labels_type],2
2923
      elf_header_ok:
2913
      elf_header_ok:
-
 
2914
	mov	byte [edx+10h],1
2924
	mov	byte [edx+10h],1
2915
	mov	eax,[additional_memory]
2925
	mov	eax,[additional_memory]
2916
	mov	[symbols_stream],eax
2926
	mov	[symbols_stream],eax
2917
	mov	ebx,eax
2927
	mov	ebx,eax
2918
	add	eax,20h
2928
	add	eax,20h
Line 2921... Line 2931...
2921
	mov	[free_additional_memory],eax
2931
	mov	[free_additional_memory],eax
2922
	xor	eax,eax
2932
	xor	eax,eax
2923
	mov	[current_section],ebx
2933
	mov	[current_section],ebx
2924
	mov	[number_of_sections],eax
2934
	mov	[number_of_sections],eax
2925
	mov	dword [org_origin],edi
2935
	mov	[ebx],al
2926
	mov	dword [org_origin+4],eax
-
 
2927
	mov	[org_registers],eax
-
 
2928
	mov	[org_start],edi
-
 
2929
	mov	[org_symbol],ebx
-
 
2930
	mov	[ebx],al
-
 
2931
	mov	[ebx+4],eax
2936
	mov	[ebx+4],eax
2932
	mov	[ebx+8],edi
2937
	mov	[ebx+8],edi
2933
	mov	al,111b
2938
	mov	al,111b
2934
	mov	[ebx+14h],eax
2939
	mov	[ebx+14h],eax
2935
	mov	al,4
2940
	mov	al,4
2936
	mov	[ebx+10h],eax
2941
	mov	[ebx+10h],eax
2937
	test	[format_flags],8
2942
	call	setup_coff_section_org
-
 
2943
	test	[format_flags],8
2938
	jz	format_defined
2944
	jz	format_defined
2939
	mov	byte [ebx+10h],8
2945
	mov	byte [ebx+10h],8
2940
	jmp	format_defined
2946
	jmp	format_defined
2941
      format_elf64:
2947
      format_elf64:
2942
	mov	edx,edi
2948
	mov	edx,edi
Line 2956... Line 2962...
2956
	mov	byte [edx+34h],40h
2962
	mov	byte [edx+34h],40h
2957
	mov	byte [edx+3Ah],40h
2963
	mov	byte [edx+3Ah],40h
2958
	mov	[code_type],64
2964
	mov	[code_type],64
2959
	cmp	word [esi],1D19h
2965
	cmp	word [esi],1D19h
2960
	je	format_elf64_exe
2966
	jne	elf_header_ok
2961
	mov	[labels_type],4
2967
	jmp	format_elf64_exe
2962
	jmp	elf_header_ok
-
 
2963
elf_section:
2968
elf_section:
2964
	bt	[format_flags],0
2969
	bt	[format_flags],0
2965
	jc	illegal_instruction
2970
	jc	illegal_instruction
2966
	call	close_coff_section
2971
	call	close_coff_section
2967
	mov	ebx,[free_additional_memory]
2972
	mov	ebx,[free_additional_memory]
2968
	lea	eax,[ebx+20h]
2973
	lea	eax,[ebx+20h]
Line 2974... Line 2979...
2974
	jz	format_limitations_exceeded
2979
	jz	format_limitations_exceeded
2975
	xor	eax,eax
2980
	xor	eax,eax
2976
	mov	[ebx],al
2981
	mov	[ebx],al
2977
	mov	[ebx+8],edi
2982
	mov	[ebx+8],edi
2978
	mov	dword [org_origin],edi
2983
	mov	[ebx+10h],eax
2979
	mov	dword [org_origin+4],eax
-
 
2980
	mov	[org_registers],eax
-
 
2981
	mov	[org_start],edi
-
 
2982
	mov	[org_symbol],ebx
-
 
2983
	test	[format_flags],8
-
 
2984
	jnz	elf64_labels_type
-
 
2985
	mov	[labels_type],2
-
 
2986
	jmp	elf_labels_type_ok
-
 
2987
      elf64_labels_type:
-
 
2988
	mov	[labels_type],4
-
 
2989
      elf_labels_type_ok:
-
 
2990
	mov	[ebx+10h],eax
-
 
2991
	mov	al,10b
2984
	mov	al,10b
2992
	mov	[ebx+14h],eax
2985
	mov	[ebx+14h],eax
2993
	lods	word [esi]
2986
	call	setup_coff_section_org
-
 
2987
	lods	word [esi]
2994
	cmp	ax,'('
2988
	cmp	ax,'('
2995
	jne	invalid_argument
2989
	jne	invalid_argument
2996
	mov	[ebx+4],esi
2990
	mov	[ebx+4],esi
2997
	mov	ecx,[esi]
2991
	mov	ecx,[esi]
2998
	lea	esi,[esi+4+ecx+1]
2992
	lea	esi,[esi+4+ecx+1]
Line 3216... Line 3210...
3216
	jne	invalid_use_of_symbol
3210
	jne	invalid_use_of_symbol
3217
	mov	dx,[eax+0Eh]
3211
	mov	dx,[eax+0Eh]
3218
	jmp	section_for_public_ok
3212
	jmp	section_for_public_ok
3219
      undefined_public:
3213
      undefined_public:
3220
	mov	eax,[ebx+24]
3214
	mov	[error_info],ebx
3221
	mov	[error_info],eax
-
 
3222
	jmp	undefined_symbol
3215
	jmp	undefined_symbol
3223
      elf64_public:
3216
      elf64_public:
3224
	cmp	dl,4
3217
	cmp	dl,4
3225
	jne	invalid_use_of_symbol
3218
	jne	invalid_use_of_symbol
3226
	mov	dx,[eax+6]
3219
	mov	dx,[eax+6]
3227
	jmp	section_for_public_ok
3220
	jmp	section_for_public_ok
Line 3231... Line 3224...
3231
	mov	eax,[esi+4]
3224
	mov	eax,[esi+4]
3232
	stos	dword [edi]
3225
	stos	dword [edi]
3233
	test	[format_flags],8
3226
	test	[format_flags],8
3234
	jnz	elf64_public_symbol
3227
	jnz	elf64_public_symbol
3235
	call	get_public_value
3228
	movzx	eax,byte [ebx+9]
-
 
3229
	shr	al,1
-
 
3230
	and	al,1
-
 
3231
	neg	eax
-
 
3232
	cmp	eax,[ebx+4]
-
 
3233
	jne	value_out_of_range
-
 
3234
	xor	eax,[ebx]
-
 
3235
	js	value_out_of_range
3236
	stos	dword [edi]
3236
	mov	eax,[ebx]
-
 
3237
	stos	dword [edi]
3237
	xor	eax,eax
3238
	xor	eax,eax
3238
	mov	al,[ebx+10]
3239
	mov	al,[ebx+10]
3239
	stos	dword [edi]
3240
	stos	dword [edi]
3240
	mov	eax,edx
3241
	mov	eax,edx
3241
	shl	eax,16
3242
	shl	eax,16
Line 3260... Line 3261...
3260
      elf64_public_function:
3261
      elf64_public_function:
3261
	or	al,2
3262
	or	al,2
3262
      store_elf64_public_info:
3263
      store_elf64_public_info:
3263
	stos	dword [edi]
3264
	stos	dword [edi]
3264
	call	get_public_value
3265
	mov	al,[ebx+9]
-
 
3266
	shl	eax,31-1
-
 
3267
	xor	eax,[ebx+4]
-
 
3268
	js	value_out_of_range
3265
	stos	dword [edi]
3269
	mov	eax,[ebx]
-
 
3270
	stos	dword [edi]
3266
	xor	eax,eax
3271
	mov	eax,[ebx+4]
3267
	stos	dword [edi]
3272
	stos	dword [edi]
3268
	mov	al,[ebx+10]
3273
	mov	al,[ebx+10]
3269
	stos	dword [edi]
3274
	stos	dword [edi]
3270
	xor	al,al
3275
	xor	al,al
3271
	stos	dword [edi]
3276
	stos	dword [edi]
3272
      public_symbol_ok:
3277
      public_symbol_ok:
Line 3276... Line 3281...
3276
	mov	al,0C0h
3281
	mov	al,0C0h
3277
	mov	[esi],eax
3282
	mov	[esi],eax
3278
	add	esi,10h
3283
	add	esi,10h
3279
	jmp	find_other_symbols
3284
	jmp	find_other_symbols
3280
      get_public_value:
3285
      make_extrn_symbol:
3281
	mov	eax,[ebx]
-
 
3282
	cmp	dword [ebx+4],0
-
 
3283
	je	public_value_ok
-
 
3284
	cmp	dword [ebx+4],-1
-
 
3285
	jne	value_out_of_range
-
 
3286
	bt	eax,31
-
 
3287
	jnc	value_out_of_range
-
 
3288
      public_value_ok:
-
 
3289
	ret
-
 
3290
      make_extrn_symbol:
-
 
3291
	mov	eax,[esi+4]
3286
	mov	eax,[esi+4]
3292
	stos	dword [edi]
3287
	stos	dword [edi]
3293
	test	[format_flags],8
3288
	test	[format_flags],8
3294
	jnz	elf64_extrn_symbol
3289
	jnz	elf64_extrn_symbol
3295
	xor	eax,eax
3290
	xor	eax,eax
Line 3486... Line 3481...
3486
      store_elf_machine_word:
3481
      store_elf_machine_word:
3487
	stos	dword [edi]
3482
	stos	dword [edi]
3488
	test	[format_flags],8
3483
	test	[format_flags],8
3489
	jz	elf_machine_word_ok
3484
	jz	elf_machine_word_ok
3490
	mov	dword [edi],0
3485
	and	dword [edi],0
3491
	add	edi,4
3486
	add	edi,4
3492
      elf_machine_word_ok:
3487
      elf_machine_word_ok:
3493
	ret
3488
	ret
3494
      relocations_converted:
3489
      relocations_converted:
3495
	cmp	edi,ebp
3490
	cmp	edi,ebp
3496
	xchg	edi,[esp]
3491
	xchg	edi,[esp]
Line 3667... Line 3662...
3667
	imul	ecx,[number_of_sections]
3662
	imul	ecx,[number_of_sections]
3668
      init_elf_segments:
3663
      init_elf_segments:
3669
	xor	eax,eax
3664
	xor	eax,eax
3670
	rep	stos dword [edi]
3665
	rep	stos dword [edi]
3671
	mov	[number_of_sections],0
3666
	and	[number_of_sections],0
3672
	mov	byte [ebx],1
3667
	mov	byte [ebx],1
3673
	mov	word [ebx+1Ch],1000h
3668
	mov	word [ebx+1Ch],1000h
3674
	mov	byte [ebx+18h],111b
3669
	mov	byte [ebx+18h],111b
3675
	mov	eax,edi
3670
	mov	eax,edi
3676
	sub	eax,[code_start]
3671
	xor	ebp,ebp
-
 
3672
	xor	cl,cl
-
 
3673
	sub	eax,[code_start]
3677
	mov	[ebx+4],eax
3674
	sbb	ebp,0
-
 
3675
	sbb	cl,0
-
 
3676
	mov	[ebx+4],eax
3678
	add	eax,[image_base]
3677
	add	eax,[image_base]
3679
	mov	[ebx+8],eax
3678
	adc	ebp,0
-
 
3679
	adc	cl,0
-
 
3680
	mov	[ebx+8],eax
3680
	mov	[ebx+0Ch],eax
3681
	mov	[ebx+0Ch],eax
3681
	mov	[edx+18h],eax
3682
	mov	[edx+18h],eax
3682
	xor	edx,edx
3683
	not	eax
3683
	not	eax
-
 
3684
	not	edx
3684
	not	ebp
3685
	add	eax,1
3685
	not	cl
-
 
3686
	add	eax,1
3686
	adc	edx,0
3687
	adc	ebp,0
3687
	add	eax,edi
3688
	adc	cl,0
-
 
3689
	add	eax,edi
3688
	adc	edx,0
3690
	adc	ebp,0
3689
	mov	dword [org_origin],eax
3691
	adc	cl,0
-
 
3692
	mov	dword [org_origin],eax
3690
	mov	dword [org_origin+4],edx
3693
	mov	dword [org_origin+4],edx
3691
	mov	[org_registers],0
3694
	mov	[org_origin_sign],cl
-
 
3695
	and	[org_registers],0
3692
	mov	[org_start],edi
3696
	mov	[org_start],edi
3693
	mov	[symbols_stream],edi
3697
	mov	[symbols_stream],edi
3694
	jmp	format_defined
3698
	jmp	format_defined
3695
      format_elf64_exe:
3699
      format_elf64_exe:
3696
	add	esi,2
3700
	add	esi,2
3697
	or	[format_flags],1
3701
	or	[format_flags],1
Line 3707... Line 3711...
3707
	pop	edx
3711
	pop	edx
3708
	mov	[edx+7],al
3712
	mov	[edx+7],al
3709
      elf64_exe_brand_ok:
3713
      elf64_exe_brand_ok:
3710
	mov	[image_base],400000h
3714
	mov	[image_base],400000h
3711
	mov	[image_base_high],0
3715
	and	[image_base_high],0
3712
	cmp	byte [esi],80h
3716
	cmp	byte [esi],80h
3713
	jne	elf64_exe_base_ok
3717
	jne	elf64_exe_base_ok
3714
	lods	word [esi]
3718
	lods	word [esi]
3715
	cmp	ah,'('
3719
	cmp	ah,'('
3716
	jne	invalid_argument
3720
	jne	invalid_argument
3717
	cmp	byte [esi],'.'
3721
	cmp	byte [esi],'.'
Line 3733... Line 3737...
3733
	imul	ecx,[number_of_sections]
3737
	imul	ecx,[number_of_sections]
3734
      init_elf64_segments:
3738
      init_elf64_segments:
3735
	xor	eax,eax
3739
	xor	eax,eax
3736
	rep	stos dword [edi]
3740
	rep	stos dword [edi]
3737
	mov	[number_of_sections],0
3741
	and	[number_of_sections],0
3738
	mov	byte [ebx],1
3742
	mov	byte [ebx],1
3739
	mov	word [ebx+30h],1000h
3743
	mov	word [ebx+30h],1000h
3740
	mov	byte [ebx+4],111b
3744
	mov	byte [ebx+4],111b
3741
	push	edx
3745
	push	edx
3742
	mov	eax,edi
3746
	mov	eax,edi
3743
	sub	eax,[code_start]
3747
	sub	eax,[code_start]
3744
	mov	[ebx+8],eax
3748
	mov	[ebx+8],eax
3745
	xor	edx,edx
3749
	xor	edx,edx
3746
	add	eax,[image_base]
3750
	xor	cl,cl
-
 
3751
	add	eax,[image_base]
3747
	adc	edx,[image_base_high]
3752
	adc	edx,[image_base_high]
3748
	mov	[ebx+10h],eax
3753
	adc	cl,0
-
 
3754
	mov	[ebx+10h],eax
3749
	mov	[ebx+10h+4],edx
3755
	mov	[ebx+10h+4],edx
3750
	mov	[ebx+18h],eax
3756
	mov	[ebx+18h],eax
3751
	mov	[ebx+18h+4],edx
3757
	mov	[ebx+18h+4],edx
3752
	pop	ebx
3758
	pop	ebx
3753
	mov	[ebx+18h],eax
3759
	mov	[ebx+18h],eax
3754
	mov	[ebx+18h+4],edx
3760
	mov	[ebx+18h+4],edx
3755
	not	eax
3761
	not	eax
3756
	not	edx
3762
	not	edx
3757
	add	eax,1
3763
	not	cl
-
 
3764
	add	eax,1
3758
	adc	edx,0
3765
	adc	edx,0
3759
	add	eax,edi
3766
	adc	cl,0
-
 
3767
	add	eax,edi
3760
	adc	edx,0
3768
	adc	edx,0
3761
	mov	dword [org_origin],eax
3769
	adc	cl,0
-
 
3770
	mov	dword [org_origin],eax
3762
	mov	dword [org_origin+4],edx
3771
	mov	dword [org_origin+4],edx
3763
	mov	[org_registers],0
3772
	mov	[org_origin_sign],cl
-
 
3773
	and	[org_registers],0
3764
	mov	[org_start],edi
3774
	mov	[org_start],edi
3765
	mov	[symbols_stream],edi
3775
	mov	[symbols_stream],edi
3766
	jmp	format_defined
3776
	jmp	format_defined
3767
elf_entry:
3777
elf_entry:
3768
	lods	byte [esi]
3778
	lods	byte [esi]
3769
	cmp	al,'('
3779
	cmp	al,'('
Line 3861... Line 3871...
3861
	mov	[ebx+8],edx
3871
	mov	[ebx+8],edx
3862
	mov	[ebx+0Ch],edx
3872
	mov	[ebx+0Ch],edx
3863
	mov	eax,edx
3873
	mov	eax,edx
3864
	xor	edx,edx
3874
	xor	edx,edx
3865
	not	eax
3875
	xor	cl,cl
-
 
3876
	not	eax
3866
	not	edx
3877
	not	edx
3867
	add	eax,1
3878
	not	cl
-
 
3879
	add	eax,1
3868
	adc	edx,0
3880
	adc	edx,0
3869
	add	eax,edi
3881
	adc	cl,0
-
 
3882
	add	eax,edi
3870
	adc	edx,0
3883
	adc	edx,0
3871
	mov	dword [org_origin],eax
3884
	adc	cl,0
-
 
3885
	mov	dword [org_origin],eax
3872
	mov	dword [org_origin+4],edx
3886
	mov	dword [org_origin+4],edx
3873
	mov	[org_registers],0
3887
	mov	[org_origin_sign],cl
-
 
3888
	and	[org_registers],0
3874
	mov	[org_start],edi
3889
	mov	[org_start],edi
3875
	inc	[number_of_sections]
3890
	inc	[number_of_sections]
3876
	jmp	instruction_assembled
3891
	jmp	instruction_assembled
3877
      close_elf_segment:
3892
      close_elf_segment:
3878
	cmp	[number_of_sections],0
3893
	cmp	[number_of_sections],0
3879
	jne	finish_elf_segment
3894
	jne	finish_elf_segment
Line 3988... Line 4003...
3988
	mov	[ebx+10h],eax
4003
	mov	[ebx+10h],eax
3989
	mov	[ebx+10h+4],edx
4004
	mov	[ebx+10h+4],edx
3990
	mov	[ebx+18h],eax
4005
	mov	[ebx+18h],eax
3991
	mov	[ebx+18h+4],edx
4006
	mov	[ebx+18h+4],edx
3992
	not	eax
4007
	xor	cl,cl
-
 
4008
	not	eax
3993
	not	edx
4009
	not	edx
3994
	add	eax,1
4010
	not	cl
-
 
4011
	add	eax,1
3995
	adc	edx,0
4012
	adc	edx,0
3996
	add	eax,edi
4013
	adc	cl,0
-
 
4014
	add	eax,edi
3997
	adc	edx,0
4015
	adc	edx,0
3998
	mov	dword [org_origin],eax
4016
	adc	cl,0
-
 
4017
	mov	dword [org_origin],eax
3999
	mov	dword [org_origin+4],edx
4018
	mov	dword [org_origin+4],edx
4000
	mov	[org_registers],0
4019
	mov	[org_origin_sign],cl
-
 
4020
	and	[org_registers],0
4001
	mov	[org_start],edi
4021
	mov	[org_start],edi
4002
	inc	[number_of_sections]
4022
	inc	[number_of_sections]
4003
	jmp	instruction_assembled
4023
	jmp	instruction_assembled
4004
      close_elf64_segment:
4024
      close_elf64_segment:
4005
	cmp	[number_of_sections],0
4025
	cmp	[number_of_sections],0
4006
	jne	finish_elf64_segment
4026
	jne	finish_elf64_segment