Browse Source

[prefix] Standardise calls to prot_call()

Use the standard "pushl $function ; pushw %cs ; call prot_call"
sequence everywhere that prot_call() is used.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
df2509db95
2 changed files with 28 additions and 11 deletions
  1. 16
    6
      src/arch/x86/prefix/libprefix.S
  2. 12
    5
      src/arch/x86/prefix/undiloader.S

+ 16
- 6
src/arch/x86/prefix/libprefix.S View File

867
 	movw	%ax, (init_librm_vector+2)
867
 	movw	%ax, (init_librm_vector+2)
868
 	lcall	*init_librm_vector
868
 	lcall	*init_librm_vector
869
 
869
 
870
+	/* Prepare for return to .prefix segment */
871
+	pushw	%cs
872
+
873
+	/* Jump to .text16 segment */
874
+	pushw	%ax
875
+	pushw	$1f
876
+	lret
877
+	.section ".text16.install_prealloc", "ax", @progbits
878
+1:
870
 	/* Inhibit INT 15,e820 and INT 15,e801 if applicable */
879
 	/* Inhibit INT 15,e820 and INT 15,e801 if applicable */
871
 	testl	%ebp, %ebp
880
 	testl	%ebp, %ebp
872
 	jnz	1f
881
 	jnz	1f
878
 	 * ready for the copy to the new location.
887
 	 * ready for the copy to the new location.
879
 	 */
888
 	 */
880
 	progress "  relocate\n"
889
 	progress "  relocate\n"
881
-	movw	%ax, (prot_call_vector+2)
882
 	pushl	$relocate
890
 	pushl	$relocate
883
-	lcall	*prot_call_vector
891
+	pushw	%cs
892
+	call	prot_call
884
 
893
 
894
+	/* Jump back to .prefix segment */
895
+	pushw	$1f
896
+	lret
897
+	.section ".prefix.install_prealloc", "awx", @progbits
898
+1:
885
 	/* Copy code to new location */
899
 	/* Copy code to new location */
886
 	progress "  copy\n"
900
 	progress "  copy\n"
887
 	pushl	%edi
901
 	pushl	%edi
929
 	.word init_librm
943
 	.word init_librm
930
 	.word 0
944
 	.word 0
931
 	.size init_librm_vector, . - init_librm_vector
945
 	.size init_librm_vector, . - init_librm_vector
932
-prot_call_vector:
933
-	.word prot_call
934
-	.word 0
935
-	.size prot_call_vector, . - prot_call_vector
936
 #endif
946
 #endif
937
 close_payload_vector:
947
 close_payload_vector:
938
 	.word close_payload
948
 	.word close_payload

+ 12
- 5
src/arch/x86/prefix/undiloader.S View File

18
 	pushw	%ds
18
 	pushw	%ds
19
 	pushw	%es
19
 	pushw	%es
20
 	pushw	%bx
20
 	pushw	%bx
21
+
21
 	/* ROM segment address to %ds */
22
 	/* ROM segment address to %ds */
22
 	pushw	%cs
23
 	pushw	%cs
23
 	popw	%ds
24
 	popw	%ds
25
+
24
 	/* UNDI loader parameter structure address into %es:%di */
26
 	/* UNDI loader parameter structure address into %es:%di */
25
 	movw	%sp, %bx
27
 	movw	%sp, %bx
26
 	movw	%ss:22(%bx), %di
28
 	movw	%ss:22(%bx), %di
27
 	movw	%ss:24(%bx), %es
29
 	movw	%ss:24(%bx), %es
30
+
28
 	/* Install to specified real-mode addresses */
31
 	/* Install to specified real-mode addresses */
29
 	pushw	%di
32
 	pushw	%di
30
 	movw	%es:12(%di), %bx
33
 	movw	%es:12(%di), %bx
34
 	orl	$0xffffffff, %ebp	/* Allow arbitrary relocation */
37
 	orl	$0xffffffff, %ebp	/* Allow arbitrary relocation */
35
 	call	install_prealloc
38
 	call	install_prealloc
36
 	popw	%di
39
 	popw	%di
40
+
41
+	/* Jump to .text16 segment */
42
+	pushw	%ax
43
+	pushw	$1f
44
+	lret
45
+	.section ".text16", "ax", @progbits
46
+1:
37
 	/* Call UNDI loader C code */
47
 	/* Call UNDI loader C code */
38
 	pushl	$pxe_loader_call
48
 	pushl	$pxe_loader_call
39
 	pushw	%cs
49
 	pushw	%cs
40
-	pushw	$1f
41
-	pushw	%ax
42
-	pushw	$prot_call
43
-	lret
50
+	call	prot_call
51
+
44
 1:	/* Restore registers and return */
52
 1:	/* Restore registers and return */
45
 	popw	%bx
53
 	popw	%bx
46
 	popw	%es
54
 	popw	%es
49
 	popl	%edi
57
 	popl	%edi
50
 	popl	%esi
58
 	popl	%esi
51
 	lret
59
 	lret
52
-	.size undiloader, . - undiloader

Loading…
Cancel
Save