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,6 +867,15 @@ payload_death_message:
867 867
 	movw	%ax, (init_librm_vector+2)
868 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 879
 	/* Inhibit INT 15,e820 and INT 15,e801 if applicable */
871 880
 	testl	%ebp, %ebp
872 881
 	jnz	1f
@@ -878,10 +887,15 @@ payload_death_message:
878 887
 	 * ready for the copy to the new location.
879 888
 	 */
880 889
 	progress "  relocate\n"
881
-	movw	%ax, (prot_call_vector+2)
882 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 899
 	/* Copy code to new location */
886 900
 	progress "  copy\n"
887 901
 	pushl	%edi
@@ -929,10 +943,6 @@ init_librm_vector:
929 943
 	.word init_librm
930 944
 	.word 0
931 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 946
 #endif
937 947
 close_payload_vector:
938 948
 	.word close_payload

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

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

Loading…
Cancel
Save