|
@@ -640,19 +640,19 @@ intr_to_prot:
|
640
|
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
|
645
|
* Call a specific C function in the protected-mode code. The
|
646
|
646
|
* prototype of the C function must be
|
647
|
647
|
* void function ( struct i386_all_regs *ix86 );
|
648
|
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
|
652
|
* function explicitly overwrites values in ix86. Interrupt status
|
653
|
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
|
656
|
* remaining intact in order to return, since everything relevant is
|
657
|
657
|
* copied to the protected-mode stack for the duration of the call.
|
658
|
658
|
* In particular, this means that a real-mode prefix can make a call
|
|
@@ -666,26 +666,26 @@ intr_to_prot:
|
666
|
666
|
*
|
667
|
667
|
* Example usage:
|
668
|
668
|
* pushl $pxe_api_call
|
669
|
|
- * call prot_call
|
|
669
|
+ * call virt_call
|
670
|
670
|
* to call in to the C function
|
671
|
671
|
* void pxe_api_call ( struct i386_all_regs *ix86 );
|
672
|
672
|
****************************************************************************
|
673
|
673
|
*/
|
674
|
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
|
683
|
.previous
|
684
|
684
|
|
685
|
|
- .section ".text16.prot_call", "ax", @progbits
|
|
685
|
+ .section ".text16.virt_call", "ax", @progbits
|
686
|
686
|
.code16
|
687
|
|
- .globl prot_call
|
688
|
|
-prot_call:
|
|
687
|
+ .globl virt_call
|
|
688
|
+virt_call:
|
689
|
689
|
/* Preserve registers, flags and GDT on external RM stack */
|
690
|
690
|
pushfw /* padding */
|
691
|
691
|
pushfl
|
|
@@ -696,37 +696,37 @@ prot_call:
|
696
|
696
|
pushw %ds
|
697
|
697
|
pushw %ss
|
698
|
698
|
pushw %cs
|
699
|
|
- subw $PC_OFFSET_IX86, %sp
|
|
699
|
+ subw $VC_OFFSET_IX86, %sp
|
700
|
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
|
704
|
/* For sanity's sake, clear the direction flag as soon as possible */
|
705
|
705
|
cld
|
706
|
706
|
|
707
|
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
|
710
|
jmp real_to_prot
|
711
|
|
- .section ".text.prot_call", "ax", @progbits
|
|
711
|
+ .section ".text.virt_call", "ax", @progbits
|
712
|
712
|
.code32
|
713
|
|
-pc_pmode:
|
|
713
|
+vc_pmode:
|
714
|
714
|
/* Call function */
|
715
|
|
- leal PC_OFFSET_IX86(%esp), %eax
|
|
715
|
+ leal VC_OFFSET_IX86(%esp), %eax
|
716
|
716
|
pushl %eax
|
717
|
|
- call *(PC_OFFSET_FUNCTION+4)(%esp)
|
|
717
|
+ call *(VC_OFFSET_FUNCTION+4)(%esp)
|
718
|
718
|
popl %eax /* discard */
|
719
|
719
|
|
720
|
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
|
722
|
movl %esp, %esi
|
723
|
|
- pushl $pc_rmode
|
|
723
|
+ pushl $vc_rmode
|
724
|
724
|
jmp prot_to_real
|
725
|
|
- .section ".text16.prot_call", "ax", @progbits
|
|
725
|
+ .section ".text16.virt_call", "ax", @progbits
|
726
|
726
|
.code16
|
727
|
|
-pc_rmode:
|
|
727
|
+vc_rmode:
|
728
|
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
|
730
|
popw %ds
|
731
|
731
|
popw %es
|
732
|
732
|
popw %fs
|
|
@@ -742,7 +742,7 @@ pc_rmode:
|
742
|
742
|
popfw /* padding */
|
743
|
743
|
|
744
|
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
|
748
|
* real_call (protected-mode near call, 32-bit virtual return address)
|