Browse Source

[librm] Rename prot_call() to virt_call()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
e2cf3138f0

+ 2
- 2
src/arch/x86/include/librm.h View File

58
  */
58
  */
59
 .macro virtcall function
59
 .macro virtcall function
60
 	pushl	$VIRTUAL(\function)
60
 	pushl	$VIRTUAL(\function)
61
-	call	prot_call
61
+	call	virt_call
62
 .endm
62
 .endm
63
 
63
 
64
 #else /* ASSEMBLY */
64
 #else /* ASSEMBLY */
76
  */
76
  */
77
 #define VIRT_CALL( function )						\
77
 #define VIRT_CALL( function )						\
78
 	"pushl $( " _S2 ( VIRTUAL ( function ) ) " )\n\t"		\
78
 	"pushl $( " _S2 ( VIRTUAL ( function ) ) " )\n\t"		\
79
-	"call prot_call\n\t"
79
+	"call virt_call\n\t"
80
 
80
 
81
 /* Variables in librm.S */
81
 /* Variables in librm.S */
82
 extern const unsigned long virt_offset;
82
 extern const unsigned long virt_offset;

+ 1
- 1
src/arch/x86/include/registers.h View File

167
  *
167
  *
168
  * @endcode
168
  * @endcode
169
  *
169
  *
170
- * prot_call() and kir_call() create this data structure on the stack
170
+ * virt_call() and kir_call() create this data structure on the stack
171
  * and pass in a pointer to this structure.
171
  * and pass in a pointer to this structure.
172
  *
172
  *
173
  */
173
  */

+ 31
- 31
src/arch/x86/transitions/librm.S View File

640
 	.equ	_intr_to_virt, intr_to_prot
640
 	.equ	_intr_to_virt, intr_to_prot
641
 
641
 
642
 /****************************************************************************
642
 /****************************************************************************
643
- * prot_call (real-mode near call, 16-bit real-mode near return address)
643
+ * virt_call (real-mode near call, 16-bit real-mode near return address)
644
  *
644
  *
645
  * Call a specific C function in the protected-mode code.  The
645
  * Call a specific C function in the protected-mode code.  The
646
  * prototype of the C function must be
646
  * prototype of the C function must be
647
  *   void function ( struct i386_all_regs *ix86 ); 
647
  *   void function ( struct i386_all_regs *ix86 ); 
648
  * ix86 will point to a struct containing the real-mode registers
648
  * ix86 will point to a struct containing the real-mode registers
649
- * at entry to prot_call.  
649
+ * at entry to virt_call().
650
  *
650
  *
651
- * All registers will be preserved across prot_call(), unless the C
651
+ * All registers will be preserved across virt_call(), unless the C
652
  * function explicitly overwrites values in ix86.  Interrupt status
652
  * function explicitly overwrites values in ix86.  Interrupt status
653
  * and GDT will also be preserved.  Gate A20 will be enabled.
653
  * and GDT will also be preserved.  Gate A20 will be enabled.
654
  *
654
  *
655
- * Note that prot_call() does not rely on the real-mode stack
655
+ * Note that virt_call() does not rely on the real-mode stack
656
  * remaining intact in order to return, since everything relevant is
656
  * remaining intact in order to return, since everything relevant is
657
  * copied to the protected-mode stack for the duration of the call.
657
  * copied to the protected-mode stack for the duration of the call.
658
  * In particular, this means that a real-mode prefix can make a call
658
  * In particular, this means that a real-mode prefix can make a call
666
  *
666
  *
667
  * Example usage:
667
  * Example usage:
668
  *	pushl	$pxe_api_call
668
  *	pushl	$pxe_api_call
669
- *	call	prot_call
669
+ *	call	virt_call
670
  * to call in to the C function
670
  * to call in to the C function
671
  *      void pxe_api_call ( struct i386_all_regs *ix86 );
671
  *      void pxe_api_call ( struct i386_all_regs *ix86 );
672
  ****************************************************************************
672
  ****************************************************************************
673
  */
673
  */
674
 	.struct	0
674
 	.struct	0
675
-PC_OFFSET_GDT:		.space	6
676
-PC_OFFSET_IDT:		.space	6
677
-PC_OFFSET_IX86:		.space	SIZEOF_I386_ALL_REGS
678
-PC_OFFSET_PADDING:	.space	2 /* for alignment */
679
-PC_OFFSET_RETADDR:	.space	2
680
-PC_OFFSET_PARAMS:
681
-PC_OFFSET_FUNCTION:	.space	4
682
-PC_OFFSET_END:
675
+VC_OFFSET_GDT:		.space	6
676
+VC_OFFSET_IDT:		.space	6
677
+VC_OFFSET_IX86:		.space	SIZEOF_I386_ALL_REGS
678
+VC_OFFSET_PADDING:	.space	2 /* for alignment */
679
+VC_OFFSET_RETADDR:	.space	2
680
+VC_OFFSET_PARAMS:
681
+VC_OFFSET_FUNCTION:	.space	4
682
+VC_OFFSET_END:
683
 	.previous
683
 	.previous
684
 
684
 
685
-	.section ".text16.prot_call", "ax", @progbits
685
+	.section ".text16.virt_call", "ax", @progbits
686
 	.code16
686
 	.code16
687
-	.globl prot_call
688
-prot_call:
687
+	.globl virt_call
688
+virt_call:
689
 	/* Preserve registers, flags and GDT on external RM stack */
689
 	/* Preserve registers, flags and GDT on external RM stack */
690
 	pushfw	/* padding */
690
 	pushfw	/* padding */
691
 	pushfl
691
 	pushfl
696
 	pushw	%ds
696
 	pushw	%ds
697
 	pushw	%ss
697
 	pushw	%ss
698
 	pushw	%cs
698
 	pushw	%cs
699
-	subw	$PC_OFFSET_IX86, %sp
699
+	subw	$VC_OFFSET_IX86, %sp
700
 	movw	%sp, %bp
700
 	movw	%sp, %bp
701
-	sidt	PC_OFFSET_IDT(%bp)
702
-	sgdt	PC_OFFSET_GDT(%bp)
701
+	sidt	VC_OFFSET_IDT(%bp)
702
+	sgdt	VC_OFFSET_GDT(%bp)
703
 
703
 
704
 	/* For sanity's sake, clear the direction flag as soon as possible */
704
 	/* For sanity's sake, clear the direction flag as soon as possible */
705
 	cld
705
 	cld
706
 
706
 
707
 	/* Switch to protected mode and move register dump to PM stack */
707
 	/* Switch to protected mode and move register dump to PM stack */
708
-	movl	$PC_OFFSET_END, %ecx
709
-	pushl	$VIRTUAL(pc_pmode)
708
+	movl	$VC_OFFSET_END, %ecx
709
+	pushl	$VIRTUAL(vc_pmode)
710
 	jmp	real_to_prot
710
 	jmp	real_to_prot
711
-	.section ".text.prot_call", "ax", @progbits
711
+	.section ".text.virt_call", "ax", @progbits
712
 	.code32
712
 	.code32
713
-pc_pmode:
713
+vc_pmode:
714
 	/* Call function */
714
 	/* Call function */
715
-	leal	PC_OFFSET_IX86(%esp), %eax
715
+	leal	VC_OFFSET_IX86(%esp), %eax
716
 	pushl	%eax
716
 	pushl	%eax
717
-	call	*(PC_OFFSET_FUNCTION+4)(%esp)
717
+	call	*(VC_OFFSET_FUNCTION+4)(%esp)
718
 	popl	%eax /* discard */
718
 	popl	%eax /* discard */
719
 
719
 
720
 	/* Switch to real mode and move register dump back to RM stack */
720
 	/* Switch to real mode and move register dump back to RM stack */
721
-	movl	$PC_OFFSET_END, %ecx
721
+	movl	$VC_OFFSET_END, %ecx
722
 	movl	%esp, %esi
722
 	movl	%esp, %esi
723
-	pushl	$pc_rmode
723
+	pushl	$vc_rmode
724
 	jmp	prot_to_real
724
 	jmp	prot_to_real
725
-	.section ".text16.prot_call", "ax", @progbits
725
+	.section ".text16.virt_call", "ax", @progbits
726
 	.code16
726
 	.code16
727
-pc_rmode:
727
+vc_rmode:
728
 	/* Restore registers and flags and return */
728
 	/* Restore registers and flags and return */
729
-	addw	$( PC_OFFSET_IX86 + 4 /* also skip %cs and %ss */ ), %sp
729
+	addw	$( VC_OFFSET_IX86 + 4 /* also skip %cs and %ss */ ), %sp
730
 	popw	%ds
730
 	popw	%ds
731
 	popw	%es
731
 	popw	%es
732
 	popw	%fs
732
 	popw	%fs
742
 	popfw	/* padding */
742
 	popfw	/* padding */
743
 
743
 
744
 	/* Return and discard function parameters */
744
 	/* Return and discard function parameters */
745
-	ret	$( PC_OFFSET_END - PC_OFFSET_PARAMS )
745
+	ret	$( VC_OFFSET_END - VC_OFFSET_PARAMS )
746
 
746
 
747
 /****************************************************************************
747
 /****************************************************************************
748
  * real_call (protected-mode near call, 32-bit virtual return address)
748
  * real_call (protected-mode near call, 32-bit virtual return address)

+ 5
- 5
src/arch/x86/transitions/librm_test.c View File

52
 /** Real-mode call profiler */
52
 /** Real-mode call profiler */
53
 static struct profiler real_call_profiler __profiler = { .name = "real_call" };
53
 static struct profiler real_call_profiler __profiler = { .name = "real_call" };
54
 
54
 
55
-/** Protected-mode call profiler */
56
-static struct profiler prot_call_profiler __profiler = { .name = "prot_call" };
55
+/** Virtual call profiler */
56
+static struct profiler virt_call_profiler __profiler = { .name = "virt_call" };
57
 
57
 
58
 /**
58
 /**
59
  * Dummy function for profiling tests
59
  * Dummy function for profiling tests
101
 		profile_stop ( &real_call_profiler );
101
 		profile_stop ( &real_call_profiler );
102
 	}
102
 	}
103
 
103
 
104
-	/* Profile complete protected-mode call cycle */
104
+	/* Profile complete virtual call cycle */
105
 	for ( i = 0 ; i < PROFILE_COUNT ; i++ ) {
105
 	for ( i = 0 ; i < PROFILE_COUNT ; i++ ) {
106
 		__asm__ __volatile__ ( REAL_CODE ( "rdtsc\n\t"
106
 		__asm__ __volatile__ ( REAL_CODE ( "rdtsc\n\t"
107
 						   "movl %k0, %k2\n\t"
107
 						   "movl %k0, %k2\n\t"
109
 						   "rdtsc\n\t" )
109
 						   "rdtsc\n\t" )
110
 				       : "=a" ( stopped ), "=d" ( discard_d ),
110
 				       : "=a" ( stopped ), "=d" ( discard_d ),
111
 					 "=R" ( started ) : );
111
 					 "=R" ( started ) : );
112
-		profile_start_at ( &prot_call_profiler, started );
113
-		profile_stop_at ( &prot_call_profiler, stopped );
112
+		profile_start_at ( &virt_call_profiler, started );
113
+		profile_stop_at ( &virt_call_profiler, stopped );
114
 	}
114
 	}
115
 }
115
 }
116
 
116
 

Loading…
Cancel
Save